update this every 1 second???
#1

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

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.
Reply
#3

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
Reply
#4

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.
Reply
#5

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?
Reply
#6

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.
Reply
#7

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??
Reply
#8

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.
Reply
#9

yeah got it now
Reply
#10

edited! hopes it got well
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)