SA-MP Forums Archive
update this every 1 second??? - 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: update this every 1 second??? (/showthread.php?tid=381198)



update this every 1 second??? - trapstar2020 - 28.09.2012

INI_WriteInt(File,"Cash",GetPlayerMoney(playerid)) ;
how to i do i loop this to save every second


Re: update this every 1 second??? - Kitten - 28.09.2012

It's pretty useless to have a loop or a timer going for one second to save it when you can just save it when the player disconnects.


Re: update this every 1 second??? - Xtreme Brotherz - 28.09.2012

Forwards
pawn Код:
forward savecash(playerid);
Under OnPlayerSpawn or Connect (watever it may be. Its up to you)
pawn Код:
SetTimerEx("savecash", 1000, true, "i", playerid);
Publics
pawn Код:
public savecash(playerid);
{
INI_WriteInt(File,"Cash",GetPlayerMoney(playerid)) ;
return 1;
}
+rep me if i helped

Credits: king_hual


Re: update this every 1 second??? - OnlyOne - 28.09.2012

Xtreme Brotherz you didn't helped in nothing, you're doing something useless and it won't work properly, it must be settimerex instead.


Just do what kitten said.


Re: update this every 1 second??? - SumX - 28.09.2012

Quote:
Originally Posted by Kitten
Посмотреть сообщение
It's pretty useless to have a loop or a timer going for one second to save it when you can just save it when the player disconnects.
but if player crashes? or server restarts and the player is still conn?


Re: update this every 1 second??? - KingHual - 28.09.2012

Quote:
Originally Posted by SumX
Посмотреть сообщение
but if player crashes? or server restarts and the player is still conn?
If the player crashes, the data can be saved using OnPlayerDisconnect which will be called when the player disconnects (duh). If the server crashes - bad luck.


Re: update this every 1 second??? - Xtreme Brotherz - 28.09.2012

Quote:
Originally Posted by OnlyOne
Посмотреть сообщение
Xtreme Brotherz you didn't helped in nothing, you're doing something useless and it won't work properly, it must be settimerex instead.


Just do what kitten said.
Sorry to know

I'm not a professional Scripter like you may be..

But pls help him with his question

Cheers

Edit:: Could you tell me what will be the use for SetTimerEx here??


Re: update this every 1 second??? - KingHual - 28.09.2012

Quote:
Originally Posted by Xtreme Brotherz
Посмотреть сообщение
Sorry to know

I'm not a professional Scripter like you may be..

But pls help him with his question

Cheers

Edit:: Could you tell me what will be the use for SetTimerEx here??
A seperate timer with seperate functions for each player.


Re: update this every 1 second??? - Xtreme Brotherz - 28.09.2012

yeah got it now


Re: update this every 1 second??? - Xtreme Brotherz - 28.09.2012

edited! hopes it got well