Jump to content

[HELP]Fix error in script


Black2

Recommended Posts

Hello,I got this script it will not let the team shoot but when it leaves the team still not shooting anyone could fix?

Thx.

teamList = { -- you must add some teams here. 
["SWAT"] = true, 
["Police"] = true, 
["Civil"] = false 
} 
  
function checkPlayerInTeam( ) 
    local team = getPlayerTeam( getLocalPlayer() ) 
    if team then 
        if ( teamList[getTeamName( team )] ) then 
    toggleControl ("fire", false) 
    toggleControl ("aim_weapon", false) 
    toggleControl ("vehicle_fire", false) 
end 
else 
    toggleControl ("fire", true) 
    toggleControl ("aim_weapon", true) 
    toggleControl ("vehicle_fire", true) 
    end 
end 
setTimer(checkPlayerInTeam, 1000, 0 ) -- every second it will check if you are in team. 

Link to comment

I'm not sure!

teamList = { -- you must add some teams here. 
["SWAT"] = true, 
["Police"] = true, 
["Civil"] = false 
} 
  
function checkPlayerInTeam( ) 
    local team = getPlayerTeam( getLocalPlayer() ) 
    if team then 
        if ( teamList[getTeamName( team )] ) then 
    toggleControl ("fire", false) 
    toggleControl ("aim_weapon", false) 
    toggleControl ("vehicle_fire", false) 
else 
    toggleControl ("fire", true) 
    toggleControl ("aim_weapon", true) 
    toggleControl ("vehicle_fire", true) 
         end 
    end 
end 
setTimer(checkPlayerInTeam, 1000, 0 ) 

Link to comment
Hello,I got this script it will not let the team shoot but when it leaves the team still not shooting anyone could fix?

Thx.

teamList = { -- you must add some teams here. 
["SWAT"] = true, 
["Police"] = true, 
["Civil"] = false 
} 
  
function checkPlayerInTeam( ) 
    local team = getPlayerTeam( getLocalPlayer() ) 
    if team then 
        if ( teamList[getTeamName( team )] ) then 
    toggleControl ("fire", false) 
    toggleControl ("aim_weapon", false) 
    toggleControl ("vehicle_fire", false) 
end 
else 
    toggleControl ("fire", true) 
    toggleControl ("aim_weapon", true) 
    toggleControl ("vehicle_fire", true) 
    end 
end 
setTimer(checkPlayerInTeam, 1000, 0 ) -- every second it will check if you are in team. 

I dont think this way of doing it is very good, because you are toggling the control every second using a timer. You should use this function only when the player's team changes

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