01.06.2012, 17:17
like it,it can create comand exemple /stats Skaizo and /stats 1
how create it?
using sscanf
pawn Code:
CMD:stats(playerid, params[])
{
new string[200], pID;
if(sscanf(params,"u",pID)) return SendClientMessage(playerid,-1,"/stats <playerid>");
format(string, sizeof(string), "Name: %s | ID: %d | Team: %s | Score: %d | Kills: %i | Deaths: %i | Money: %d | Adminlevel: %d", PlayerName(pID), pID, GetTeamName(pID), GetPlayerScore(pID), PlayerInfo[pID][Kills], PlayerInfo[pID][Deaths], GetPlayerMoney(pID), AdminLevel[pID]); // all playerid replaced by pID since pID = player whose stats we gonna get but playerid is player who use command
SendClientMessage(playerid ,COLOR_BROWN, string);
return 1;
}
using sscanf
Code:
Specifier(s) Name Example values i, d Integer 1, 42, -10 c Character a, o, * l Logical true, false b Binary 01001, 0b1100 h, x Hex 1A, 0x23 o Octal 045 12 n Number 42, 0b010, 0xAC, 045 f Float 0.7, -99.5 g IEEE Float 0.7, -99.5, INFINITY, -INFINITY, NAN, NAN_E u User name/id (bots and players) ******, 0 q Bot name/id ShopBot, 27 r Player name/id ******, 42

