SA-MP Forums Archive
Problems with Accaunts[HELP!!] - 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: Problems with Accaunts[HELP!!] (/showthread.php?tid=522570)



Problems with Accounts[HELP!!] - 7emfic - 28.06.2014

Hello. I have a problem. Flies accounts. They can fly not only after the restart, and after disconnected from the server, and it happens that data written to one account of another account. What could be the problem, please help, very long trying to solve this problem


Re : Problems with Accaunts[HELP!!] - Noliax8 - 28.06.2014

Send pawn code


Re: Problems with Accaunts[HELP!!] - 7emfic - 28.06.2014

What namely?


Re: Problems with Accaunts[HELP!!] - Noliax8 - 28.06.2014

The pawn code where the player disconnect, and save the data in the other player maybe?


Re: Problems with Accaunts[HELP!!] - 7emfic - 28.06.2014

Код:
public OnGameModeExit()
{
for(new i; i < sizeof(Intro); i++)
        {
TextDrawDestroy(Intro[i]);

        }
for(new i=0; i<MAX_PLAYERS; i++)
    {
    SavePlayer(i);
}
return 1;
}
Код:
public OnPlayerDisconnect(playerid, reason)
{
SavePlayer(playerid);
new string[64],
name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,MAX_PLAYER_NAME);
switch(reason)
    {
case 0: format(string,sizeof string,"{AFAFAF}*** %s ïîêèíóë Äðèôò Ìèð (Âûëåò)",name);
case 1: format(string,sizeof string,"{AFAFAF}*** %s ïîêèíóë Äðèôò Ìèð (Âûõîä)",name);
case 2: format(string,sizeof string,"{AFAFAF}*** %s ïîêèíóë Äðèôò Ìèð (Êèê/áàí)",name);
    }
SendClientMessageToAll(0xFFFFFFAA,string);
PlayerInfo[playerid][Work]=0;
ta4katest[playerid] = 0;
Musix[playerid]=0;
DestroyVehicle(ta4ka[playerid]);
logged[playerid]=0;
SetPVarInt(playerid,"Login",0);
if(GetPVarInt(playerid, "Kick") != 0) KillTimer(GetPVarInt(playerid, "Kick"));
if(GetPVarInt(playerid, "Ban") != 0) KillTimer(GetPVarInt(playerid, "Ban"));
return 1;
}
Код:
forward SavePlayer(playerid);
public SavePlayer(playerid)
{
    new string[64];
    new playername[MAX_PLAYER_NAME];
    GetPlayerName(playerid, playername, sizeof(playername));
    format(string, sizeof(string), "users/%s.ini", playername);
    new iniFile = ini_openFile(string);
   	ini_setInteger(iniFile,"Money",PlayerInfo[playerid][pMoney]);
	ini_setInteger(iniFile,"Score",GetPlayerScore(playerid));
	ini_setInteger(iniFile,"Skin",PlayerInfo[playerid][Skin]);
	ini_setInteger(iniFile,"House",PlayerInfo[playerid][House]);
	ini_setInteger(iniFile,"Team",PlayerInfo[playerid][Team]);
	ini_setInteger(iniFile,"pAdmin",PlayerInfo[playerid][pAdmin]);
	ini_setInteger(iniFile,"Work",PlayerInfo[playerid][Work]);
	ini_setInteger(iniFile,"Muted",PlayerInfo[playerid][Muted]);
	ini_setInteger(iniFile,"Referee",PlayerInfo[playerid][Referee]);
	ini_setInteger(iniFile,"Duel",PlayerInfo[playerid][Duel]);
	ini_setInteger(iniFile,"Banned",PlayerInfo[playerid][Banned]);
	ini_setInteger(iniFile,"Leader",PlayerInfo[playerid][Leader]);
	ini_setInteger(iniFile,"DLose",PlayerInfo[playerid][DLose]);
	ini_setInteger(iniFile,"Spawn",PlayerInfo[playerid][Spawn]);
	ini_setInteger(iniFile,"DWin",PlayerInfo[playerid][DWin]);
	ini_setInteger(iniFile,"TWin",PlayerInfo[playerid][TWin]);
	ini_setInteger(iniFile,"iSponsor",PlayerInfo[playerid][iSponsor]);
	ini_setInteger(iniFile,"Sp1",PlayerInfo[playerid][Sp1]);
	ini_setInteger(iniFile,"Sp2",PlayerInfo[playerid][Sp2]);
	ini_setInteger(iniFile,"Sp3",PlayerInfo[playerid][Sp3]);
	ini_setInteger(iniFile,"Sp4",PlayerInfo[playerid][Sp4]);
	ini_setInteger(iniFile,"Sp5",PlayerInfo[playerid][Sp5]);
	ini_setInteger(iniFile,"Sp6",PlayerInfo[playerid][Sp6]);
    ini_closeFile(iniFile);
}



Re: Problems with Accaunts[HELP!!] - Noliax8 - 28.06.2014

Add at the top of SavePlayer(playerid):

pawn Код:
if(!IsPlayerConnected(playerid)) return 1;
And, I thinks

pawn Код:
for(new i=0; i<MAX_PLAYERS; i++) SavePlayer(i);
this is not useless because players has kick before. (I don't sure!)

Nlx


Re: Problems with Accaunts[HELP!!] - 7emfic - 28.06.2014

Quote:
Originally Posted by Noliax8
Посмотреть сообщение
pawn Код:
for(new i=0; i<MAX_PLAYERS; i++) SavePlayer(i);
where put it?


Код:
 if(!IsPlayerConnected(playerid)) return 1;
Код:
warning 209: function "SavePlayer" should return a value