Jump to content

getPlayersInTeam


Gravestone

Recommended Posts

You can use a global variable to do that.

presidentExist = false 
  
addCommandHandler("president", 
    function(player) 
     
    if (presidentExist == false) then 
        presidentExist = true 
        local randomPlayer = getRandomPlayer() 
        local veh = createVehicle(409, 1481.3916015625, -1733.9626464844, 13.3828125) 
        local president = getTeamFromName("President") 
        setPlayerTeam(randomPlayer, getTeamFromName("President")) 
        outputChatBox("#fff000(Mission) #8e8c00Seek help from the #0000ffPolice #8e8c00and reach your target destination", player, 255, 255, 255, true) 
        spawnPlayer(player, 1481.3916015625, -1733.9626464844, 13.3828125) 
        warpPedIntoVehicle(player, veh) 
        fadeCamera(player, true) 
        setCameraTarget(player, player) 
        setPlayerNametagColor(player, 255, 255, 0) 
        setElementModel(player, 17) 
    else 
        outputChatBox("Error: there is already a president selected", player, 255, 0, 0) 
    end 
     
end 
) 

And when president dies you set presidentExist to false

Edited by Guest
Link to comment

Fault at line 6.

  
presidentExist = false 
  
addCommandHandler("president", 
    function(player) 
    
    if (presidentExist == false) then 
        presidentExist = true 
        local randomPlayer = getRandomPlayer() 
        local veh = createVehicle(409, 1481.3916015625, -1733.9626464844, 13.3828125) 
        local president = getTeamFromName("President") 
        setPlayerTeam(randomPlayer, getTeamFromName("President")) 
        outputChatBox("#fff000(Mission) #8e8c00Seek help from the #0000ffPolice #8e8c00and reach your target destination", player, 255, 255, 255, true) 
        spawnPlayer(player, 1481.3916015625, -1733.9626464844, 13.3828125) 
        warpPedIntoVehicle(player, veh) 
        fadeCamera(player, true) 
        setCameraTarget(player, player) 
        setPlayerNametagColor(player, 255, 255, 0) 
        setElementModel(player, 17) 
    else 
        outputChatBox("Error: there is already a president selected", player, 255, 0, 0) 
    end 
    
end 
) 
  

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