Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- YCMD:ad(playerid, params[], help) {
- if(AdTimer[playerid] != 0) return SCM(playerid, COLOR_LGREEN, "Ai pus deja un anunt. Foloseste comanda [/myad] pentru a-l vedea.");
- if(PlayerInfo[playerid][pMuted] == 1) return SCMf(playerid, COLOR_LGREEN, "Ai mute. Poti folosi aceasta comanda peste %d secunde.", PlayerInfo[playerid][pMuteTime]);
- if(PlayerInfo[playerid][pLevel] < 5) return SCM(playerid, COLOR_LGREEN, "Ai nevoie de nivel 5 pentru a da un anunt!");
- if(!PlayerInfo[playerid][pPhone]) return SCM(playerid, COLOR_LGREEN, "Nu ai un telefon.");
- new length = strlen(params), payout, count = 0, offset, idx, totalads, timer, result[264];
- while((idx < length) && (params[idx] <= ' ')) idx ++; offset = idx;
- while((idx < length) && ((idx - offset) < (sizeof result - 1))) {
- result[idx - offset] = params[idx];
- idx ++;
- } result[idx - offset] = EOS; totalads = TotalAds() + 1;
- for(new i = 1; i < sizeof BizzInfo; i++) {
- if(PlayerToPoint(10.0, playerid, BizzInfo[i][bEntranceX], BizzInfo[i][bEntranceY], BizzInfo[i][bEntranceZ]) && BizzInfo[i][bType] == 10) {
- count ++; payout = BizzInfo[i][bFee];
- if(!strlen(result)) return SCM(playerid, COLOR_GREY, "USAGE: {FFFFFF}/ad [text]");
- if(FaceReclama(result)) return Reclama(playerid, result);
- if(GetPlayerCash(playerid) < payout) return SCMf(playerid, COLOR_GREY, "Nu ai suma de %s$ (%d caractre).", FormatNumber(payout), offset);
- gString[0] = (EOS);
- BizzInfo[i][bBalance] += payout;
- BizzInfo[i][bProducts] += payout;
- AdTimer[playerid] = totalads * 60;
- timer = SetTimerEx("Advertisment", totalads * 60000, false, "d", playerid);
- SetPVarInt(playerid, "AdTimer", timer);
- GivePlayerCash(playerid, -payout); UpdateVar(playerid, "Money", GetPlayerCash(playerid));
- format(AdText[playerid], 256, result);
- mysql_format(SQL, gString, sizeof gString, "UPDATE `bizz` SET `Till` = '%d', `Products` = '%d' WHERE `ID` = '%d'", BizzInfo[i][bBalance], BizzInfo[i][bProducts], BizzInfo[i][bID]);
- mysql_tquery(SQL, gString, "", "");
- va_GameTextForPlayer(playerid, "~r~Ai platit %s$~n~~w~Mesajul contine %d caractere", 5000, 5, payout, idx);
- SCMf(playerid, 0xbaff44FF, "Anuntul tau va fii afisat in %d minute.", AdTimer[playerid] / 60);
- SendStaffMessage(0xbaff44FF, "Preview ad by %s (ID: {FFFFFF}%d{baff44} | Phone: {FFFFFF}%d{baff44}): %s", GetName(playerid), playerid, PlayerInfo[playerid][pPhone], result);
- break;
- }
- }
- if(!count) return SCM(playerid, COLOR_GREY, "Nu esti la CNN.");
- return 1;
- }
- //functiile
- function Advertisment(playerid) {
- if(IsPlayerConnected(playerid) && AdTimer[playerid] != 0) {
- new string[1024];
- format(string, sizeof(string), "Ad by %s (phone: {FFFFFF}%d{00D900}): %s",GetName(playerid),PlayerInfo[playerid][pPhone],AdText[playerid]);
- SendClientMessageToAll(0x00D900FF, string);
- AdTimer[playerid] = 0;
- }
- return 1;
- }
- function TotalAds() {
- new x;
- foreach(new i: Player) {
- if(IsPlayerConnected(i) && AdTimer[i] != 0) x++;
- }
- return x;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement