Dannz0r Posted March 24, 2014 Share Posted March 24, 2014 So I have this Roleplay script I started to make from scratch and I have a panel where you press on a 'Team' and when you press select button it sends you to that team, but there is a small problem, if you don't choose a team and just press the button then it just closes the window and your ped is in the same place and not in any team, so I tried to fix it by doing this Client-side function stupidBUG() guiSetVisible(JobsWin, true) showCursor(true) outputChatBox ( "RP: Select a team!", player, 255, 0, 0 ) end addEvent( "blahBlahBlah", true ) addEventHandler( "blahBlahBlah", getRootElement(), stupidBUG ) Server-side addEvent ( "onPlayerChooseTeam" , true ) addEventHandler ( "onPlayerChooseTeam" , root , function ( teamName ) local playerTeam = getPlayerTeam ( source ) -- Check if the player is on a team if playerTeam then -- this player is on a team, so we can remove them from it local oldTeamName = getTeamName ( playerTeam ) else triggerClientEvent ( player, "blahBlahBlah", getRootElement() ) end end) But now the problem is, it will give me error on line 8 (server-side) that string is needed, got a nil, but if I remove 'player' it works but then it triggers the event to the whole server not just that 1 player. how can I fix it? Link to comment
Spajk Posted March 24, 2014 Share Posted March 24, 2014 Use "source" instead of "player". 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