01.08.2013, 16:39
How can I make a command that gives infinity ammo to all of a player's weapons?
GetPlayerWeaponData(playerid, slot, &weapons, &ammo);
GivePlayerWeapon(pid,wid,ammo);
stock GiveInfiniteAmmoToWeponSlot(playerid,weaponid,slotid=0) { new wid,ammo; if(slotid) { GetPlayerWeaponData(playerid,slotid,wid,ammo); else { wid = weaponid } GivePlayerWeapon(playerid,wid,10000); }
stock GiveInfinityAmmoToAllWeapons(playerid) { new wid,ammo; for (new i = 0; i < 13; i++) { GetPlayerWeaponData(playerid, i,wid, ammo); GivePlayerWeapon(playerid,wid,10000); } }
CMD:giveallinf(playerid, params[])
{
if(!IsPlayerAdmin(playerid) return SendClientMessage(playerid, -1, "You're not an RCON admin!");
else
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected[i])
new gunid;
gunid = GetPlayerWeapon(i);
SetPlayerAmmo(i, gunid, cellmax);
}
}
return 1;
}