• Give weapon
    10 replies, posted
Not correctly the script works. Not all players receive this weapon Receive only 1-3 humans How to fix? [CODE] hook.Add( "PlayerSpawn", "HumanSpawnFists", function() if ply:Team() != TEAM_HUMAN then return end timer.Simple(0.1,function() if ply:Team() == TEAM_HUMAN then ply:Give( "weapon_zs_fists" ) end end) end ) [/CODE]
Try this code: [LUA] hook.Add( "PlayerSpawn", "HumanSpawnFists", function(ply) if ply:Team() != TEAM_HUMAN then return end ply:Give( "weapon_zs_fists" ) end ) [/LUA]
[QUOTE=B1ts;49454193]Try this code: [LUA] hook.Add( "PlayerSpawn", "HumanSpawnFists", function(ply) if ply:Team() != TEAM_HUMAN then return end ply:Give( "weapon_zs_fists" ) end ) [/LUA][/QUOTE] Didn't help
[QUOTE=godred2;49454262]Didn't help[/QUOTE] Then they aren't TEAM_HUMAN or weapon_zs_fists doesn't exist
They are 100% - TEAM_HUMAN weapon_zs_fists - 100% exists I checked several times [editline]4th January 2016[/editline] I can't understand in what a problem
Where are you adding this code btw? hope you're not adding that code clientside, otherwise the code will not 'work' at all.
[QUOTE=godred2;49454318]They are 100% - TEAM_HUMAN weapon_zs_fists - 100% exists I checked several times I can't understand in what a problem[/QUOTE] Then the problem lies somewhere else, there is nothing wrong with that code.
[QUOTE=B1ts;49454450]Where are you adding this code btw? hope you're not adding that code clientside, otherwise the code will not 'work' at all.[/QUOTE] /garrysmod/lua/autorun/server [editline]4th January 2016[/editline] [QUOTE=HappyGhetto;49454457]Then the problem lies somewhere else, there is nothing wrong with that code.[/QUOTE] I have a Zombie Survival server + PS2 + CAC AntiCheat
Is the file even running? Print something. Also in your OP the function isn't taking ply as an argument.
[CODE]hook.Add( "PlayerSpawn", "HumanSpawnFists", function(ply) if not team.GetName( ply:Team() ) ~= "Human" then return end ply:Give( "weapon_zs_fists" ) end )[/CODE] If worst comes to worst and nothing works you can just use something like this and set the name to whatever the name of the model is. Most of the other code should work, so I'm not sure why it's not.
Thanks to everyone! I solved a problem. /garrysmod/lua/autorun [CODE] hook.Add( "PlayerSpawn", "HumanSpawnFists", function(ply) if ply:Team() != TEAM_HUMAN then return end timer.Simple(10,function() ply:Give( "weapon_zs_fists" ) end) end) [/CODE]
Sorry, you need to Log In to post a reply to this thread.