I got this ammo box from the AIZombies mod, but I'm trying to make it give ammo when you press F.
Code:
giveAmmo()
{
level endon("disconnect");
for(;;)
{
foreach( player in level.players )
{
if(!isDefined(player.ammoing))
player.ammoing = false;
if(distancesquared(self.origin, player.origin) <= 9732 && !player.ammoing)
{
if(player.sessionstate != "playing")
continue;
player thread ammoWaitThread();
player playlocalsound("weap_pickup");
player giveMaxAmmo(player getCurrentWeapon());
player giveMaxAmmo(player getCurrentOffhand());
}
}
wait 0.05;
}
}
ammoWaitThread()
{
self endon("death");
self endon("disconnect");
self.ammoing = true;
wait 1;
self.ammoing = false;
}
I've tried quite alot, but when I seem to do it it SPAMS me with ammo when I havent even clicked F.
So either a solution for that, or a code that would spawn a box that gives ammo at <coordinates>. Though I'd like it to be a thread that I can do into a create block, like i did here:
Code:
CreateAmmoBlock(pos, angle)
{
block = spawn("script_model", pos );
block setModel("com_bomb_objective");
block.angles = angle;
block Solid();
block thread giveAmmo();
block CloneBrushmodelToScriptmodel( level.airDropCrateCollision );
wait 0.01;
}
Second one is a box that gives a semtex/frag/c4/stun or whatever. I havent gotten this already, and I'd either like a thread for <coordinates> or something I could add into a block as stated above.
EDIT: Oh yeah, and make the ammo sign over the ammo box would be pwnage (:
Tried to copypaste that too from the AIZombies but it kind of went.. bad
Thanks (: