[HELP] advertise command help thanks
#1

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

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

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

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)