[HELP] advertise timer
#1

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

"Hard" - I don't know
"Possible" - yes using SetTimer.
Reply
#3

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

Convert the milliseconds into seconds then floatround(time value in seconds,float_ceil);
Reply
#5

Create the timer under the advertisement command, thats really simple.
Reply
#6

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

Quote:

Simple. No need for a timer.
Source: https://sampwiki.blast.hk/wiki/Gettime
He wants to have the seconds remaining too before posting another advertisement.
Reply
#8

Quote:
Originally Posted by Imperor
Посмотреть сообщение
He wants to have the seconds remaining too before posting another advertisement.
how can make that ? thanks
Reply
#9

Sent through pm.
Reply
#10

It doesn't work first I give ad ok and second time I can do it again and third time etc...
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)