09.05.2014, 15:22
pawn Код:
CMD:giveweapon(playerid,params[])
{
if(pInfo[playerid][Adminlevel] < 4) return SCM(playerid, COLOR_RED,""ERROR_MESSAGE"");
new TargetID,targetname[50],weaponname[50],weaponammo;
if(sscanf(params,"us[50]d",TargetID,weaponname,weaponammo)) return SCM(playerid, COLOR_RED, "Usage: /giveweapon [playerid] [weapon id/weapon name] [ammo]");
new string[128],weapon[50],wea;
GetPlayerName(TargetID,targetname,sizeof(TargetID));
if(!isNumeric(weaponname))
{
wea = GetWeaponIDFromName(weaponname);
GetWeaponName(wea,weapon,50);
}
else
{
wea = GetWeaponName(weaponname,weapon,50);
}
if(IsPlayerConnected(TargetID) && TargetID != INVALID_PLAYER_ID)
{
if(!IsValidWeapon(wea)) return SCM(playerid,COLOR_RED,"Invalid Weapon ID or Name");
format(string, sizeof(string), "**Weapon: %s (%d) (Admin Weapon) %s (%d) with %d rounds of ammo", targetname,TargetID, weapon, wea, weaponammo); SCMA(COLOR_HOTPINK,string);
return GivePlayerWeapon(TargetID, wea, weaponammo);
} else return SCM(playerid,COLOR_RED,"** Player is not connected");
}
pawn Код:
(9425) : error 035: argument type mismatch (argument 1)
pawn Код:
wea = GetWeaponName(weaponname,weapon,50);