SA-MP Forums Archive
start some and finish after few days.. - 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: start some and finish after few days.. (/showthread.php?tid=384723)



start some and finish after few days.. - tomsalmon - 13.10.2012

hello, i want to do a prizes system of the player can to win a Anti Bike Fall for 3 days, there is any way to do this without timer? leave the anti fall, i will do this. but i want it to end after 3 days.

PHP код:
dini_IntSet(File(playerid),"AntiFall",1)// i want it will automatically set to 0 after 3 days 
// i want it will automatically set to 0 after 3 days, can someone give me an example how to do this?


Re: start some and finish after few days.. - T-Raw - 13.10.2012

u need a msql system :/


Re: start some and finish after few days.. - .v - 13.10.2012

its easy if you will not use Days.


Re: start some and finish after few days.. - T-Raw - 13.10.2012

it is a whole looping with server info thing, he cannot use regular methods of saving 2 do this


Re: start some and finish after few days.. - Glint - 13.10.2012

You need to use UNIX (POSIX) Timestamps, check more information about it here https://sampforum.blast.hk/showthread.php?tid=254915


Re: start some and finish after few days.. - TzAkS. - 13.10.2012

1.Use a timer,not recomanded.
2.If you have a 'time system' on server,like weather change every hour..make +1 at every hour and when you got 72,you got 3 days,it`s just an ideea..


Re: start some and finish after few days.. - tomsalmon - 13.10.2012

i found this:

PHP код:
stock DaysBetweenDates(DateStart[], DateEnd[]) // by SharkyKH
{
    new 
datetmp[256], idx1, idx2;
    
    
datetmp = strtok(DateStart, idx1, '.');
    new 
Start_Day = strval(datetmp);
    
datetmp = strtok(DateStart, idx1, '.');
    new 
Start_Month = strval(datetmp);
    
datetmp = strtok(DateStart, idx1, '.');
    new 
Start_Year = strval(datetmp);
    
    
datetmp = strtok(DateEnd, idx2, '.');
    new 
End_Day = strval(datetmp);
    
datetmp = strtok(DateEnd, idx2, '.');
    new 
End_Month = strval(datetmp);
    
datetmp = strtok(DateEnd, idx2, '.');
    new 
End_Year = strval(datetmp);
    
    new 
init_date = mktime(12,0,0,Start_Day,Start_Month,Start_Year);
    new 
dest_date = mktime(12,0,0,End_Day,End_Month,End_Year);
    
    new 
offset = dest_date-init_date;
    
    new 
days = floatround(offset/60/60/24, floatround_floor);
    return 
days;
} 
with this i can do this too? because i don't understand the unix timestamp.. if i can do it with this function, can you give me an example how to do this?


Re: start some and finish after few days.. - tomsalmon - 13.10.2012

someone??