Atton Posted October 1, 2013 Share Posted October 1, 2013 I have been trying to make this system work for opening gates and settings groups. I have had some success however I have hit sort of a brick in an attempt to export a check function for gates and so on. The idea of this script is pretty much to allow a player to join the cop or criminal group then have access to the tools of that group. Gates,car spawns,warp makers ect. Below is the code any help will be much appreciated. function CAP () COP = createTeam ("COPS",0,0,255) CR = createTeam("CRIMINALS",255,0,0) end CAP() function JC (thePlayer) setPlayerTeam(thePlayer,CR) outputChatBox("Welcome to the criminals team",thePlayer) end addCommandHandler("Criminal",JC) function JP (thePlayer) setPlayerTeam(thePlayer,COP) outputChatBox("Welcome to the cops team",thePlayer) end addCommandHandler("Cop",JP) function checkCriminal (thePlayer) if (getTeamFromName(thePlayer) == "CRIMINALS") then return true else return false end end Link to comment
eAi Posted October 1, 2013 Share Posted October 1, 2013 getTeamFromName returns a team object (i.e. your COP or CR variables) not a string. Link to comment
Atton Posted October 1, 2013 Author Share Posted October 1, 2013 getTeamFromName returns a team object (i.e. your COP or CR variables) not a string. So how should I go about fixing this. Link to comment
xScatta Posted October 1, 2013 Share Posted October 1, 2013 Try that. ((Not Tested)). function CAP () COP = createTeam ("COPS",0,0,255) CR = createTeam("CRIMINALS",255,0,0) end CAP() function JC (thePlayer) setPlayerTeam(thePlayer,CR) outputChatBox("Welcome to the criminals team",thePlayer) end addCommandHandler("Criminal",JC) function JP (thePlayer) setPlayerTeam(thePlayer,COP) outputChatBox("Welcome to the cops team",thePlayer) end addCommandHandler("Cop",JP) function checkCriminal (thePlayer) team = getTeamFromName("CRIMINALS") if getTeamName(team) then return true else return false end end Link to comment
Discord Moderators Zango Posted October 1, 2013 Discord Moderators Share Posted October 1, 2013 I can't figure out the logic in xScatta's code. I think he forgot to check that the name of "team" was "CRIMINAL" function CAP () COP = createTeam ("COPS",0,0,255) CR = createTeam("CRIMINALS",255,0,0) end CAP() function JC (thePlayer) setPlayerTeam(thePlayer,CR) outputChatBox("Welcome to the criminals team",thePlayer) end addCommandHandler("Criminal",JC) function JP (thePlayer) setPlayerTeam(thePlayer,COP) outputChatBox("Welcome to the cops team",thePlayer) end addCommandHandler("Cop",JP) function checkCriminal (thePlayer) local playerTeam = getPlayerTeam (thePlayer) if (not playerTeam) then return false end if (getTeamName(playerTeam) == "CRIMINALS") then return true else return false end end Alternatively you could compare "playerTeam" with your variable "CR" instead. Link to comment
xScatta Posted October 1, 2013 Share Posted October 1, 2013 BTW. Thisisdoge don't disturb me i just wanted to help... 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