22.12.2013, 15:49
Your code looks long and looks dirty, it isn't the best way to do that, Konstatinos would work properly if the Hybris understand what he means, anyways, here's the code.
pawn Код:
CMD:weaps(playerid, params[])
{
new
PlayerWeapons[13], PlayerAmmo[13],
WeaponName[30], string[100],
targetid, i = 1
;
if( sscanf ( params, "u", targetid ) )
return SendClientMessage(playerid, -1, "Syntax: /weaps [Player Name/ID]");
while(i <= 12)
{
GetPlayerWeaponData( id, i, PlayerWeapons[ i ], PlayerAmmo[ i ] );
if( PlayerWeapons[ i ] != 0 )
{
GetWeaponName( PlayerWeapons[i], WeaponName, sizeof( WeaponName ) );
format( string, sizeof( string ) , "Weapon ID: [%d] Weapon Name: [%s] - Ammo: [%d]", PlayerWeapons[ i ], WeaponName, PlayerAmmo[ i ] );
SendClientMessage( playerid, -1, string );
}
i++;
}
return true;
}