TheIceman1 Posted March 14, 2013 Share Posted March 14, 2013 Why this dont dont set player(playerName) data ( "clan" ), and why i see message ( "You are invited..." ) and not player who i invited?No errors. GUIEditor_Grid[2] = guiCreateGridList(10,23,276,256,false,GUIEditor_Window[2]) function inviteplayer () if ( source == GUIEditor_Button[8] ) then if ( getElementData ( localPlayer, "leader" ) ) then local playerName = guiGridListGetItemText ( GUIEditor_Grid[3], guiGridListGetSelectedItem ( GUIEditor_Grid[3] ), 1 ) if ( playerName ) then local clan = getElementData ( localPlayer, "clan" ) local player = getPlayerFromName ( playerName ) setElementData ( player, "clan", clan ) outputChatBox ( "You are invited in "..clan.." by "..getPlayerName(localPlayer), getPlayerFromName( playerName ), 255, 255, 20 ) end end end end addEventHandler ( "onClientGUIClick", root, inviteplayer ) Link to comment
Renkon Posted March 14, 2013 Share Posted March 14, 2013 Cause this code is played only in the player who makes the INVITATION. And please notice that elementData modified client-side will only affect the CLIENT (localPlayer) In fact, you can't send a message to everybody from clientside, you MUST do a server trigger Link to comment
TheIceman1 Posted March 14, 2013 Author Share Posted March 14, 2013 I dont understand... Link to comment
Renkon Posted March 14, 2013 Share Posted March 14, 2013 You MUST use setElementData serverside in other words.... since that piece of code is ONLY executed in leader's client, while it should go client -> server -> ¿client? Link to comment
DiSaMe Posted March 14, 2013 Share Posted March 14, 2013 And please notice that elementData modified client-side will only affect the CLIENT (localPlayer) That's wrong. Element data is always synced unless you set the 4th argument to false. Link to comment
Renkon Posted March 14, 2013 Share Posted March 14, 2013 And please notice that elementData modified client-side will only affect the CLIENT (localPlayer) That's wrong. Element data is always synced unless you set the 4th argument to false. As far as I knew, if you modified elementData clientside it wouldn't be synced with the server Link to comment
Castillo Posted March 14, 2013 Share Posted March 14, 2013 It'll sync with the server if you set it client side. 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