Jump to content

setElementData problem


TheIceman1

Recommended Posts

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

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
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

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...