• OnPlayerChangedTeam
    10 replies, posted
Hi, I have a problem with this code [CODE]function Remove ( ply, oldteam, newteam ) if oldteam == TEAM_CITYZEN then ply:SetMaterial("models/shadertest/shader5") end hook.Remove("OnPlayerChangedTeam", "off", SetMaterial)[/CODE] but can change team material is not removed and bug all jobs F4 menu Thx for help!
Are you sure it's TEAM_CITYZEN
[QUOTE=MPan1;50019847]Are you sure it's TEAM_CITYZEN[/QUOTE] yes i have
Try : [CODE] hook.Remove("OnPlayerChangedTeam", "off", Remove) [/CODE]
[QUOTE=Jawad Bendo;50020006]Try : [CODE] hook.Remove("OnPlayerChangedTeam", "off", Remove) [/CODE][/QUOTE] thx for reply I tested hook.Remove("OnPlayerChangedTeam", "off", Remove) hook.Remove("OnPlayerChangedTeam", "on", Remove) but all jobs f4 menu bug and I no see my setmaterial
[code] hook.Add('OnPlayerChangedTeam', 'Whatever', function(ply, prev, next) if prev == TEAM_CITYZEN then ply:SetMaterial('models/shadertest/shader5') end end) [/code] Don't make a global function for only 1 hook. Also, you were trying to remove hook instead of creating.
[QUOTE=iJohnny;50020055][code] hook.Add('OnPlayerChangedTeam', 'Whatever', function(ply, prev, next) if prev == TEAM_CITYZEN then ply:SetMaterial('models/shadertest/shader5') end end) [/code] Don't make a global function for only 1 hook. Also, you were trying to remove hook instead of creating.[/QUOTE] thx for reply all jobs f4 menu work now but can I change jobs the ply:SetMaterial('models/shadertest/shader5') is no remeved
[QUOTE=ST3BL;50020110]thx for reply all jobs f4 menu work now but can I change jobs the ply:SetMaterial('models/shadertest/shader5') is no remeved[/QUOTE] [QUOTE]hook.Add('OnPlayerChangedTeam', 'Whatever', function(ply, prev, next) if prev == TEAM_CITYZEN then ply:SetMaterial('models/shadertest/shader5') end end)[/QUOTE] this code give setmaterial but can change for another jobs this is not remove help me pls
[QUOTE=ST3BL;50022508]this code give setmaterial but can change for another jobs this is not remove help me pls[/QUOTE] i can use this or something like that[QUOTE]if not teams = TEAM_CITYZEN else ply:SetMaterial( "" ) end end[/QUOTE]
I don't think this hook/function works with DarkRP as I tried it myself before with some print() statements and nothing ever showed up One solution is assigning a variable to a player when they first spawn, which holds their team and then use a timer to check if their current team matches that variable
[QUOTE=NiandraLades;50028979]I don't think this hook/function works with DarkRP as I tried it myself before with some print() statements and nothing ever showed up One solution is assigning a variable to a player when they first spawn, which holds their team and then use a timer to check if their current team matches that variable[/QUOTE] thx for reply you have exemple code pls ? thx
Sorry, you need to Log In to post a reply to this thread.