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: Timer! (
/showthread.php?tid=380893)
Timer! -
Red_Dragon. - 27.09.2012
I need an FS or something to let me give a TEMPORARILY vip i have three types of vip in my script: bronze, silver and gold but when i /setvip to someone it goes to him PERMANENTLY but i want to give as i choose like giving a brozne for 1 month or 2 and like giving silver for 1 year and so on
and thanks
Re: Timer! - Emmet_ - 27.09.2012
tempvip.zip
Re: Timer! -
Red_Dragon. - 27.09.2012
Ehm... this link open the script request thread #5 :S
Re: Timer! - Emmet_ - 27.09.2012
Uh, you could probably try doing something like this in your /setvip command:
pawn Код:
// Top of your script
new JoinDate[MAX_PLAYERS][4];
new ExpireDate[MAX_PLAYERS][4];
// /setvip
new year, month, day, string[128];
getdate(year, month, day);
JoinDate[playerid][1] = day;
JoinDate[playerid][2] = month;
JoinDate[playerid][3] = year;
ExpireDate[playerid][1] = day;
ExpireDate[playerid][2] = month;
ExpireDate[playerid][3] = year + 1; // notice the year + 1?
You would then link the JoinDate and ExpireDate variables to your account system, so you can save/load the values.
When the player logs in, check for this:
pawn Код:
new day, month, year;
getdate(year, month, day);
if ((year >= ExpireDate[playerid][3]) && (month >= ExpireDate[playerid][2]) && (day >= ExpireDate[playerid][1]))
{
// Set the player's VIP to 0
}
Re: Timer! - Glint - 27.09.2012
Learn UNIX (POSIX) Timestamps they are really useful
https://sampforum.blast.hk/showthread.php?tid=254915
Re: Timer! -
Red_Dragon. - 27.09.2012
I learned the UNIX TimeStamps but i didn't understand anything from it
Re: Timer! - Glint - 27.09.2012
Quote:
Originally Posted by Red_Dragon.
I learned the UNIX TimeStamps but i didn't understand anything from it
|
You learned it but you didn't understand anything from it!
Then how did you learn it ?
Re: Timer! -
Red_Dragon. - 27.09.2012
Sorry it was a mistake, I meant i didn't understand it I READ IT but didn't understand it
Re: Timer! -
Red_Dragon. - 28.09.2012
Bump -.-
Re: Timer! -
NoahF - 28.09.2012
Post in the script request thread/section.