09.03.2016, 06:52
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(playerid, playername, MAX_PLAYER_NAME);
format(string, sizeof(string), "{FFFF00}Advertisement by %s: %s", playername, message);
SendClientMessageToAll(-1, string);
advtime[playerid] = 1;
SetTimerEx("advtimer", 60000, false, "i",playerid);
return 1;
}
forward advtimer(playerid);
public advtimer(playerid)
{
if(advtime[playerid] == 1)
{
advtime[playerid] = 0;
}
}
just add this under onplayerconnect
PHP код:
public OnPlayerConnect(playerid)
{
advtime[playerid] = 0;
}