05.08.2018, 10:48
Quote:
CMD:ad(playerid, params[]) { new string[128]; for(new biz = 0; biz < MAX_BIZ; biz++) { if(!IsPlayerInRangeOfPoint(playerid, 100, BizInfo[biz][IXCoord], BizInfo[biz][IYCoord], BizInfo[biz][IZCoord]) && PlayerInfo[playerid][pVW] == BizInfo[biz][VW] && BizInfo[biz][Genre] != { SendClientMessageEx(playerid, COLOR_GREY, "You are not in Advertisment Agency"); return 1; } 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; } else { SendClientMessageEx(playerid, COLOR_LIGHTBLUE, "You dont have enought Money to publish the Advertisement"); } 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]); SendClientMessageToAllEx( TEAM_GROVE_COLOR, string ); BizInfo[biz][Till] += payout; 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; } |