SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Thread Tools Display Modes
Old 08/03/2019, 06:51 PM   #1
Big Clucker
Join Date: Feb 2018
Posts: 92
Reputation: 1
Default How to see other player stats?

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?
Lixyde is offline   Reply With Quote
Old 08/03/2019, 07:11 PM   #2
TheToretto's Avatar
Join Date: Jul 2015
Posts: 587
Reputation: 66
Default Re: How to see other player stats?

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

pawn Code:

Make it:

pawn Code:

PS: targetid should be a valid ID, so use sscanf for that or check if it is not equal to INVALID_PLAYER_ID


Rest in peace grandpa, 03 November 2018
TheToretto is offline   Reply With Quote
Old 09/03/2019, 07:26 PM   #3
Little Clucker
Join Date: Mar 2015
Posts: 17
Reputation: 0
Default Re: How to see other player stats?

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

PHP Code:

    if (
SendClientMessage(playerid0xFF0000AA"Usage: /check <playerid/name>");

// stats here

return 1;

Autorojo is offline   Reply With Quote
Old 09/03/2019, 11:29 PM   #4
Little Clucker
Join Date: Feb 2018
Posts: 35
Reputation: 0
Default Re: How to see other player stats?

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);
CMD:check(playerid, params[]) 
    new giveplayerid; 

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

    return 1; 
scripter112 is offline   Reply With Quote
Old 10/03/2019, 06:04 AM   #5
Join Date: Feb 2018
Location: Funky World
Posts: 349
Reputation: 28
Default Re: How to see other player stats?

CMD:stats(playerid, params[])

new oplayerid;
if(sscanf(params, "u", oplayerid) 
  if(!IsPlayerConnected(oplayerid)) return SendClientMessage(playerid, -1, "Player Not Connected");
return 1;
UFF is offline   Reply With Quote

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
[FilterScript] Player Labels (/pl - good for spectating and 3D player stats!) Gammix Filterscripts 31 13/09/2018 12:53 AM
[Tool/Web/Other] [PHP/MySQL] Powerup Stats - Player stats signature generator kelvin22 Tools and Files 43 21/06/2013 12:15 AM
player stats sscarface Scripting Help 7 14/02/2013 08:36 PM
Player Stats SnG.Scot_MisCuDI Scripting Help 6 07/03/2012 06:21 AM
Help with player stats Face9000 Scripting Help 4 07/02/2012 01:05 PM

All times are GMT. The time now is 01:38 AM.

Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.