25.08.2013, 20:14
(
Последний раз редактировалось adrianxd; 25.08.2013 в 20:45.
)
GUНATE DE ESTO
pawn Код:
CMD:giveweapon(playerid,params[])
{
new Index;
new tmp[256]; tmp = strtok(params,Index);
new tmp2[256]; tmp2 = strtok(params,Index);
new tmp3[256]; tmp3 = strtok(params,Index);
if(!strlen(tmp) || !strlen(tmp2)) return
SendClientMessage(playerid, COLOR, "Usage: /giveweapon [PlayerID] [Weapon ID/Name] [Ammo]") &&
SendClientMessage(playerid, COLOR, "Function: Will give a weapon to a specified player");
new player1 = strval(tmp);
new weap, ammo, WeapName[32];
new string[128];
if(!strlen(tmp3) || !IsNumeric(tmp3) || strval(tmp3) <= 0 || strval(tmp3) > 99999) ammo = 500;
else ammo = strval(tmp3);
if(!IsNumeric(tmp2)) weap = GetWeaponIDFromName(tmp2);
else weap = strval(tmp2);
if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID)
{
if(!IsValidWeapon(weap))
return SendClientMessage(playerid,red,"ERROR: Invalid Weapon ID");
GetWeaponName(weap,WeapName,32);
format(string, sizeof(string), "== You have given \"%s\" a %s (%d) with %d rounds of Ammo ", PlayerName2(player1), WeapName, weap, ammo);
SendClientMessage(playerid,COLOR,string);
if(player1 != playerid)
{
format(string,sizeof(string),"== \"%s\" has given you a %s (%d) with %d rounds of Ammo ", PlayerName2(playerid), WeapName, weap, ammo);
SendClientMessage(player1,COLOR,string);
}
return GivePlayerWeapon(player1, weap, ammo);
}
return 1;
}