/stats
#1

Hello all.

Where can i get a command (/stats) that will show the players hours on server, deaths, kill, score, Admin level, please?

-I searched on ****** but cant find it :/
Reply
#2

try this
pawn Код:
if(strcmp(cmd, "/stats", true) == 0)     {
        new player1, tmp[256];
        tmp = strtok(cmdtext, idx);
        if(!strlen(tmp))    {
            ShowScore(playerid);
            return 1;   }
        player1 = strval(tmp);

        if(IsPlayerConnected(player1))      {
            GetPlayerName(player1, playername, sizeof(playername));
            format(string, sizeof(string), "<> %s's Stats:  Kills: %d | Deaths: %d | Ratio: %0.2f | Money: $%d ",playername, PlayerInfo[player1][Kills], PlayerInfo[player1][Deaths],Float:PlayerInfo[player1][Deaths]/Float:PlayerInfo[player1][Deaths],GetPlayerMoney(player1));
            SendClientMessage(playerid, green, string);
            return 1;
        } else {
        SendClientMessage(playerid, COLOR_WHITE, "Player Not Connected!");
        return 1;   }
     }
Reply
#3

pawn Код:
CMD:stats(playerid,params[])
{
new string[128];
new Float:health;
GetPlayerHealth(playerid,health);
new pName[MAX_PLAYER_NAME];
GetPlayerName(playerid, pName, sizeof(pName));
format(string,128,"|STATS| Name:[%s] Money:[%d] Score:[%d] Health:[%d]",pName,GetPlayerMoney(playerid),GetPlayerScore(playerid),health);
SendClientMessage(playerid,0x00A300AA,string);
return 1;
}
Reply
#4

did you define anything? or
Reply
#5

Thanks, how can i make it save hours? Using y_ini

-i need to make it save to a file..

Im using Zcmd btw
Reply
#6

Quote:
Originally Posted by ******
Посмотреть сообщение
Ironboy: Your code makes huge numbers of assumptions about what there is in the script, Montis123's makes none and is thus a much better example! What is "ShowScore" in your code and how is it defined? Where and how is PlayerInfo defined? (I ask because it's a TERRIBLE name for a global variable!) Why is your green colour a variable (or why does it look like a variable)? "Float:PlayerInfo[player1][Deaths]/Float:PlayerInfo[player1][Deaths]" <- always 1! Finally why are you not using sscanf to get another player given that it allows you to type an ID or a name instead of just an ID?

Markx: To get online time use getdate in OnPlayerConnect and OnPlayerDisconnect. This will return a unix timestamp and you add the difference between join and leave to a saved running total.
Oh wow, i will try to make something
-Thanks for help

WIKI:
Код:
new Year, Month, Day;
getdate(Year, Month, Day);
printf("%02d/%02d/%d", Day, Month, Year);
 
new Days = getdate();
printf("Days since the start of the year: %d", Days)
How to make it days, hours, minutes?
Reply
#7

*bump* Anyone?
Reply
#8

i took that cmd from my gm and i thought that will help him
Reply
#9

Quote:
Originally Posted by Ironboy
Посмотреть сообщение
i took that cmd from my gm and i thought that will help him
It is good, but i need it to save when a player disconnects, and load it when he connects
Reply
#10

Quote:
Originally Posted by Markx
Посмотреть сообщение
It is good, but i need it to save when a player disconnects, and load it when he connects
The easiest way is to look in an Admin script that saves online time.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)