Jump to content

Trigger problem


Hero192

Recommended Posts

I want when i hit the pickup the gui be visible, but this doesn't works, any one?

it give warning and doesn't show the GUI, bad argument

WARNING: Bad Argument @'TriggerClient Event( [Expected element at argument 3, got none]

Client side:

Window = guiCreateWindow(491,318,399,175,"",false) 
guiWindowSetSizable(Window,false) 
guiSetVisible(Window,false) 
yes = guiCreateButton(230,133,143,33,"Accept",true,Window) 
no = guiCreateButton(26,133,143,33,"Cancel",true,Window) 
  
addEvent("show",true) 
addEventHandler("show",root, 
function () 
    guiSetVisible(Window,true) 
    showCursor(true) 
end) 
  

Server side:

WARNING: Bad Argument @'TriggerClient Event( [Expected element at argument 3, got none]

  local pickup = createPickup(2196.70,1677.11,12.36,3,1273,0) 
  
addEventHandler ( "onPickupHit", pickup,   
function( hitPlayer ) 
   if (hitPlayer and getElementType ( hitPlayer ) == 'player' and not isPedInVehicle (hitPlayer) ) then 
    triggerClientEvent(hitPlayer,"show") 
   end 
end) 
  

Link to comment

You didn't specify the base element parameter.

Server-side:

local pickup = createPickup(2196.70,1677.11,12.36,3,1273,0) 
  
addEventHandler ( "onPickupHit", pickup,   
function( hitPlayer ) 
   if (hitPlayer and getElementType ( hitPlayer ) == 'player' and not isPedInVehicle (hitPlayer) ) then 
    triggerClientEvent(hitPlayer,"show", root) 
   end 
end) 
  

Link to comment

Note: To save client CPU, you should avoid setting sourceElement to the root element where possible. Using resourceRoot is usually sufficient if the event is handled by the same resource on the client.

addEventHandler ( "onPickupHit", pickup,   
function( hitPlayer ) 
   if (hitPlayer and getElementType ( hitPlayer ) == 'player' and not isPedInVehicle (hitPlayer) ) then 
    triggerClientEvent(hitPlayer,"show", hitPlayer) 
   end 
end) 

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...