17.04.2013, 21:35
The names is wrong
if the players type /weaps show the names
if the player type /weaps [id] it still show names their name.
if the players type /weaps show the names
if the player type /weaps [id] it still show names their name.
Код:
CMD:weaps(playerid, params[]) { if (APlayerData[playerid][PlayerLevel] >= 4) { if(!strlen(params)) return SendClientMessage(playerid, 0xFF0000FF, "Usage: /weaps [PlayerID]") && SendClientMessage(playerid, 0xFF0000FF, "Function: See weapons of specified player"); new player1; new Count, x; new string[128], string2[64]; new WeapName[24], slot, weap, ammo; new name[MAX_PLAYER_NAME+1]; GetPlayerName(playerid, name, sizeof(name)); player1 = strval(params); if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID) { format(string2,sizeof(string2),"%s Weapons:",name); SendClientMessage(playerid,0xFF0000FF,string2); for(slot = 0; slot < 14; slot++) { GetPlayerWeaponData(player1, slot, weap, ammo); if( ammo != 0 && weap != 0) Count++; } if(Count < 1) return SendClientMessage(playerid,0xFF0000FF,"No Weapons found!"); if(Count >= 1) { for (slot = 0; slot < 14; slot++) { GetPlayerWeaponData(player1, slot, weap, ammo); if( ammo != 0 && weap != 0) { GetWeaponName(weap, WeapName, sizeof(WeapName)); if(ammo == 65535 || ammo == 1) format(string,sizeof(string),"%s%s",string, WeapName); else format(string,sizeof(string),"%s [Weapon: %s] [Ammo: %d]",string, WeapName, ammo); x++; if(x >= 5) { SendClientMessage(playerid, 0xFF0000FF, string); x = 0; format(string, sizeof(string), ""); } else format(string, sizeof(string), "%s", string); } } if(x <= 4 && x > 0) { SendClientMessage(playerid, 0xFF0000FF, string); } } } } return 1; }