06.06.2015, 21:09
Try this: (edit it based on your admin system):
EDIT: Forgot the stock:
PHP код:
CMD:getweps(playerid,params[])
{
if(PlayerInfo[playerid][Admin] >= 1)
{
new Target;
new TW;
if(!sscanf(params, "u", Target))
{
if(Target == INVALID_PLAYER_ID) return SCM(playerid,red,"Wrong player ID.");
new msg1[250], string2[64];
new ammo;
new name[MAX_PLAYER_NAME];
GetPlayerName(Target,name,sizeof(name));
format(string2,sizeof(string2),"_______ %s (%d)'s Weapons _______",name,Target);
SCM(playerid,COLOR_YELLOW,string2);
for(new a=0; a <= 9; a++)
{
new weapon;
GetPlayerWeaponData(Target,a,weapon,ammo);
if(ammo != 0 && weapon != 0)
{
new WeaponName[50], Ammo;
if(ammo == -1) Ammo = 1;
else Ammo = ammo;
if(weapon == 18) WeaponName = "Molotov";
else GetWeaponName(weapon, WeaponName, 64);
format(msg1,128,"%s (ID:%d) - Ammo: %d", WeaponName, weapon, Ammo);
SCM(playerid,LIGHTBLUE,msg1);
PlayerInfo[Target][AdminActions]++;
TW++;
}
}
if(TW == 0) return SCM(playerid,red,"This player is disarmed.");
else {
format(msg1,128,"Total Weapons: %d", TW);
SCM(playerid,COLOR_YELLOW,msg1);
}
}
else SCM(playerid,-1,"{F70505}Usage: {FFFFFF}/getweps <playerid>");
}
return 1;
}
PHP код:
stock GetWeaponNameByID(wid)
{
new gunname[32];
switch (wid)
{
case 1 .. 17,
22 .. 43,
46 : GetWeaponName(wid,gunname,sizeof(gunname));
case 0: format(gunname,32,"%s","Fist");
case 18: format(gunname,32,"%s","Molotov Cocktail");
case 44: format(gunname,32,"%s","Night Vis Goggles");
case 45: format(gunname,32,"%s","Thermal Goggles");
default: format(gunname,32,"%s","Invalid Weapon Id");
}
return gunname;
}