Hero192 Posted August 23, 2015 Share Posted August 23, 2015 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
JR10 Posted August 23, 2015 Share Posted August 23, 2015 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
Walid Posted August 23, 2015 Share Posted August 23, 2015 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
JR10 Posted August 23, 2015 Share Posted August 23, 2015 This is probably right, however, it's different from your code. Link to comment
Hero192 Posted August 23, 2015 Author Share Posted August 23, 2015 Thanks both of you , i understood my problem Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now