29.08.2012, 15:10
(
Последний раз редактировалось jameskmonger; 29.08.2012 в 20:25.
)
pawn Код:
CommandDescription<spawnweapon> = @"Spawn a weapon for the specified player.";
YCMD(GROUP_ADMIN, GROUP_MANAGEMENT, GROUP_RCON):spawnweapon(playerid, params[], help) {
if(help) {
SendClientMessage(playerid, COLOR_COMMAND_HELP, @"Spawn a weapon for a specified player");
} else {
new target, weapon, ammo;
if(sscanf(params, "rk<weapon>i(-1)", target, weapon, ammo)) {
SendClientMessage(playerid, COLOR_COMMAND_USAGE, @"* Usage: /spawnweapon [player] [weapon] [OPTIONAL: ammo-amount]");
} else {
if(playerid == INVALID_PLAYER_ID) {
SendClientMessage(playerid, COLOR_COMMAND_ERROR, @"Invalid player ID");
return 1;
}
if(weapon != -1) {
if(ammo == -1) {
GivePlayerWeapon(target, weapon, 99999);
SendClientMessage(playerid, 0xFF87E9FF, @"You have given %p %w with unlimited ammo.", target, weapon);
SendClientMessage(target, 0xFF87E9FF, @"%p has given you %w with unlimited ammo.", playerid, weapon);
} else {
GivePlayerWeapon(target, weapon, ammo);
SendClientMessage(playerid, 0xFF87E9FF, @"You have given %p %w with %d round of ammo.", target, weapon, ammo);
SendClientMessage(target, 0xFF87E9FF, @"%p has given you %w with %d rounds of ammo.", playerid, weapon, ammo);
}
} else {
SendClientMessage(playerid, COLOR_COMMAND_ERROR, @"You entered an invalid weapon.");
}
}
}
return 1;
}