Gravestone Posted March 31, 2016 Share Posted March 31, 2016 (edited) I created a ptp game mode. This code selects the player as a president but I want to disable the selection if there is already a president selected. *removed* Edited April 1, 2016 by Guest Link to comment
FelipeMallmann Posted March 31, 2016 Share Posted March 31, 2016 (edited) 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 April 1, 2016 by Guest Link to comment
Anubhav Posted April 1, 2016 Share Posted April 1, 2016 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
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