Advertisement
Guest User

Untitled

a guest
Mar 2nd, 2019
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.97 KB | None | 0 0
  1. YCMD:ad(playerid, params[], help) {
  2. if(AdTimer[playerid] != 0) return SCM(playerid, COLOR_LGREEN, "Ai pus deja un anunt. Foloseste comanda [/myad] pentru a-l vedea.");
  3. if(PlayerInfo[playerid][pMuted] == 1) return SCMf(playerid, COLOR_LGREEN, "Ai mute. Poti folosi aceasta comanda peste %d secunde.", PlayerInfo[playerid][pMuteTime]);
  4. if(PlayerInfo[playerid][pLevel] < 5) return SCM(playerid, COLOR_LGREEN, "Ai nevoie de nivel 5 pentru a da un anunt!");
  5. if(!PlayerInfo[playerid][pPhone]) return SCM(playerid, COLOR_LGREEN, "Nu ai un telefon.");
  6.  
  7. new length = strlen(params), payout, count = 0, offset, idx, totalads, timer, result[264];
  8. while((idx < length) && (params[idx] <= ' ')) idx ++; offset = idx;
  9. while((idx < length) && ((idx - offset) < (sizeof result - 1))) {
  10. result[idx - offset] = params[idx];
  11. idx ++;
  12. } result[idx - offset] = EOS; totalads = TotalAds() + 1;
  13.  
  14. for(new i = 1; i < sizeof BizzInfo; i++) {
  15. if(PlayerToPoint(10.0, playerid, BizzInfo[i][bEntranceX], BizzInfo[i][bEntranceY], BizzInfo[i][bEntranceZ]) && BizzInfo[i][bType] == 10) {
  16. count ++; payout = BizzInfo[i][bFee];
  17. if(!strlen(result)) return SCM(playerid, COLOR_GREY, "USAGE: {FFFFFF}/ad [text]");
  18. if(FaceReclama(result)) return Reclama(playerid, result);
  19. if(GetPlayerCash(playerid) < payout) return SCMf(playerid, COLOR_GREY, "Nu ai suma de %s$ (%d caractre).", FormatNumber(payout), offset);
  20.  
  21. gString[0] = (EOS);
  22. BizzInfo[i][bBalance] += payout;
  23. BizzInfo[i][bProducts] += payout;
  24. AdTimer[playerid] = totalads * 60;
  25. timer = SetTimerEx("Advertisment", totalads * 60000, false, "d", playerid);
  26. SetPVarInt(playerid, "AdTimer", timer);
  27. GivePlayerCash(playerid, -payout); UpdateVar(playerid, "Money", GetPlayerCash(playerid));
  28. format(AdText[playerid], 256, result);
  29. 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]);
  30. mysql_tquery(SQL, gString, "", "");
  31. va_GameTextForPlayer(playerid, "~r~Ai platit %s$~n~~w~Mesajul contine %d caractere", 5000, 5, payout, idx);
  32. SCMf(playerid, 0xbaff44FF, "Anuntul tau va fii afisat in %d minute.", AdTimer[playerid] / 60);
  33. SendStaffMessage(0xbaff44FF, "Preview ad by %s (ID: {FFFFFF}%d{baff44} | Phone: {FFFFFF}%d{baff44}): %s", GetName(playerid), playerid, PlayerInfo[playerid][pPhone], result);
  34. break;
  35. }
  36. }
  37.  
  38. if(!count) return SCM(playerid, COLOR_GREY, "Nu esti la CNN.");
  39. return 1;
  40. }
  41.  
  42.  
  43.  
  44. //functiile
  45.  
  46. function Advertisment(playerid) {
  47. if(IsPlayerConnected(playerid) && AdTimer[playerid] != 0) {
  48. new string[1024];
  49. format(string, sizeof(string), "Ad by %s (phone: {FFFFFF}%d{00D900}): %s",GetName(playerid),PlayerInfo[playerid][pPhone],AdText[playerid]);
  50. SendClientMessageToAll(0x00D900FF, string);
  51. AdTimer[playerid] = 0;
  52. }
  53. return 1;
  54. }
  55.  
  56. function TotalAds() {
  57. new x;
  58. foreach(new i: Player) {
  59. if(IsPlayerConnected(i) && AdTimer[i] != 0) x++;
  60. }
  61. return x;
  62. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement