Atton Posted October 1, 2013 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 Nikola Tesla is love Nikola Tesla is light. Email: [email protected]
eAi Posted October 1, 2013 Posted October 1, 2013 getTeamFromName returns a team object (i.e. your COP or CR variables) not a string.
Atton Posted October 1, 2013 Author 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. Nikola Tesla is love Nikola Tesla is light. Email: [email protected]
xScatta Posted October 1, 2013 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 It's fine to celebrate success but it is more important to heed the lessons of failure.
Moderators Zango Posted October 1, 2013 Moderators 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.
xScatta Posted October 1, 2013 Posted October 1, 2013 BTW. Thisisdoge don't disturb me i just wanted to help... It's fine to celebrate success but it is more important to heed the lessons of failure.
Atton Posted October 2, 2013 Author Posted October 2, 2013 Fixed Nikola Tesla is love Nikola Tesla is light. Email: [email protected]
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