Jump to content

Group Check


Atton

Recommended Posts

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

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

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

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