• Adding a RunCmd to Victim on death
    2 replies, posted
This might be the easiest thing ever, but i'm probably just oblivious to it. This is code for when the mayor dies he gets reset to a citizen [code] local gamemodeget = GetConVarString("gamemode") if string.find(gamemodeget, "darkrp") then function PlayerDied(victim, attacker) if victim:Team() == TEAM_MAYOR then victim:SetTeam(TEAM_CITIZEN) for k,v in pairs(player.GetAll()) do v:ChatPrint(victim:Nick().." has been assassinated by "..attacker:Nick()) end end end end hook.Add("PlayerDeath", "mayordied", PlayerDied) [/code] But when the mayor dies, and turns to a citizen his job name stays 'Mayor' Meaning you have a citizen running around with the Mayor job To fix it would i add Victim:RunCmd("/job Citizen") ?? If i do, where do i add it during the function? Thanks again
[URL="http://www.facepunch.com/showthread.php?t=835688"]http://www.facepunch.com/showthread.php?t=835688[/URL] [URL="http://facepunch.com/showthread.php?t=1275832"]http://facepunch.com/showthread.php?t=1275832[/URL] [URL="http://www.facepunch.com/showthread.php?t=1236055"]http://www.facepunch.com/showthread.php?t=1236055[/URL] [URL="http://facepunch.com/showthread.php?t=1200723"]http://facepunch.com/showthread.php?t=1200723[/URL] [URL="http://www.facepunch.com/showthread.php?t=980087"]http://www.facepunch.com/showthread.php?t=980087[/URL] You need to start using Google.
[QUOTE=Davehkiin;41305500]This might be the easiest thing ever, but i'm probably just oblivious to it. This is code for when the mayor dies he gets reset to a citizen [code] local gamemodeget = GetConVarString("gamemode") if string.find(gamemodeget, "darkrp") then function PlayerDied(victim, attacker) if victim:Team() == TEAM_MAYOR then victim:ChangeTeam(TEAM_CITIZEN, true) for k,v in pairs(player.GetAll()) do v:ChatPrint(victim:Nick().." has been assassinated by "..attacker:Nick()) end end end end hook.Add("PlayerDeath", "mayordied", PlayerDied) [/code] [/quote] Use [code]victim:ChangeTeam(TEAM_CITIZEN, true)[/code] (Edited your code in the quote)
Sorry, you need to Log In to post a reply to this thread.