Ok, so i have this code that makes it so a player has a perma weapon
[CODE]hook.Add("PlayerSpawn", "GiveWeapons", function(ply)
if ply:SteamID() == "id" then
ply:Give("weapon")
end
end)[/CODE]
And it only works on one player i want to use something like this
[CODE]hook.Add("PlayerSpawn", "GiveWeapons", function(ply)
if ply:SteamID() == "id" then
ply:Give("weapon")
hook.Add("PlayerSpawn", "GiveWeapons", function(ply)
if ply:SteamID() == "id" then
ply:Give("weapon")
end
end)[/CODE]
But when ever i do this i get errors please post your fixes below thanks allot for helping!
Use this instead:
[CODE]
hook.Add("PlayerSpawn", "GiveWeapons", function(ply)
if ply:SteamID() == "id" then
ply:Give("weapon")
elseif ply:SteamID() == "id" then
ply:Give("weapon")
elseif ply:SteamID() == "id" then
ply:Give("weapon")
elseif ply:SteamID() == "id" then
ply:Give("weapon")
elseif ply:SteamID() == "id" then
ply:Give("weapon")
elseif ply:SteamID() == "id" then
ply:Give("weapon")
end
end)
[/CODE]
It should be pretty clear what it means by now.
Yea im starting to get the hang of hook.Add thanks to facepunch
It's basically just "called" when something within the game takes place, such as a player spawning.
You could liken it to a phone. So if your buddy down at PizzaHut is baking a pizza, then it would be like him calling you and being like "The pizza is baking." And from that, you would prepare your money or something.
[CODE]
hook.Add("PizzaBaking", "Nameofthehook", function(self)
self:PrepareTheGoods()
end)
[/CODE]
And now he's driving on his way.
[CODE]
hook.Add("DriverDriving", "Nameofthehook", function(self)
self:PrepareTheGoodsMore()
end)
[/CODE]
Sorry, you need to Log In to post a reply to this thread.