Signature Online Stats! By Pghpunkid (Me) - READ FIRST POST. (Update Mar 3 2009)
#1

Yep. I did it! Yippee!

and



DOWNLOAD #1 - First one
DOWNLOAD #2 - Second one

AS OF MARCH 3RD 2009, Download 2 link is dead. If you have a copy of this PLEASE MESSAGE ME.

Hope you like it ^^

What it does:

Well you see servers like XS^2 that has player statistics from the server for a specific player. This is the same just a little more barebones. In the PHP Script you can change the File DIR an type. But basically you export the data all in finesse. Like for example this..

This script...
pawn Код:
stock SavePlayerWeb(playerid)
{
    new string3[32];
    new string[MAX_PLAYER_NAME];
    GetPlayerName(playerid,string,sizeof(string));
    format(string3, sizeof(string3), "%s.txt",string);
    new File: hFile = fopen(string3, io_write);
    if (hFile)
    {
        new var[190];

        //Bank Amount
        format(var, 190, "$%d\r\n",PlayerInfo[playerid][Bank]);fwrite(hFile, var);
   

        //Admin Level
        if( PlayerInfo[playerid][Admin] == 0)
        {
            format(var, 190, "Player\r\n");fwrite(hFile, var);
        }
        else if (PlayerInfo[playerid][Admin] == 1)
        {
          format(var, 190, "Temp Mod\r\n");fwrite(hFile, var);
        }
        else if (PlayerInfo[playerid][Admin] == 2)
        {
          format(var, 190, "Mod\r\n");fwrite(hFile, var);
        }
        else if (PlayerInfo[playerid][Admin] == 3)
        {
          format(var, 190, "Admin\r\n");fwrite(hFile, var);
        }
        else if (PlayerInfo[playerid][Admin] == 4)
        {
          format(var, 190, "Server Admin\r\n");fwrite(hFile, var);
        }
       
        //Playing Time
        new sec = PlayerInfo[playerid][Time]%60;
        new mins = (PlayerInfo[playerid][Time]/60)%60;
        new hour = (PlayerInfo[playerid][Time]/3600)%24;
        new days = PlayerInfo[playerid][Time]/86400;
        format(var, 190, "%dd %dh %dm %ds\r\n",days,hour,mins,sec);fwrite(hFile, var);
       
        //Kills
        format(var, 190, "%d\r\n",PlayerInfo[playerid][Kills]);fwrite(hFile, var);
       
        //Deaths
        format(var, 190, "%d\r\n",PlayerInfo[playerid][Deaths]);fwrite(hFile, var);
       
        //In Jail
        if(PlayerInfo[playerid][Jailed] == 1)
        {
          format(var, 190, "Yes\r\n");fwrite(hFile, var);
        }
        else
        {
          format(var, 190, "No\r\n");fwrite(hFile, var);
        }
       
        //Jail Time
        if(PlayerInfo[playerid][Jailed] == 1)
        {
          format(var, 190, "%d\r\n",PlayerInfo[playerid][Jailtime]);fwrite(hFile, var);
        }
        else
        {
          format(var, 190, "N/A\r\n");fwrite(hFile, var);
        }
       

        //Muted
        if(PlayerInfo[playerid][Mute] == 1)
        {
          format(var, 190, "Yes\r\n");fwrite(hFile, var);
        }
        else
        {
          format(var, 190, "No\r\n");fwrite(hFile, var);
        }
        //Licenses
        if(PlayerInfo[playerid][DLicense] == 1)
        {
          if(PlayerInfo[playerid][CDL] == 1)
          {
            format(var, 190, "Yes/Yes\r\n");fwrite(hFile, var);
          }
          else
          {
            format(var, 190, "Yes/No\r\n");fwrite(hFile, var);
          }
        }
        else
        {
          if(PlayerInfo[playerid][CDL] == 1)
          {
            format(var, 190, "No/Yes\r\n");fwrite(hFile, var);
          }
          else
          {
            format(var, 190, "No/No\r\n");fwrite(hFile, var);
          }
        }
        //Drugs
        format(var, 190, "%d g\r\n",PlayerInfo[playerid][Drugs]);fwrite(hFile, var);
        //Morale
        format(var, 190, "%d/100\r\n",PlayerInfo[playerid][Morale]);fwrite(hFile, var);
        //Teamkills
        format(var, 190, "%d\r\n",PlayerInfo[playerid][Teamkill]);fwrite(hFile, var);
        //Online/offline
        if(PlayerInfo[playerid][Log] == 1)
        {
            format(var, 190, "Online\r\n");fwrite(hFile, var);
        }
    if(PlayerInfo[playerid][Log] == 0)
    {
            format(var, 190, "Offline\r\n");fwrite(hFile, var);
        }
        fclose(hFile);
    }
}
..Generates this..
Код:
$158998
Server Admin
3d 11h 45m 23s
6
4
No
N/A
No
Yes/No
0 g
94/100
0
Offline
You just export it like that and the PHP script will retrieve it from whatever file specified.
For example of how go to http://38.100.208.250:1337/pghpunkid/Pghpunkid.txt
The Url for the PHP must be like http://www.mysitename.com/imagestats.php?nick=Pghpunkid
its very simple and only uses text files generated by the Gamemode and the included PHP Script.
A image is there for a template, and personally i like #2 better. but now its one step less for you!

Credits:
Nate660 for inspiring me to get off my ass and make this.
Tommis @ X-Serverz for Helping me with a different PHP script, which was referred to for this.
Anyone who helped me program.

(i did this in under 2 hours w/o any PHP knowledge.)

Alternative to My File Based - MySQL version by Marcel:

Quote:

Here it is:
http://php.pastebin.com/f5625e881
Just save it as a .php document and upload it. Then use http://www.yourwebsite.com/yourfilen...urnicknamehere to show the picture.
If you want to have it in your signature use this:
[im g]http://www.yourwebsite.com/yourfilename.php?nick=yournicknamehere[/im g]
Without the spaces between the m and the g ofcourse.
Have fun with it!

Marcel

Reply


Messages In This Thread
Signature Online Stats! By Pghpunkid (Me) - READ FIRST POST. (Update Mar 3 2009) - by Pghpunkid - 05.08.2008, 03:57
Re: Signature Online Stats! By Pghpunkid (Me) - by nate660 - 05.08.2008, 03:58
Re: Signature Online Stats! By Pghpunkid (Me) - by Pghpunkid - 05.08.2008, 04:15
Re: Signature Online Stats! By Pghpunkid (Me) - by nate660 - 05.08.2008, 04:19
Re: Signature Online Stats! By Pghpunkid (Me) - by Pghpunkid - 05.08.2008, 04:24
Re: Signature Online Stats! By Pghpunkid (Me) - by nate660 - 05.08.2008, 06:24
Re: Signature Online Stats! By Pghpunkid (Me) - by rafay - 05.08.2008, 13:28
Re: Signature Online Stats! By Pghpunkid (Me) - by nate660 - 05.08.2008, 13:41
Re: Signature Online Stats! By Pghpunkid (Me) - by rafay - 05.08.2008, 14:01
Re: Signature Online Stats! By Pghpunkid (Me) - by Pghpunkid - 05.08.2008, 17:43

Forum Jump:


Users browsing this thread: 1 Guest(s)