08.03.2011, 01:58
pawn Код:
command(giveallweapon,playerid,params[])
{
if(PInfo[playerid][Level] >= 4 || IsPlayerAdmin(playerid)) {
new Weap, ammo, name[MAX_PLAYER_NAME], string[50];
if(sscanf(params,"ii",Weap, ammo)) return SendClientMessage(playerid,RED,"Usage: /giveallweapon [weapon name] [ammo]");
foreach(Player, i)
{
GivePlayerWeapon(i,Weap,ammo);
}
format(string,sizeof(string),"Administrator %s has given all players weapon: %d with %d ammo",name,Weap,ammo);
SendClientMessageToAll(blue,string);
}
else SendClientMessage(playerid,RED,"You are not a high enough level to use this command");
return 1;
}
pawn Код:
stock GetWeaponIDFromName(WeaponName[])
{
if(strfind("molotov",WeaponName,true)!=-1) return 18;
for(new i = 0; i <= 46; i++)
{
switch(i)
{
case 0,19,20,21,44,45: continue;
default:
{
new name[32]; GetWeaponName(i,name,32);
if(strfind(name,WeaponName,true) != -1) return i;
}
}
}
return -1;
}