How to see other player stats?
#1

For example: The /check command.

You write for example /check 1 (/check and the ID).

And it comes up with the statistics of the player 1 (ID 1)..

I can only make /stats. To show your own statistics.
But how to make it to check for other player?
Reply
#2

Instead of playerid, replace it with targetid or whatever your variable's name is. So instead of:

pawn Код:
pInfo[playerid][Admin]
Make it:


pawn Код:
pInfo[targetid][Admin]
PS: targetid should be a valid ID, so use sscanf for that or check if it is not equal to INVALID_PLAYER_ID
Reply
#3

Using sscanf and Pawn.CMD you just do something like this.

PHP код:
CMD:check(playeridparams[])
{
    new 
giveplayerid;
    if (
sscanf(params"u"giveplayerid))
    {
        return 
SendClientMessage(playerid0xFF0000AA"Usage: /check <playerid/name>");
    }
    
// stats here
    
return 1;

Reply
#4

I use this.

Код:
forward ShowStats(playerid,targetid);
Код:
public ShowStats(playerid,targetid)
{
	new admin = pInfo[targetid][pAdmin];
	new vipp = pInfo[targetid][pVip];
	new fvip[32];
	if(freevip == 1) {fvip="{FFA200}Yes";}
	else if(freevip == 0) {fvip="{FFA200}No";}
	new kills = pInfo[targetid][pKills];
	new deaths = pInfo[targetid][pDeaths];
	new money[256];
	format(money,sizeof(money),"{00D400}%s$",FormatNumber( pInfo[targetid][pMoney], 0, ',' ));
	new level = pInfo[targetid][pLevel];
	new ws = pInfo[targetid][pWs];
	new muted[32];
	if(pInfo[targetid][pMuted] >= 1) { muted = "{FF0000}Yes"; }
	else if(pInfo[targetid][pMuted] == 0 ) { muted = "{00FF00}No"; }
	new jailed[32];
	if(pInfo[targetid][pJailed] >= 1) { jailed = "{FF0000}Yes"; }
	else if(pInfo[targetid][pJailed] == 0 ) { jailed = "{00FF00}No"; }
	new amute[32];
	if(pInfo[targetid][pAdminMuted] >= 1) { amute = "{FF0000}Yes"; }
	else if(pInfo[targetid][pAdminMuted] == 0 ) { amute = "{00FF00}No"; }
	new aunmute[256];
	format(aunmute,sizeof(aunmute),"{00D400}%s$",FormatNumber( pInfo[targetid][pAdminMutedPrice], 0, ',' ));
	new string[2000];
	format(string,sizeof(string),"{FFFFFF}Статистика на %s\n\nLevel: {FFA200}%d {FFFFFF}| Admin Level: {FF0000}%d {FFFFFF}| VIP: {FFA200}%d{FFFFFF} | Free VIP: %s {FFFFFF}| Kills: %d {FFFFFF}| Deaths: %d{FFFFFF}\nMoney: %s {FFFFFF}| Weapon Skill: %d {FFFFFF}| Muted: %s {FFFFFF}| Jailed: %s{FFFFFF} | Admin Muted: %s {FFFFFF}| Admin Unmute Price: %s",GetName(targetid),level,admin,vipp,fvip,kills,deaths,money,ws,muted,jailed,amute,aunmute);
	ShowPlayerDialog(targetid,STATS,DIALOG_STYLE_MSGBOX,"{FFFFFF}Stats:",string,"OK","");
}
Код:
CMD:check(playerid, params[]) 
{ 
    new giveplayerid; 

    if (sscanf(params, "u", giveplayerid)) return SendClientMessage(playerid, 0xFF0000AA, "Usage: /check <playerid/name>"); 
    ShowStats(playerid,giveplayerid);

    return 1; 
}
Reply
#5

Код:
CMD:stats(playerid, params[])
{

new oplayerid;
if(sscanf(params, "u", oplayerid) 
{
      ShowStats(playerid);
}
else 
{
  if(!IsPlayerConnected(oplayerid)) return SendClientMessage(playerid, -1, "Player Not Connected");
  ShowStats(oplayerid);
}
return 1;
}
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)