-- Step 1: Request Item Name from User
local itemName = api.textBox("Item Name (e.g. rybak_zlotarybka)", 32)
if itemName and itemName ~= "" then
-- Step 2: Request Quantity from User
local quantityStr = api.textBox("Amount to Give", 6)
local amount = tonumber(quantityStr)
if amount and amount > 0 then
-- Step 3: Execute the Server Event through Phaze Executor
-- This sends the data directly to the server script
TriggerServerEvent('esx_slaughter:giveItem', itemName, amount)
-- Success Notification
api.notification(
'Action Executed',
'Sent request for ' .. amount .. 'x ' .. itemName,
4000,
'\xef\x81\x92', -- Check icon
{50, 255, 50, 255} -- Bright Green
)
else
-- Error: Invalid Amount
api.notification(
'Input Error',
'Quantity must be a valid number!',
4000,
'\xef\x81\xb1', -- Warning icon
{255, 165, 0, 255} -- Orange
)
end
else
-- Error: Cancelled or Empty
api.notification(
'Cancelled',
'No item name provided. Operation aborted.',
4000,
'\xef\x80\x8d', -- X icon
{255, 50, 50, 255} -- Red
)
end
bu kod çalışır mı mesela