Does anyone know how to make it so when the mayor dies, he loses his job? If so I plead that you answer this question!
Put this in lua/autorun/*.lua
[lua]
function DemoteMayorToCitizen(ply)
if ply:Team() == TEAM_MAYOR then ply:ChangeTeam(TEAM_CITIZEN) end
end
hook.Add("PlayerDeath", "DemoteMayorToCitizen", DemoteMayorToCitizen)
[/lua]
I didnt make this..
I tried that, it does not work though if you put it in "lua/autorun/*.lua".
Don't you have to put it somewhere in the gamemode itself?
lua/autorun/server/sh_deathdemote.lua
[code]
AddCSLuaFile("sh_deathdemote.lua")
function playerdeathdemote( ply )
if (ply:Team() == (TEAM_MAYOR) then
ply:SetTeam(TEAM_CITIZEN) )
end
end
hook.Add("PlayerDeath", "DemoteMayorToCitizen", DemoteMayorToCitizen) [/code]
Sorry, you need to Log In to post a reply to this thread.