-stolka- Posted September 28, 2013 Share Posted September 28, 2013 why when i open the GUI every player see it? function arrestGui ( arrest ) outputChatBox ( "client arrest " .. arrest ) guiSetVisible(windowArrest, true) showCursor(true) guiSetText ( GUIEditor_Label[2],"arrests:"..arrest ) end addEvent( "onArrestRequest", true ) addEventHandler( "onArrestRequest", getRootElement(), arrestGui ) Link to comment
K4stic Posted September 28, 2013 Share Posted September 28, 2013 function arrestGui ( player, arrest ) if ( player == localPlayer ) then outputChatBox ( "client arrest " .. arrest ) guiSetVisible(windowArrest, true) showCursor(true) guiSetText ( GUIEditor_Label[2],"arrests:"..arrest ) end end addEvent( "onArrestRequest", true ) addEventHandler( "onArrestRequest", getRootElement(), arrestGui ) Just then you tigger to open gui use double the player ellement example: triggerClientEvent( "onArrestRequest", player, player, arrest ) Link to comment
-stolka- Posted September 28, 2013 Author Share Posted September 28, 2013 it's not working... it says expected element at argument 2 triggerClientEvent( "onArrestRequest", player, player, arrest ) Link to comment
iPrestege Posted September 28, 2013 Share Posted September 28, 2013 Show the full function for the server side. Link to comment
-stolka- Posted September 28, 2013 Author Share Posted September 28, 2013 function showArrest ( playerSource ) local arrest = getElementData(playerSource, "arrest") if not arrest then outputChatBox("you dont have any arrest",playerSource) else outputChatBox("arrest: "..arrest,playerSource) triggerClientEvent( "onArrestRequest",getRootElement(), arrest ) end end addCommandHandler ( "arrest", showArrest ) Link to comment
فاّرس Posted September 28, 2013 Share Posted September 28, 2013 triggerClientEvent( "onArrestRequest",source, arrest ) Link to comment
-stolka- Posted September 28, 2013 Author Share Posted September 28, 2013 triggerClientEvent( "onArrestRequest",source, arrest ) not working this is my client side function function arrestGui ( arrest ) if ( player == localPlayer ) then outputChatBox ( "client arrest " .. arrest ) guiSetVisible(windowArrest, true) showCursor(true) guiSetText ( GUIEditor_Label[2],"arrests:"..arrest ) end end addEvent( "onArrestRequest", true ) addEventHandler( "onArrestRequest", getRootElement(), arrestGui ) Link to comment
فاّرس Posted September 28, 2013 Share Posted September 28, 2013 function arrestGui ( arrest ) outputChatBox ( "client arrest " .. arrest ) guiSetVisible(windowArrest, true) showCursor(true) guiSetText ( GUIEditor_Label[2],"arrests:"..arrest ) end addEvent( "onArrestRequest", true ) addEventHandler( "onArrestRequest", getRootElement(), arrestGui ) Link to comment
-stolka- Posted September 28, 2013 Author Share Posted September 28, 2013 well still not working Link to comment
-stolka- Posted September 28, 2013 Author Share Posted September 28, 2013 please help Link to comment
فاّرس Posted September 28, 2013 Share Posted September 28, 2013 'windowArrest' is a window variable? Link to comment
TAPL Posted September 28, 2013 Share Posted September 28, 2013 You don't need server side, it can be done client side. function arrestGui() local arrest = getElementData(localPlayer, "arrest") if arrest then outputChatBox("arrest: "..arrest) guiSetVisible(windowArrest, true) showCursor(true) guiSetText(GUIEditor_Label[2], "arrests: "..arrest) else outputChatBox("you don't have any arrest") end end addCommandHandler("arrest", arrestGui) Link to comment
iPrestege Posted September 28, 2013 Share Posted September 28, 2013 triggerClientEvent( "onArrestRequest",source, arrest ) Using source is wrong . playerSource as it's defined in the function . Link to comment
TAPL Posted September 28, 2013 Share Posted September 28, 2013 You all using it wrong way. Syntax: bool triggerClientEvent ( [element sendTo=getRootElement()], string name, element theElement, [arguments...] ) The first argument is 'sendTo' that mean who you want trigger to, if you haven't specific the sendTo it will be root by default (for all). While the third argument will be the source of the event at the client side (every event have source isn't it? the same with custom events). 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