Need help - sscanf
#1

Hello, how can i make so a player can use /stats to view their own stats, or someone else's stats by doing /stats [targetid]

EX: if he does /stats, this will show up:

PHP код:
SendClientMessageEx(playeridCOLOR_GREY"User Statistics for {665353}%s(%d) {AFAFAF}- Database ID: {665353}%d"GetName(playerid), playeridPlayerInfo[playerid][ID]); 
If he does /stats [targetid], something like this:

PHP код:
Target's stats here 
Reply
#2

set the targetid default value to -1. whenever its equal to -1 you check for your own stats, else you check for others
sscanf(params, “R(-1)”); maybe
Reply
#3

Quote:
Originally Posted by m4karow
Посмотреть сообщение
set the targetid default value to -1. whenever its equal to -1 you check for your own stats, else you check for others
And how do i do that?
Reply
#4

Quote:
Originally Posted by Score
Посмотреть сообщение
Hello, how can i make so a player can use /stats to view their own stats, or someone else's stats by doing /stats [targetid]

EX: if he does /stats, this will show up:

PHP код:
SendClientMessageEx(playeridCOLOR_GREY"User Statistics for {665353}%s(%d) {AFAFAF}- Database ID: {665353}%d"GetName(playerid), playeridPlayerInfo[playerid][ID]); 
If he does /stats [targetid], something like this:

PHP код:
Target's stats here 
maybe this code can help you
PHP код:
new idstring[64];
if(
sscanf(params"u"id))
{
    
// FOR TARGET ID
    
return 1;
}
else
{
    
//FOR YOURSELF

Reply
#5

Quote:
Originally Posted by AlfaSufaIndo
Посмотреть сообщение
maybe this code can help you
PHP код:
new idstring[64];
if(
sscanf(params"u"id))
{
    
// FOR TARGET ID
    
return 1;
}
else
{
    
//FOR YOURSELF

No it won't, you didn't even understand me.
Reply
#6

or Maybe like this? CMIIW.
If you only type /stats. it will show your stats
If you type /stats [giveplayerid] you will see giveplayerid stats

PHP код:
CMD:stats(playeridparams[])
{
    if(
PlayerInfo[playerid][pAdmin] > 11)
    {
        new 
giveplayeridstring[64];
        if(
sscanf(params"u"giveplayerid))
        {
            
SendClientMessageEx(playeridCOLOR_GREY"User Statistics for {665353}%s(%d) {AFAFAF}- Database ID: {665353}%d"GetName(playerid), playeridPlayerInfo[playerid][ID]);
            return 
1;
        }
        else
        {
            
SendClientMessageEx(playeridCOLOR_GREY"User Statistics for {665353}%s(%d) {AFAFAF}- Database ID: {665353}%d"GetName(giveplayerid), PlayerInfo[giveplayerid][ID], PlayerInfo[giveplayerid][ID]);
        }
    }
    else
    {
        
SendClientMessageEx(playeridCOLOR_GRAD1"{A9A9A9}ERROR: You don't have permission to use command.");
        return 
1;
    }
    return 
1;

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)