Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //-----------------------------------------------<< Komenda >>-----------------------------------------------//
- //--------------------------------------------------[ sms ]--------------------------------------------------//
- //----------------------------------------------------*------------------------------------------------------//
- //----[ ]----//
- //----[ ||||| ||||| |||||||||| |||||||||| ]----//
- //----[ ||| ||| ||| ||| ||| |||| ||| |||| ]----//
- //----[ ||| ||| ||| ||| ||| ||| ||| ||| ]----//
- //----[ || || || || ||| ||| ||| ||| ]----//
- //----[ ||| ||| ||| ||| ||| |||| ||| |||| ]----//
- //----[ || || || || __________ |||||||||| |||||||||| ]----//
- //----[ ||| ||| ||| ||| ||| ||| ||| ]----//
- //----[ || || || || ||| || ||| ]----//
- //----[ ||| ||| ||| ||| ||| ||| ||| ]----//
- //----[ || || || || ||| || ||| ]----//
- //----[ ||| ||| ||| ||| ||| ||| ||| ]----//
- //----[ ||| ||||| ||| ||| ||| ||| ]----//
- //----[ ]----//
- //----------------------------------------------------*------------------------------------------------------//
- // Opis:
- /*
- */
- // Notatki skryptera:
- /*
- */
- YCMD:sms(playerid, params[], help)
- {
- new string[256];
- new sendername[MAX_PLAYER_NAME];
- GetPlayerName(playerid, sendername, sizeof(sendername));
- new numerTelefonuOdbiorcy, wiadomosc[128];
- if( sscanf(params, "ds[128]", numerTelefonuOdbiorcy, wiadomosc))
- {
- sendTipMessage(playerid, "Użyj /sms [numer telefonu] [wiadomość]");
- return 1;
- }
- if(PlayerInfo[playerid][pPnumber] == 0)
- {
- sendErrorMessage(playerid, "Nie posiadasz telefonu.");
- return 1;
- }
- if(PhoneOnline[playerid] == 1)
- {
- sendErrorMessage(playerid, "Twój telefon jest wyłączony. Wpisz /togtel aby go włączyć.");
- return 1;
- }
- if(numerTelefonuOdbiorcy <= 0)
- {
- sendErrorMessage(playerid, "Niepoprawny numer telefonu.");
- return 1;
- }
- new kosztSMS = txtcost;
- new zarobekPracownikaSAN;
- new reciverid;
- if(numerTelefonuOdbiorcy >= 100 && numerTelefonuOdbiorcy <= 150)
- {
- new numerLinii = numerTelefonuOdbiorcy-100;
- new liczbaPracownikowSAN = GetFractionMembersNumber(FRAC_SN, true);
- //kosztSMS += numerLinii*100;
- //Ustawianie koszta sms
- if(numerTelefonuOdbiorcy == 100)
- {
- kosztSMS = COST_SN_SMS_0;
- }
- if(numerTelefonuOdbiorcy == 110)
- {
- kosztSMS = COST_SN_SMS_1;
- }
- if(numerTelefonuOdbiorcy == 120)
- {
- kosztSMS = COST_SN_SMS_2;
- }
- if(numerTelefonuOdbiorcy == 130)
- {
- kosztSMS = COST_SN_SMS_3;
- }
- if(numerTelefonuOdbiorcy == 140)
- {
- kosztSMS = COST_SN_SMS_4;
- }
- if(numerTelefonuOdbiorcy == 150)
- {
- kosztSMS = COST_SN_SMS_5;
- }
- if(gSNLockedLine[numerLinii] || liczbaPracownikowSAN == 0)
- {
- GameTextForPlayer(playerid, "~r~Linia zamknieta", 5000, 1);
- return 1;
- }
- else
- {
- zarobekPracownikaSAN = kosztSMS/liczbaPracownikowSAN;
- zarobekPracownikaSAN = zarobekPracownikaSAN/2;
- }
- }
- //zwykły sms
- else if(numerTelefonuOdbiorcy != 555)
- {
- reciverid = FindPlayerByNumber(numerTelefonuOdbiorcy);
- if(reciverid == INVALID_PLAYER_ID)
- {
- SendClientMessage(playerid, COLOR_GREY, "Nie udało się wysłać wiadomości - gracz o takim numerze jest offline.");
- return 1;
- }
- if(PhoneOnline[reciverid] == 1)
- {
- sendErrorMessage(playerid, "Nie udało się wysłać wiadomości - gracz ma wyłączony telefon.");
- return 1;
- }
- }
- if(kaska[playerid] < kosztSMS)
- {
- format(string, sizeof(string), "Koszt tego SMS wynosi: %d$, nie masz aż tylu pieniędzy.", kosztSMS);
- sendErrorMessage(playerid, string);
- return 1;
- }
- //all ok - wysyłanie wiadomości
- format(string, sizeof(string), "* %s wyjmuje telefon i wysyła wiadomość.", sendername);
- ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
- //wysyłanie do odbiorcy
- if(numerTelefonuOdbiorcy >= 100 && numerTelefonuOdbiorcy <= 150)
- {//linia SAN
- format(string, sizeof(string), "Dodatkowy koszt płatnego SMS: %d$", kosztSMS - txtcost);
- SendClientMessage(playerid, COLOR_WHITE, string);
- //wysyłanie wiadomości + hajs dla SN
- foreach(new i : Player)
- {
- if(GetPlayerFraction(i) == FRAC_SN)
- {
- if(SanDuty[i] == 1)
- {
- SendSMSMessage(PlayerInfo[playerid][pPnumber], i, wiadomosc);
- format(string, sizeof(string), "Płatny SMS wygenerował: %d$, czyli %d$ dla każdego", kosztSMS, zarobekPracownikaSAN);
- SendClientMessage(i, COLOR_YELLOW, string);
- DajKase(i, zarobekPracownikaSAN);
- Sejf_Add(FRAC_SN, kosztSMS/2);
- Sejf_Save(FRAC_SN);
- }
- }
- }
- }
- else if(numerTelefonuOdbiorcy != 555)
- {//zwykły sms
- SendSMSMessage(PlayerInfo[playerid][pPnumber], reciverid, wiadomosc);
- format(string, sizeof(string), "* %s - wibruje mu telefon - przyszedł SMS", GetNick(reciverid, true));
- ProxDetector(30.0, reciverid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
- }
- //informacja zwrotna dla nadawcy
- new slotKontaktu = PobierzSlotKontaktuPoNumerze(playerid, numerTelefonuOdbiorcy);
- if(slotKontaktu >= 0)
- {
- format(string, sizeof(string), "Wysłano SMS: %s, Odbiorca: %s (%d).", wiadomosc, Kontakty[playerid][slotKontaktu][eNazwa], numerTelefonuOdbiorcy);
- }
- else
- {
- format(string, sizeof(string), "Wysłano SMS: %s, Odbiorca: %d.", wiadomosc, numerTelefonuOdbiorcy);
- }
- SendClientMessage(playerid, COLOR_YELLOW, string);
- //pobór opłat
- PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
- format(string, sizeof(string), "~r~$-%d", kosztSMS);
- GameTextForPlayer(playerid, string, 5000, 1);
- ZabierzKase(playerid, kosztSMS);
- SendClientMessage(playerid, COLOR_WHITE, "Wiadomość dostarczona.");
- //mole autoodpowiedź
- if(numerTelefonuOdbiorcy == 555)
- {
- if(strcmp("tak", wiadomosc, true) == 0)
- {
- SendSMSMessage(555, playerid, "Nie mam pojęcia o czym mówisz");
- }
- else
- {
- SendSMSMessage(555, playerid, "To proste napisz tak");
- }
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement