SA-MP Forums Archive
[HELP] advertise command help thanks - 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 command help thanks (/showthread.php?tid=551351)



[HELP] advertise command help thanks - Luca12 - 18.12.2014

So I want make in andvertise command like a timer for example one player gives advertise wright and then all the others players including the player who gives ad when type again /ad I sell car then it says you must wait for example 30 seconds between ads if you know what I mean. Thanks.


Re: [HELP] advertise command help thanks - SequenceCuz - 18.12.2014

create variable like

new timewaitingforad = 0;

and when

PHP Code:
CMD:ad(playeridparam[])
{
    if(
gettime()-timewaitingforad > (30))  << 30 is second
    
{
         
sendblahblahblah
         ifwant 
return 1;
         
timewaitingforad gettime();
    }
    else
    {
         
ifwanttosaid so sendclientmessage blahblah wait for 30 second 
         ifwanr 
return 1;
    }
    return 
1; <<< forsure 



AW: [HELP] advertise command help thanks - Flori - 18.12.2014

Use a timer for this

pawn Code:
new Advert[MAX_PLAYERS];

CMD:ad(playerid, param[])
{
    if(Advert[playerid] ==1)return SendClientMessage(playerid,0x33AA33AA,"You're just allowed to advert each 30 seconds");
    {
    SetTimerEx("AdvertWait",30000,false,"i",playerid);
    Advert[playerid] = 1;
//Make here the advert or whatever
    return 1;
}

forward AdvertWait(playerid);
public AdvertWait(playerid)
{
    Advert[playerid] = 0;
    SendClientMessage(playerid,0x33AA33AA,"You're now again allowed to advertise your car.");
    return 1;
}



Re: AW: [HELP] advertise command help thanks - SequenceCuz - 18.12.2014

Quote:
Originally Posted by Flori
View Post
Use a timer for this

pawn Code:
new Advert[MAX_PLAYERS];

CMD:ad(playerid, param[])
{
    if(Advert[playerid] ==1)return SendClientMessage(playerid,0x33AA33AA,"You're just allowed to advert each 30 seconds");
    {
    SetTimerEx("AdvertWait",30000,false,"i",playerid);
    Advert[playerid] = 1;
//Make here the advert or whatever
    return 1;
}

forward AdvertWait(playerid);
public AdvertWait(playerid)
{
    Advert[playerid] = 0;
    SendClientMessage(playerid,0x33AA33AA,"You're now again allowed to advertise your car.");
    return 1;
}
i though gettime it not mess up with server