[HELP] advertise 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: [HELP] advertise timer (
/showthread.php?tid=518974)
[HELP] advertise timer -
Luca12 - 12.06.2014
Hello I was trying to make when once player advertise then if that player or someone else try again to advertise I want to says between advertisement you must wait 45 seconds. Remaining time: %d seconds. Is this hard to make? Thanks
Re: [HELP] advertise timer -
Rittik - 12.06.2014
"Hard" - I don't know
"Possible" - yes using SetTimer.
Re: [HELP] advertise timer -
Luca12 - 12.06.2014
I was try something like this and when I type ad first okay second when I type it show me remaining seconds 213459 instead of 45 44 etc...
if(gettime() < adtime) return SCMF(playerid,0xDB023EFF,"between advertisement you must wait 45 seconds. Remaining time: %d seconds",adtime);
and here I set when is fist time advertise giving
adtime = gettime() + 45;
Re: [HELP] advertise timer -
Rittik - 12.06.2014
Convert the milliseconds into seconds then floatround(time value in seconds,float_ceil);
Re: [HELP] advertise timer -
Laure - 12.06.2014
Create the timer under the advertisement command, thats really simple.
Re: [HELP] advertise timer -
Threshold - 12.06.2014
pawn Код:
new LastAdvert[MAX_PLAYERS]; //At the top of your script.
public OnPlayerConnect(playerid)
{
LastAdvert[playerid] = 0;
//Rest of code...
return 1;
}
CMD:advertisement(playerid, params[]) //Example command.
{
if((LastAdvert[playerid]) && (LastAdvert[playerid] >= (gettime() - 45))) //Change '45' to however many seconds you want.
return SendClientMessage(playerid, -1, "You must wait 45 seconds before advertising again!");
//Rest of command...
return 1;
}
Simple. No need for a timer.
Source:
https://sampwiki.blast.hk/wiki/Gettime
Re: [HELP] advertise timer -
Laure - 12.06.2014
He wants to have the seconds remaining too before posting another advertisement.
Re: [HELP] advertise timer -
Luca12 - 12.06.2014
Quote:
Originally Posted by Imperor
He wants to have the seconds remaining too before posting another advertisement.
|
how can make that ? thanks
Re: [HELP] advertise timer -
Threshold - 12.06.2014
Sent through pm.
Re: [HELP] advertise timer -
Luca12 - 12.06.2014
It doesn't work first I give ad ok and second time I can do it again and third time etc...