/ad command
#7

PHP код:
new advtime[MAX_PLAYERS];

CMD:ad(playerid,params[])
{
    new 
string[128], message[128], playername[MAX_PLAYER_NAME];
   if(
sscanf(params"s[128]"message)) return SendClientMessage(playerid, -1"Syntax: /ad [message]");
   if(
GetPlayerMoney(playerid) <= 10000) return SendClientMessage(playerid, -1"Error: You don't have $10000 to make a Advertisement");
   if(
advtime[playerid] == 1) return SendClientMessage(playerid, -1"Error: please wait before making another Advertisement");
   
GetPlayerName(playeridplayernameMAX_PLAYER_NAME);
   
format(stringsizeof(string), "{FFFF00}Advertisement by %s: %s"playernamemessage);
   
SendClientMessageToAll(-1string); 
   
advtime[playerid] = 1;
   
SetTimerEx("advtimer"60000false"i",playerid);
   return 
1;
}
forward advtimer(playerid);
public 
advtimer(playerid)
{
    if(
advtime[playerid] == 1)
    {
        
advtime[playerid] = 0;
    }

Don't forget to reset the variable on playerconnect/disconnect
just add this under onplayerconnect
PHP код:
public OnPlayerConnect(playerid)
{
    
advtime[playerid] = 0;

Reply


Messages In This Thread
/ad command - by bugmenotlol - 08.03.2016, 13:32
Re: /ad command - by saffierr - 08.03.2016, 13:46
Re: /ad command - by bugmenotlol - 08.03.2016, 13:58
Re: /ad command - by YouServ - 08.03.2016, 14:51
Re: /ad command - by TheHonnor - 08.03.2016, 16:26
Re: /ad command - by bugmenotlol - 09.03.2016, 02:47
Re: /ad command - by xTURBOx - 09.03.2016, 06:52
Re: /ad command - by Untonyst - 09.03.2016, 10:41
Re: /ad command - by bugmenotlol - 09.03.2016, 13:46
Re: /ad command - by xTURBOx - 09.03.2016, 14:40

Forum Jump:


Users browsing this thread: 2 Guest(s)