SA-MP Forums Archive
Y_ini - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Y_ini (/showthread.php?tid=275460)



Y_ini - 0_o - 09.08.2011

Im Using Y_ini To SAve Score And Cash. How Do I Load It?
Here Is OnPlayerDisconnect
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
new PlayerFile[ 13 + MAX_PLAYER_NAME + 1];
format( PlayerFile , sizeof PlayerFile, "%s.ini", Encode(playerName(playerid)));
new INI:PlayerAcc = INI_Open(PlayerFile);
INI_WriteInt(PlayerAcc,"Money",GetPlayerMoney(playerid));
INI_WriteInt(PlayerAcc,"Score",GetPlayerScore(playerid));
INI_WriteInt(PlayerAcc,"Vip",GetPVarInt(playerid, "Vip"));
INI_Close(PlayerAcc);
return 1;
}



Re: Y_ini - Cypress - 09.08.2011

Man do you have a register system? Because i see that you are saving every random name even if it's not registered. That will cause if someone will use your name he can spend your cash and use your vip level.


Re: Y_ini - 0_o - 09.08.2011

You Cant Spawn If You Are Not Logged In Or Registered. I Got A Login/Register System


Re: Y_ini - Cypress - 09.08.2011

Quote:
Originally Posted by 0_o
Посмотреть сообщение
You Cant Spawn If You Are Not Logged In Or Registered. I Got A Login/Register System
If you got it then why don't you check if player file exist or if he is logged in coz I can just connect with your name and then disconnect and it will save 0 money 0 vip level etc.


Re: Y_ini - 0_o - 09.08.2011

It Won't. It Will Load Your Money And Ask You To Login And When You Disconnect It Will Save The Money. So Money Stays Still. This Isn't Place To Chat. If You Can Help In Loading It Then Only Reply.


Re: Y_ini - 0_o - 09.08.2011

Anyone Who Can Help...?


Re: Y_ini - 0_o - 09.08.2011

Help Here Please?


Re: Y_ini - Cypress - 09.08.2011

pawn Код:
forward LoadUser(playerid, name[], value[]);

public OnPlayerConnect(playerid)
{
    new PlayerFile[ 13 + MAX_PLAYER_NAME + 1];
    format(PlayerFile , sizeof PlayerFile, "%s.ini", Encode(playerName(playerid)));
    INI_ParseFile(PlayerFile, "LoadUser", false, true, playerid, true, false);
    GivePlayerMoney ( playerid, GetPVarInt( playerid, "Money"  )    );
    SetPlayerScore  ( playerid, GetPVarInt( playerid, "Score"   )    );
    return 1;
}

public LoadUser(playerid, name[], value[])
{
    if(!strcmp(name, "Money") ) SetPVarInt(playerid, "Money",   strval( value ) );
    if(!strcmp(name, "Score") ) SetPVarInt(playerid, "Score",   strval( value ) );
    if(!strcmp(name, "Vip") )   SetPVarInt(playerid, "Vip",     strval( value ) );
    return 1;
}



Re: Y_ini - 0_o - 09.08.2011

Thank You Very Much. Appreciated!