Advertise format - 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: Advertise format (
/showthread.php?tid=481340)
Advertise format -
LMagnifico - 15.12.2013
i want my ad format to be:
Код:
CMD:ad(playerid, params[])
{
new idx = GetPlayerVirtualWorld(playerid)-100, price = strlen(params) * 6, string[128];
if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
if(PlayerInfo[playerid][pLevel] < 3) SendClientMessage(playerid, COLOR_GREY, "You need to be at least level 3 to create an advertisement.");
if(idx > 0 && idx < MAX_BIZ && BizInfo[idx][bType] != 5 || idx < 1 || idx > MAX_BIZ) return SendClientMessage(playerid, COLOR_GREY, "You are not inside an Advertisement Agency.");
if(sscanf(params, "s[128]", params)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /ad [advertisement]");
if(strlen(params) > 64) return SendClientMessage(playerid, COLOR_GREY, "Maximum characters allowed per advertisement are 64.");
if(BizInfo[idx][bProducts] < 1) return SendClientMessage(playerid, COLOR_GREY, "This business is currently out of products.");
if(!PlayerInfo[playerid][pCellphone]) return SendClientMessage(playerid, COLOR_GREY, "You need a cellphone to place advertisements.");
if(PlayerInfo[playerid][pMoney] < price) return SendClientMessage(playerid, COLOR_GREY, "You don't have enough money to do this.");
if(HasAD[playerid]) return SendClientMessage(playerid, COLOR_GREY, " You must wait for your advertisement to be published before making a new one.");
if(AdQueue == MAX_ADS-1) return SendClientMessage(playerid, COLOR_GREY, " There are no queue slots for your advertisement.");
// Advertisement
HasAD[playerid] = 1;
if(LastAd) SendClientMessage(playerid, COLOR_LIGHTBLUE, " Your advertisement has been placed in the queue, wait for about 60 seconds maximum.");
format(AD[AdQueue], 128, "Advertisement: %s, Contact: %s - Ph: %d", params, RPN(playerid), PlayerInfo[playerid][pCellphone]);
iAD[AdQueue] = 0;
format(iAdName[AdQueue], 32, "%s", BizInfo[idx][bOwner]);
AdQueue++;
GiveZaiatMoney(playerid, -price);
BizInfo[idx][bMoney] += price/2;
BizInfo[idx][bProducts] --;
NewsMoney = price/2;
format(string, sizeof(string), "* %s has placed an advertisement in the queue for $%d.", RPN(playerid), price);
SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
SendClientMessage(playerid, COLOR_WHITE, " You have been charged $5 per character.");
return 1;
}
Re: Advertise format -
Zamora - 15.12.2013
Add this.
pawn Код:
CMD:ad(playerid, params[])
{
new idx = GetPlayerVirtualWorld(playerid)-100, price = strlen(params) * 6, string[128];
if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
if(PlayerInfo[playerid][pLevel] < 3) SendClientMessage(playerid, COLOR_GREY, "You need to be at least level 3 to create an advertisement.");
if(idx > 0 && idx < MAX_BIZ && BizInfo[idx][bType] != 5 || idx < 1 || idx > MAX_BIZ) return SendClientMessage(playerid, COLOR_GREY, "You are not inside an Advertisement Agency.");
if(sscanf(params, "s[128]", params)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /ad [advertisement]");
if(strlen(params) > 64) return SendClientMessage(playerid, COLOR_GREY, "Maximum characters allowed per advertisement are 64.");
if(BizInfo[idx][bProducts] < 1) return SendClientMessage(playerid, COLOR_GREY, "This business is currently out of products.");
if(!PlayerInfo[playerid][pCellphone]) return SendClientMessage(playerid, COLOR_GREY, "You need a cellphone to place advertisements.");
if(PlayerInfo[playerid][pMoney] < price) return SendClientMessage(playerid, COLOR_GREY, "You don't have enough money to do this.");
if(HasAD[playerid]) return SendClientMessage(playerid, COLOR_GREY, " You must wait for your advertisement to be published before making a new one.");
if(AdQueue == MAX_ADS-1) return SendClientMessage(playerid, COLOR_GREY, " There are no queue slots for your advertisement.");
// Advertisement
HasAD[playerid] = 1;
if(LastAd) SendClientMessage(playerid, COLOR_LIGHTBLUE, " Your advertisement has been placed in the queue, wait for about 60 seconds maximum.");
format(AD[AdQueue], 128, "Ad placed by %s. (Phone:{FFFFFF} %d{298A08) %s", RPN(playerid), PlayerInfo[playerid][pCellphone], params);
iAD[AdQueue] = 0;
format(iAdName[AdQueue], 32, "%s", BizInfo[idx][bOwner]);
AdQueue++;
GiveZaiatMoney(playerid, -price);
BizInfo[idx][bMoney] += price/2;
BizInfo[idx][bProducts] --;
NewsMoney = price/2;
format(string, sizeof(string), "* %s has placed an advertisement in the queue for $%d.", RPN(playerid), price);
SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
SendClientMessage(playerid, COLOR_WHITE, " You have been charged $5 per character.");
return 1;
}