SA-MP Forums Archive
how to save and load 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: how to save and load timer?! (/showthread.php?tid=641461)



how to save and load timer?! - BrnX - 16.09.2017

HI PEOPLE! how to save and load hospital time??!!

MYSQL R41-2

Код:
public OnPlayerSpawn(playerid)
{
    if(pInfo[playerid][pHospital] == 1)
	{
	    SetPlayerPos(playerid, 164.6683,211.3258,1003.5147);
	    korhaztimer[playerid] = SetTimerEx("exithospital", 60000, true, "d", playerid);
		SetPlayerHealth(playerid,100.0);
		pInfo[ playerid ][ pHospitalTimer ] = 60000;
	    pInfo[ playerid ][ pJatekosInti ] = 6;
	    SetPlayerInterior(playerid, 6);
	    SavePlayer(playerid);
	}

	PlayerDataLoad(playerid);
	return 1;
}



Re: how to save and load timer?! - Mister0 - 16.09.2017

You can replace the
korhaztimer[playerid] = SetTimerEx("exithospital", 60000, true, "d", playerid);
To
korhaztimer [playerid]=6;
And save it to a mysql variable in database then put the code on a timer of a second who repet
Ifkorhaztimer [playerid]>0;
Korhaztimer [playerid]--;// and save it to mysql

And don't forget to put at onplayerlogin the load variable from mysql database


Re: how to save and load timer?! - BrnX - 16.09.2017

Can not you do it for me? Thank You!! I'm low scripter.