Problem with Ammo

Hey guys,
I’m working on a Deathrun server and have a problem with the weapons at the endings from some maps. For example the SMG, I want that the players have more than just 45 shots when they pick them up, but without picking up tons of ammunition.They’re supposed to have more ammo right away. I know from other servers that the weapons have 9999 shots when you pick them up, but I don’t get how it works. Can somebody help me with that?

Mfg Fuil

Give them the ammo in this hook.

Do I just have to put this into the hook?
player.GetAll():GiveAmmo( 9999, “357”, true )
player.GetAll():GiveAmmo( 9999, “Buckshot”, true )
player.GetAll():GiveAmmo( 9999, “RPG_Round”, true )
player.GetAll():GiveAmmo( 9999, “Grenade”, true )

Or do I have to use different commands?

Just give the specified player the ammo on PlayerSpawn instead



function giveam(ply)
ply:GiveAmmo( 9999, "Pistol" ) --Give ammo "Pistol"
end
hook.Add("PlayerSpawn","SpawnInfAmmo", giveam) -- When player spawn


Okay thanks, but in which file do I put this? The player.lua?
@Jawad Bendo

[editline]28th March 2016[/editline]

And is this so right?

function giveam(ply)
ply:GiveAmmo( 9999, “357” )
ply:GiveAmmo( 9999, “SMG1” )
ply:GiveAmmo( 9999, “RPG_Round” )
ply:GiveAmmo( 9999, “Buckshot” )
end
hook.Add(“PlayerSpawn”,“SpawnInfAmmo”, giveam)

Any sv_* lua really sv standing for serverside

lua/autorun/server

-> sv_ammo.lua