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
#2

Great man

You made the links .infp lol and Can you please post a tutorial up on how to use this :S

Like Do we need to create a .txt file in are scriptfiles

A nice description would help us out plenty
Reply
#3

First Post Modified.
Reply
#4

Do you have Xfire/MSN

This is confusing Considering i am low on PHP Skills
Reply
#5

Pghpunkid@hotmail.com
Reply
#6

^^ Pghpunkid is a god to me
Reply
#7

help can't getting it in work like what i have to do with the pawno script & this line

Код:
$data1 = 'http://38.100.208.250:1337/pghpunkid/' . $nick . '.txt';
Reply
#8

Quote:
Originally Posted by Westie
Aah, that's really good. Although wouldn't it be better to make it cleaner, rather like a small include?
Its nice as php though, Very easy to understand
Reply
#9

Quote:
Originally Posted by Nate660
Quote:
Originally Posted by Westie
Aah, that's really good. Although wouldn't it be better to make it cleaner, rather like a small include?
Its nice as php though, Very easy to understand
Yea, but can u help me to get it work plz

thx!
Reply
#10

Okay.. the Script provided generates a txt file by the players name.

Ex. Pghpunkid.txt


Theres 2 ways to do this:
-The PHP file can be on a serperate web server, but the scriptfiles folder of the SAMP Server must have HTTP Access.
OR
-If you have a webserver installed and working with your SAMP server in the dir, You can put the PHP in script files.

If you went with option one, then you change data1 to
$nick . '.txt';

If you went with option two you must use the URL to get to the txt file in the scriptfiles folder. Which is what is in the URL to start with.

When You view the PHP page, You must add ?nick=Pghpunkid or ?nick=z00H or w.e to find that players text file. If a URL shows up, it couldnt find the .TXT.

Better.. closer.. Warmer?
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)