23.02.2010, 16:40
Try this:
pawn Код:
dcmd_giveweapon(playerid, params[])
{
if(PlayerInfo[playerid][Level] < 1) return SendClientMessage(playerid, AdministrationError, NotAdminError);
new
id,
weapon,
name[2][24],
string[110];
if(sscanf(params, "ud", id, weapon)) return SendClientMessage(playerid, 0xFF0000AA, "Usage: /giveweapon [playerid/partname] [amount]");
else if(!IsPlayerConnected(playerid)) return SendClientMessage(playerid, 0xFF0000AA, "Player not found");
else if(0 > weapon > 46) return SendClientMessage(playerid, AdministrationError, "Error: Weapon ID's must be 1-46");
else
{
GivePlayerWeapon(id, weapon, 5000);
GetPlayerName(playerid, name[0], 24);
GetPlayerName(id, name[1], 24);
format(string, sizeof(string), "%s was given a weapon by Administrator %s. [Weapon: %d]", name[1], name[0], weapon);
SendClientMessageToAll(AdministrationAnnouncement, string);
LogCommand(string);
}
return 1;
}