CMD:ad(playerid, params[])
{
new string[128];
if(gPlayerLogged{playerid} == 0)
{
SendClientMessageEx(playerid, COLOR_GREY, "You're not logged in.");
return 1;
}
if(PlayerInfo[playerid][pADMute] == 1)
{
SendClientMessageEx(playerid, COLOR_GREY, "You are muted from advertisements.");
return 1;
}
if(PlayerInfo[playerid][pPnumber] == 0)
{
SendClientMessageEx(playerid, COLOR_GRAD2, "You don't have a cell phone.");
return 1;
}
if(!IsPlayerInRangeOfPoint(playerid, 5, 646.549377, -1348.272338, 13.546875) && !IsPlayerInRangeOfPoint(playerid, 5, -2240.405761, 239.212402, 35.320312))
{
SendClientMessageEx(playerid, COLOR_GRAD2, "You can only put up advertisements at ad points (Rodeo in Los Santos or Garcia in San Fierro).");
return 1;
}
if(GetPVarInt(playerid, "Injured") == 1) return SendClientMessageEx(playerid, COLOR_GREY, "You can't place advertisements while injured.");
if(PlayerCuffed[playerid] != 0) return SendClientMessageEx(playerid, COLOR_GREY, "You can't place advertisements right now.");
if(PlayerInfo[playerid][pJailTime] > 0) return SendClientMessageEx(playerid, COLOR_GREY, "You can't place advertisements while in jail.");
if(isnull(params))
{
SendClientMessageEx(playerid, COLOR_GRAD2, "USAGE: (/ad)vertise [advert text]");
return 1;
}
if(strlen(params) >= 66 )
{
SendClientMessageEx( playerid, COLOR_GRAD1, "Your advertisement was too long, please refrain from using more than 66 characters in an advertisement." );
return 1;
}
if ((!adds) && (PlayerInfo[playerid][pAdmin] < 2))
{
SendClientMessageEx(playerid, COLOR_GRAD2, "Please try again later - only one advertisement can be submitted every 30 seconds.");
return 1;
}
new payout = strlen(params) * 25;
if(GetPlayerCash(playerid) < payout)
{
format(string, sizeof(string), "* You used %d characters which cost $%d, you don't have enough.", strlen(params), payout);
SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
return 1;
}
format(string, sizeof(string), "~r~Paid $%d~n~~w~Message contained: %d Characters", payout, strlen(params));
GameTextForPlayer(playerid, string, 5000, 5);
if (PlayerInfo[playerid][pAdmin] < 2){SetTimer("AddsOn", addtimer, 0);adds = 0;}
GivePlayerCash(playerid, - payout);
format(string, sizeof(string), "Advertisement: %s - contact %s (%d)", params, GetPlayerNameEx(playerid),PlayerInfo[playerid][pPnumber]);
OOCNews(TEAM_GROVE_COLOR,string);
if(!newspaperad1[0])
{
newspaperad1 = string;
}
else if(!newspaperad2[0])
{
newspaperad2 = string;
}
else if(!newspaperad3[0])
{
newspaperad3 = string;
}
else if(!newspaperad4[0])
{
newspaperad4 = string;
}
else if(!newspaperad5[0])
{
newspaperad5 = string;
}
else
{
newspaperad1 = newspaperad2;
newspaperad2 = newspaperad3;
newspaperad3 = newspaperad4;
newspaperad4 = newspaperad5;
newspaperad5 = string;
}
return 1;
}
like this
|
dude just read
https://sampwiki.blast.hk/wiki/SetTimerEx If you try it and it still doesn't work, post the code with the timer on it and ask how to fix it |
CMD:ad(playerid, params[])
{
new string[128];
if(gPlayerLogged{playerid} == 0)
{
SendClientMessageEx(playerid, COLOR_GREY, "You're not logged in.");
return 1;
}
if(PlayerInfo[playerid][pADMute] == 1)
{
SendClientMessageEx(playerid, COLOR_GREY, "You are muted from advertisements.");
return 1;
}
if(PlayerInfo[playerid][pPnumber] == 0)
{
SendClientMessageEx(playerid, COLOR_GRAD2, "You don't have a cell phone.");
return 1;
}
if(GetPVarInt(playerid, "Injured") == 1) return SendClientMessageEx(playerid, COLOR_GREY, "You can't place advertisements while injured.");
if(PlayerCuffed[playerid] != 0) return SendClientMessageEx(playerid, COLOR_GREY, "You can't place advertisements right now.");
if(PlayerInfo[playerid][pJailTime] > 0) return SendClientMessageEx(playerid, COLOR_GREY, "You can't place advertisements while in jail.");
if(isnull(params))
{
SendClientMessageEx(playerid, COLOR_GRAD2, "USAGE: (/ad)vertise [advert text]");
return 1;
}
if(strlen(params) >= 66 )
{
SendClientMessageEx( playerid, COLOR_GRAD1, "Your advertisement was too long, please refrain from using more than 66 characters in an advertisement." );
return 1;
}
if ((!adds) && (PlayerInfo[playerid][pAdmin] < 2))
{
SendClientMessageEx(playerid, COLOR_GRAD2, "Please try again later - only one advertisement can be submitted every 30 seconds.");
return 1;
}
new payout = strlen(params) * 25;
if(GetPlayerCash(playerid) < payout)
{
format(string, sizeof(string), "* You used %d characters which cost $%d, you don't have enough.", strlen(params), payout);
SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
return 1;
}
format(string, sizeof(string), "~r~Paid $%d~n~~w~Message contained: %d Characters", payout, strlen(params));
GameTextForPlayer(playerid, string, 5000, 5);
if (PlayerInfo[playerid][pAdmin] < 2)
SetTimerEx("AddsOn", addtimer, 60);adds = 0;
GivePlayerCash(playerid, - payout);
format(string, sizeof(string), "Ad: %s - %s PH(%d)", params, GetPlayerNameEx(playerid),PlayerInfo[playerid][pPnumber]);
OOCNews(TEAM_GROVE_COLOR,string);
if(!newspaperad1[0])
{
newspaperad1 = string;
}
else if(!newspaperad2[0])
{
newspaperad2 = string;
}
else if(!newspaperad3[0])
{
newspaperad3 = string;
}
else if(!newspaperad4[0])
{
newspaperad4 = string;
}
else if(!newspaperad5[0])
{
newspaperad5 = string;
}
else
{
newspaperad1 = newspaperad2;
newspaperad2 = newspaperad3;
newspaperad3 = newspaperad4;
newspaperad4 = newspaperad5;
newspaperad5 = string;
}
return 1;
}
C:\Documents and Settings\Mark&Matt\My Documents\Next Revolution Roleplay\Next Revolution Roleplay\gamemodes\NRRP_Fixed.pwn(50219) : warning 202: number of arguments does not match definition
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
1 Warning.
SetTimer("addon",60000,false);
forward addon();
public addon()
{
adds = 0;
return 1;
}
pawn Код:
pawn Код:
|