14.10.2013, 21:04
(
Последний раз редактировалось InglewoodRoleplay; 14.10.2013 в 21:51.
)
Here you go:
pawn Код:
#define MAX_AMMO 6000
/* This one requires you to have the foreach loops */
massGiveMiniguns(gunid, ammo = -1) {
foreach(Player, i) {
if(IsPlayerConnected(i)) {
ResetPlayerWeapons(i);
if(ammo != -1) {
GivePlayerWeapon(i, gunid, ammo);
} else {
GivePlayerWeapon(i, gunid, MAX_AMMO);
}
}
}
}
/* If you don't have the foreach loops, use this one */
massGiveGun(gunid, ammo = -1) {
for(new i=0; i<MAX_PLAYERS; i++) {
if(IsPlayerConnected(i)) {
ResetPlayerWeapons(i);
if(ammo != -1) {
GivePlayerWeapon(i, gunid, ammo);
} else {
GivePlayerWeapon(i, gunid, MAX_AMMO);
}
}
}
}
YCMD:massgivegun(playerid, params[], help) { //I recommend using the YCMD command processor if you aren't using it already..
if(help) {
SendClientMessage(playerid, X11_WHITE, "Gives weapons to all the players");
return 1;
}
new weaponid, ammo;
if(!sscanf(params, "dd", weaponid, ammo)) {
massGiveGun(weaponid);
SendClientMessage(playerid, COLOR_LIGHTGREEN, "[Notice]: Weapons given!");
} else {
SendClientMessage(playerid, X11_WHITE, "Usage: /massgivegun <weaponid> <ammo>)
}
return 1;
}
//Minigun id is 38 I believe