SA-MP Forums Archive
Uhmm player that logs on gets my stats? - 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: Uhmm player that logs on gets my stats? (/showthread.php?tid=408608)



Uhmm player that logs on gets my stats? - Blast3r - 18.01.2013

Uhmmm hello.. I've started a server recently and now I'm having some problems, and that is that some players just get my stats, so I was wondering if any of you had that before, if so please tell me what's the problem, passwords are hashed and if you need any part of my script, say it.


Re: Uhmm player that logs on gets my stats? - JaKe Elite - 18.01.2013

What Admin System you're using?


Re: Uhmm player that logs on gets my stats? - AaronKillz - 18.01.2013

Are you using MySQL?
If so, did you sanitize data in onplayerconnect?


Re: Uhmm player that logs on gets my stats? - Pizzy - 18.01.2013

If you use variables like:

pPassword, pUsername, pCash.

You must RESET all the variables on either OnPlayerConnect, or OnPlayerDisconnect (I suggest you do it under OnPlayerConnect)

E.G.

public OnPlayerConnect(playerid)
{
pCash[playerid] = 0;
pAdminLevel[playerid] = 0;
}


Re: Uhmm player that logs on gets my stats? - Blast3r - 19.01.2013

Quote:
Originally Posted by Romel
Посмотреть сообщение
What Admin System you're using?
I'm using my own samp system

About the MySql no

And Pizzy I got that one already


Re: Uhmm player that logs on gets my stats? - Michael@Belgium - 19.01.2013

Quote:
Originally Posted by Pizzy
Посмотреть сообщение
If you use variables like:

pPassword, pUsername, pCash.

You must RESET all the variables on either OnPlayerConnect, or OnPlayerDisconnect (I suggest you do it under OnPlayerConnect)

E.G.

public OnPlayerConnect(playerid)
{
pCash[playerid] = 0;
pAdminLevel[playerid] = 0;
}
Quote:
Originally Posted by Blast3r
Посмотреть сообщение
I'm using my own samp system

About the MySql no

And Pizzy I got that one already
Reset the variables also when the player leaves (OnPlayerDisconnect()) - After the player stats get saved.


Re: Uhmm player that logs on gets my stats? - Blast3r - 19.01.2013

Quote:
Originally Posted by Michael@Belgium
Посмотреть сообщение
Reset the variables also when the player leaves (OnPlayerDisconnect()) - After the player stats get saved.
Код:
public OnPlayerDisconnect(playerid, reason)
{
    new INI:File = INI_Open(UserPath(playerid));
    INI_SetTag(File,"data");
    INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
    INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
    INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKills]);
    INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]);
    INI_WriteInt(File,"Score",PlayerInfo[playerid][pScore]);
    INI_WriteInt(File,"Rank",PlayerInfo[playerid][pRank]);
    INI_WriteInt(File,"VIP",PlayerInfo[playerid][pVip]);
    INI_WriteInt(File,"Warns",PlayerInfo[playerid][pWarn]);
    INI_WriteInt(File,"Banned",PlayerInfo[playerid][pBanned]);
    INI_Close(File);
    KillStreak[playerid] = 0;
    return 1;


}
Already done :/

EDIT: I fixed it, thx a lot for your help