Advertisement
Guest User

sms

a guest
May 24th, 2019
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 6.86 KB | None | 0 0
  1. //-----------------------------------------------<< Komenda >>-----------------------------------------------//
  2. //--------------------------------------------------[ sms ]--------------------------------------------------//
  3. //----------------------------------------------------*------------------------------------------------------//
  4. //----[                                                                                                 ]----//
  5. //----[         |||||             |||||                       ||||||||||       ||||||||||               ]----//
  6. //----[        ||| |||           ||| |||                      |||     ||||     |||     ||||             ]----//
  7. //----[       |||   |||         |||   |||                     |||       |||    |||       |||            ]----//
  8. //----[       ||     ||         ||     ||                     |||       |||    |||       |||            ]----//
  9. //----[      |||     |||       |||     |||                    |||     ||||     |||     ||||             ]----//
  10. //----[      ||       ||       ||       ||     __________     ||||||||||       ||||||||||               ]----//
  11. //----[     |||       |||     |||       |||                   |||    |||       |||                      ]----//
  12. //----[     ||         ||     ||         ||                   |||     ||       |||                      ]----//
  13. //----[    |||         |||   |||         |||                  |||     |||      |||                      ]----//
  14. //----[    ||           ||   ||           ||                  |||      ||      |||                      ]----//
  15. //----[   |||           ||| |||           |||                 |||      |||     |||                      ]----//
  16. //----[  |||             |||||             |||                |||       |||    |||                      ]----//
  17. //----[                                                                                                 ]----//
  18. //----------------------------------------------------*------------------------------------------------------//
  19.  
  20. // Opis:
  21. /*
  22.    
  23. */
  24.  
  25.  
  26. // Notatki skryptera:
  27. /*
  28.    
  29. */
  30.  
  31. YCMD:sms(playerid, params[], help)
  32. {
  33.     new string[256];
  34.     new sendername[MAX_PLAYER_NAME];
  35.     GetPlayerName(playerid, sendername, sizeof(sendername));
  36.  
  37.     new numerTelefonuOdbiorcy, wiadomosc[128];
  38.     if( sscanf(params, "ds[128]", numerTelefonuOdbiorcy, wiadomosc))
  39.     {
  40.         sendTipMessage(playerid, "Użyj /sms [numer telefonu] [wiadomość]");
  41.         return 1;
  42.     }
  43.     if(PlayerInfo[playerid][pPnumber] == 0)
  44.     {
  45.         sendErrorMessage(playerid, "Nie posiadasz telefonu.");
  46.         return 1;
  47.     }
  48.     if(PhoneOnline[playerid] == 1)
  49.     {
  50.         sendErrorMessage(playerid, "Twój telefon jest wyłączony. Wpisz /togtel aby go włączyć.");
  51.         return 1;
  52.     }
  53.     if(numerTelefonuOdbiorcy <= 0)
  54.     {
  55.         sendErrorMessage(playerid, "Niepoprawny numer telefonu.");
  56.         return 1;
  57.     }
  58.    
  59.     new kosztSMS = txtcost;
  60.     new zarobekPracownikaSAN;
  61.     new reciverid;
  62.     if(numerTelefonuOdbiorcy >= 100 && numerTelefonuOdbiorcy <= 150)
  63.     {
  64.         new numerLinii = numerTelefonuOdbiorcy-100;
  65.         new liczbaPracownikowSAN = GetFractionMembersNumber(FRAC_SN, true);
  66.         //kosztSMS += numerLinii*100;
  67.         //Ustawianie koszta sms
  68.         if(numerTelefonuOdbiorcy == 100)
  69.         {
  70.             kosztSMS = COST_SN_SMS_0;
  71.         }
  72.         if(numerTelefonuOdbiorcy == 110)
  73.         {
  74.             kosztSMS = COST_SN_SMS_1;
  75.         }
  76.         if(numerTelefonuOdbiorcy == 120)
  77.         {
  78.             kosztSMS = COST_SN_SMS_2;
  79.         }
  80.         if(numerTelefonuOdbiorcy == 130)
  81.         {
  82.             kosztSMS = COST_SN_SMS_3;
  83.         }
  84.         if(numerTelefonuOdbiorcy == 140)
  85.         {
  86.             kosztSMS = COST_SN_SMS_4;
  87.         }
  88.         if(numerTelefonuOdbiorcy == 150)
  89.         {
  90.             kosztSMS = COST_SN_SMS_5;
  91.         }
  92.         if(gSNLockedLine[numerLinii] || liczbaPracownikowSAN == 0)
  93.         {
  94.             GameTextForPlayer(playerid, "~r~Linia zamknieta", 5000, 1);
  95.             return 1;
  96.         }
  97.         else
  98.         {
  99.             zarobekPracownikaSAN = kosztSMS/liczbaPracownikowSAN;
  100.             zarobekPracownikaSAN = zarobekPracownikaSAN/2;
  101.         }
  102.     }
  103.     //zwykły sms
  104.     else if(numerTelefonuOdbiorcy != 555)
  105.     {
  106.         reciverid = FindPlayerByNumber(numerTelefonuOdbiorcy);
  107.        
  108.         if(reciverid == INVALID_PLAYER_ID)
  109.         {
  110.             SendClientMessage(playerid, COLOR_GREY, "Nie udało się wysłać wiadomości - gracz o takim numerze jest offline.");
  111.             return 1;
  112.         }
  113.        
  114.         if(PhoneOnline[reciverid] == 1)
  115.         {
  116.             sendErrorMessage(playerid, "Nie udało się wysłać wiadomości - gracz ma wyłączony telefon.");
  117.             return 1;
  118.         }
  119.     }
  120.    
  121.     if(kaska[playerid] < kosztSMS)
  122.     {
  123.         format(string, sizeof(string), "Koszt tego SMS wynosi: %d$, nie masz aż tylu pieniędzy.", kosztSMS);
  124.         sendErrorMessage(playerid, string);
  125.         return 1;
  126.     }
  127.    
  128.    
  129.     //all ok - wysyłanie wiadomości
  130.     format(string, sizeof(string), "* %s wyjmuje telefon i wysyła wiadomość.", sendername);
  131.     ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  132.    
  133.    
  134.     //wysyłanie do odbiorcy
  135.     if(numerTelefonuOdbiorcy >= 100 && numerTelefonuOdbiorcy <= 150)
  136.     {//linia SAN
  137.         format(string, sizeof(string), "Dodatkowy koszt płatnego SMS: %d$", kosztSMS - txtcost);
  138.         SendClientMessage(playerid, COLOR_WHITE, string);
  139.        
  140.         //wysyłanie wiadomości + hajs dla SN
  141.         foreach(new i : Player)
  142.         {
  143.             if(GetPlayerFraction(i) == FRAC_SN)
  144.             {
  145.                 if(SanDuty[i] == 1)
  146.                 {
  147.                     SendSMSMessage(PlayerInfo[playerid][pPnumber], i, wiadomosc);
  148.                     format(string, sizeof(string), "Płatny SMS wygenerował: %d$, czyli %d$ dla każdego", kosztSMS, zarobekPracownikaSAN);
  149.                     SendClientMessage(i, COLOR_YELLOW, string);
  150.                     DajKase(i, zarobekPracownikaSAN);
  151.                     Sejf_Add(FRAC_SN, kosztSMS/2);
  152.                     Sejf_Save(FRAC_SN);
  153.                 }
  154.             }
  155.         }
  156.     }
  157.     else if(numerTelefonuOdbiorcy != 555)
  158.     {//zwykły sms
  159.         SendSMSMessage(PlayerInfo[playerid][pPnumber], reciverid, wiadomosc);
  160.         format(string, sizeof(string), "* %s - wibruje mu telefon - przyszedł SMS", GetNick(reciverid, true));
  161.         ProxDetector(30.0, reciverid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  162.     }
  163.    
  164.     //informacja zwrotna dla nadawcy
  165.     new slotKontaktu = PobierzSlotKontaktuPoNumerze(playerid, numerTelefonuOdbiorcy);
  166.     if(slotKontaktu >= 0)
  167.     {
  168.         format(string, sizeof(string), "Wysłano SMS: %s, Odbiorca: %s (%d).", wiadomosc, Kontakty[playerid][slotKontaktu][eNazwa], numerTelefonuOdbiorcy);
  169.     }
  170.     else
  171.     {
  172.         format(string, sizeof(string), "Wysłano SMS: %s, Odbiorca: %d.", wiadomosc, numerTelefonuOdbiorcy);
  173.     }
  174.     SendClientMessage(playerid, COLOR_YELLOW, string);
  175.    
  176.     //pobór opłat
  177.     PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
  178.     format(string, sizeof(string), "~r~$-%d", kosztSMS);
  179.     GameTextForPlayer(playerid, string, 5000, 1);
  180.     ZabierzKase(playerid, kosztSMS);
  181.     SendClientMessage(playerid, COLOR_WHITE, "Wiadomość dostarczona.");
  182.    
  183.     //mole autoodpowiedź
  184.     if(numerTelefonuOdbiorcy == 555)
  185.     {
  186.         if(strcmp("tak", wiadomosc, true) == 0)
  187.         {
  188.             SendSMSMessage(555, playerid, "Nie mam pojęcia o czym mówisz");
  189.         }
  190.         else
  191.         {
  192.             SendSMSMessage(555, playerid, "To proste napisz tak");
  193.         }
  194.     }
  195.     return 1;
  196. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement