SA-MP Forums Archive
Saving accounts on timer - 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: Saving accounts on timer (/showthread.php?tid=396481)



Saving accounts on timer - Nicholas. - 01.12.2012

So my idea is I want the player to play for 4 minutes before his/her account is saved. This is what I did, What am I doing wrong?

pawn Код:
SetTimerEx("SaveUserData", 240000, false, "d", playerid);

stock SaveUserData(playerid)
{
    new Hashpass[129];
    WP_Hash(Hashpass, sizeof(Hashpass), inputtext);

    new INI:File = INI_Open(UserPath(playerid));
    INI_SetTag(File,"User's Data");
    INI_WriteString(File,      "Password",      Hashpass);
    INI_WriteInt(File,         "Admin",         PlayerInfo[playerid][pAdmin] = 0);
    INI_WriteInt(File,         "Money",         PlayerInfo[playerid][pMoney] = 0);
    INI_WriteInt(File,         "Kills",         PlayerInfo[playerid][pKills] = 0);
    INI_WriteInt(File,         "Deaths",        PlayerInfo[playerid][pDeaths] = 0);
    INI_WriteInt(File,         "Interior",      PlayerInfo[playerid][pInterior] = 0);
    INI_WriteInt(File,         "VirtualWorld",  PlayerInfo[playerid][pVirtualWorld] = 0);
    INI_WriteInt(File,         "Skin",          PlayerInfo[playerid][pSkin] = 0);
    INI_WriteFloat(File,       "PositionX",     PlayerInfo[playerid][pPositionX] = 0);
    INI_WriteFloat(File,       "PositionY",     PlayerInfo[playerid][pPositionY] = 0);
    INI_WriteFloat(File,       "PositionZ",     PlayerInfo[playerid][pPositionZ] = 0);
    INI_WriteFloat(File,       "Angle",         PlayerInfo[playerid][pAngle] = 0);
    return 1;
}



Re: Saving accounts on timer - Nordic - 01.12.2012

pretty sure SaveUserData has to be a public function, and you have to forward it.


Re: Saving accounts on timer - ReneG - 01.12.2012

Nordic is right, timers only work on public functions. Also, don't forget to INI_Close.

EDIT:

Why are you setting variables to zero in the INI_Write functions?


Re: Saving accounts on timer - Nicholas. - 01.12.2012

Whoops, Yea that's right.

EDIT:

Is there a problem when I set all the variables to 0 after the account is registered?


Re: Saving accounts on timer - Nicholas. - 01.12.2012

This isn't working out for me. I need some help with this please. What I want is for the player to register but I don't want their account to save until 3 minutes of gameplay.


Re: Saving accounts on timer - Nicholas. - 01.12.2012

Bump.


Re: Saving accounts on timer - Konstantinos - 01.12.2012

You messed it up a little bit.
Explain in details what do you want to make, because I'm confused!

Q: A player joins to your server, he registers and he leaves after 2 minutes, then what?
- Will you delete his account?

Q: A players doesn't register if your reg system is with commands, what will happen?

I need some details for it.


Re: Saving accounts on timer - Buzzbomb - 01.12.2012

Dwane you need a vacation or Learn how to understand the words he put out.. I Know what he talking about and they done answered it.. HE WANTS TO SAVE PLAYERS STATS EVER 4 MINUTES OF GAME PLAY.... IF they Are Connected for 4 MINUTES SO you Need to REMOVE THE Registration Stuff Or Store there password Or Skip The Registration and Start a TIMER.... And when timer goes off POPUP A DIALOG TO ASK THEM IF THEY WANT TO REGISTER.... THen Store there Stats

If They Dont Well Then There User Data Wont be Stored they would start all over And Just Kill the Timer So dont ask them again... And Give them the Option TO Type /Register to call on the Registration Dialogs Or what ever you Like to Have..


Re: Saving accounts on timer - Nicholas. - 01.12.2012

Okay, I will explain.

What I want is, The player registers but he leaves within the three minutes gameplay limit so then his account is deleted. The player needs to play for more than three minutes so his account can be successfully saved.


Re: Saving accounts on timer - CrazyChoco - 01.12.2012

Quote:
Originally Posted by Buzzbomb
Посмотреть сообщение
Dwane you need a vacation or Learn how to understand the words he put out.. I Know what he talking about and they done answered it.. HE WANTS TO SAVE PLAYERS STATS EVER 4 MINUTES OF GAME PLAY.... IF they Are Connected for 4 MINUTES SO you Need to REMOVE THE Registration Stuff Or Store there password Or Skip The Registration and Start a TIMER.... And when timer goes off POPUP A DIALOG TO ASK THEM IF THEY WANT TO REGISTER.... THen Store there Stats

If They Dont Well Then There User Data Wont be Stored they would start all over And Just Kill the Timer So dont ask them again... And Give them the Option TO Type /Register to call on the Registration Dialogs Or what ever you Like to Have..
Calm Down. He was just asking.

Anyway its possible thought variebles