..:D&G:.. Posted January 26, 2015 Share Posted January 26, 2015 Hello, I am trying to make a job script, and I want to make a function where, if the player is not in the Criminal job then the gui will appear, else outputChatBox a message, here is the code: addEventHandler ( "onClientMarkerHit" , Marker , function ( hitPlayer ) if not (getPlayerTeam(hitPlayer) == "Criminal") then guiSetVisible ( GUIEditor.window[1] , true ) showCursor ( true ) else outputChatBox("You are already a criminal!", hitPlayer, 255, 0, 0) end end , false ) It doesn't output the message nor the gui. Link to comment
Mr_Moose Posted January 26, 2015 Share Posted January 26, 2015 getPlayerTeam(hitPlayer) Returns a team element and "Criminal" is a string, so you can't compare them that way. You have to convert the string into a team or the team into a string, I would recommend the first option to avoid errors in case a player doesn't have a team at all. if getPlayerTeam(hitPlayer) == getTeamFromName("Criminal") then And that's all you need. Link to comment
TAPL Posted January 27, 2015 Share Posted January 27, 2015 You need also to make sure that the player who hit the marker is the localPlayer. And outputChatBox client side doesn't have player argument. 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