SA-MP Forums Archive
/stats command - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: /stats command (/showthread.php?tid=296633)



/stats command - Champ - 12.11.2011

i am using y_ini register/login system but there is not stats in y_ini script. can any one give me stats script ?


Re: /stats command - Stigg - 12.11.2011

Can we see your player enum
Kills, deaths ect...


Re: /stats command - Champ - 12.11.2011

yes . there is any y_ini stats filterscirpt in samp forum


Re: /stats command - Stigg - 12.11.2011

Well if you have something like:
pawn Код:
enum pInfo
{
    pCash,
    pKills,
    pDeaths,
    pRank,
    pGameTime,
    pVisits
}
new PlayerInfo[MAX_PLAYERS][pInfo];
You can make something like:
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/stats", cmdtext, true, 10) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            new statstring[128];
            format(statstring, sizeof(statstring), "| Your Stats | Kills: %d | Deaths: %d | Money: $%d | Rank: %d | GamePoints: %d | Visits: %d |",PlayerInfo[playerid][pKills],PlayerInfo[playerid][pDeaths],GetPlayerMoney(playerid),PlayerInfo[playerid][pRank],PlayerInfo[playerid][pGameTime],PlayerInfo[playerid][pVisits]);
            SendClientMessage(playerid,-1, statstring);
        }
        return 1;
    }
    return 0;
}



Re: /stats command - Champ - 12.11.2011

You Gave Me
YourStats Kills Deaths Money

how to change it to

Your Stats
Kills
Deaths
Money


Re: /stats command - Stigg - 12.11.2011

Quote:
Originally Posted by Champ
Посмотреть сообщение
You Gave Me
YourStats Kills Deaths Money

how to change it to

Your Stats
Kills
Deaths
Money
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/stats", cmdtext, true, 10) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            new statstring[128];
            format(statstring, sizeof(statstring), "| Your Stats | Kills: %d | Deaths: %d | Money: $%d |",PlayerInfo[playerid][pKills],PlayerInfo[playerid][pDeaths],GetPlayerMoney(playerid));
            SendClientMessage(playerid,-1, statstring);
        }
        return 1;
    }
    return 0;
}



Re: /stats command - Champ - 12.11.2011

the stats is in one line

i want to seprate it


Re: /stats command - Stigg - 12.11.2011

Quote:
Originally Posted by Champ
Посмотреть сообщение
the stats is in one line

i want to seprate is it
I made you the command as an example. Do some testing with it. Otherwise you wont learn anything except to rely on others to spoon feed you snippets of code. No offence intended.


Re: /stats command - Kostas' - 12.11.2011

pawn Код:
//At The Top
#define COLOR_GREEN 0x00FF00FF

public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/stats", cmdtext, true, 10) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            new statstring[128];
            SendClientMessage(playerid, COLOR_GREEN, "*** Your Stats ***");
            format(statstring, sizeof(statstring), "Kills: %d",PlayerInfo[playerid][pKills]);
            SendClientMessage(playerid, COLOR_GREEN, statstring);
            format(statstring, sizeof(statstring), "Deaths: %d",PlayerInfo[playerid][pDeaths]);
            SendClientMessage(playerid, COLOR_GREEN, statstring);
            format(statstring, sizeof(statstring), "Money: $%d",GetPlayerMoney(playerid));
            SendClientMessage(playerid, COLOR_GREEN, statstring);
        }
        return 1;
    }
    return 0;
}



Re: /stats command - Champ - 12.11.2011

Quote:
Originally Posted by Kostas'
Посмотреть сообщение
pawn Код:
//At The Top
#define COLOR_GREEN 0x00FF00FF

public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/stats", cmdtext, true, 10) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            new statstring[128];
            SendClientMessage(playerid, COLOR_GREEN, "*** Your Stats ***");
            format(statstring, sizeof(statstring), "Kills: %d",PlayerInfo[playerid][pKills]);
            SendClientMessage(playerid, COLOR_GREEN, statstring);
            format(statstring, sizeof(statstring), "Deaths: %d",PlayerInfo[playerid][pDeaths]);
            SendClientMessage(playerid, COLOR_GREEN, statstring);
            format(statstring, sizeof(statstring), "Money: $%d",GetPlayerMoney(playerid));
            SendClientMessage(playerid, COLOR_GREEN, statstring);
        }
        return 1;
    }
    return 0;
}
that i want , thank You !