• function to give ammo not working
    3 replies, posted
I am new to code and added this to functions_gamemode.lua in a gamemode called DarkRP. I was wondering whats wrong with this: [CODE]function ammogive(ply) if ply:Team() == TEAM_POLICE then ply:GiveAmmo("tenmmauto", 50) end end hook.Add("PlayerLoadout", "plou", ammogive)[/CODE]
Make sure you made tenmmauto a ammo type. [LUA]function ammogive(ply) if ply:Team() == TEAM_POLICE then ply:GiveAmmo(50, "tenmmauto", true) end end hook.Add("PlayerLoadout", "plou", ammogive)[/LUA]
GM:AddAmmoType("tenmmauto", "10mm Auto", "models/Items/BoxSRounds.mdl", 50, 50) ammotypes.lua Let me try yours. edit: Nope it didnt work
I tried this and it worked. [LUA]game.AddAmmoType({ name = "ammo", dmgtype = DMG_BULLET, tracer = 3, plydmg = 0, npcdmg = 0, force = 2000, minsplash = 10, maxsplash = 5 }) function GM:PlayerLoadout( pl ) pl:GiveAmmo( 255, "ammo", true ) end[/LUA]
Sorry, you need to Log In to post a reply to this thread.