Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- @platform: SA-MP
- @published only Pawno.PL.
- @name: script using SMS-API from Prograjek.pl
- @Prograjek URL: http://prograjek.pl/
- @original idea: brother300 <[email protected]>
- @author: brother300 <[email protected]>, edited by: l0nger <[email protected]>
- @date created: 24-04-2014 12:01
- @date released: 24-04-2014 12:01
- @date updated: 24-04-2014 22:45
- @version: 0.1.5.2414
- (c) 2014, <[email protected]>
- */
- // Main
- #include <a_samp>
- // Definitions
- #define PG_USERID "Your userid from prograjek.pl/Twoj userid z prograjek.pl"
- #define SAPI_COMMAND_NAME "/sms" // tresc komendy
- // Do not touch
- #define SCRIPT_AUTHOR "brother300, edited by: l0nger"
- #define SCRIPT_VERSION "0.1.5.1814"
- // Variables
- enum (+=1)
- {
- DIALOG_SAPI_MAIN=7800, // glowne menu informacji
- DIALOG_SAPI_PAID, // zaplata (klient musi wyslac sms i wpisac otrzymany kod w okno gui)
- DIALOG_SAPI_PAIDINFO, // informacja o zaplacie
- };
- enum E_SAPI_POSSIBLEPAY
- {
- esp_payNetto,
- Float:esp_payBrutto,
- esp_text[10],
- esp_codeText
- };
- static stock
- sapi_possiblePayments[12][E_SAPI_POSSIBLEPAY] =
- {
- // netto, brutto, tresc sms, numer sms
- {1, 1.23, "HPAY.PG", 7155},
- {2, 2.46, "HPAY.PG", 7255},
- {3, 3.69, "HPAY.PG", 7355},
- {4, 4.92, "HPAY.PG1", 7455},
- {6, 6.15, "HPAY.PG", 7555},
- {9, 11.07, "HPAY.PG", 7655},
- {11, 13.53, "HPAY.PG", 91155},
- {14, 17.22, "HPAY.PG", 91455},
- {19, 23.37, "HPAY.PG", 91955},
- {20, 24.6, "HPAY.PG", 92055},
- {25, 30.75, "HPAY.PG", 92555},
- };
- // Callbacks
- public OnFilterScriptInit()
- {
- printf("\n\n*** SMS-API ProGrajek was loaded!");
- printf("Version: "SCRIPT_VERSION" ***\n\n");
- return 1;
- }
- public OnFilterScriptInit()
- {
- printf("\n\n*** SMS-API ProGrajek was unloaded!")
- return 1;
- }
- public OnDialogRespone(playerid, dialogid, response, listitem, inputtext[])
- {
- switch(dialogid)
- {
- case DIALOG_SAPI_MAIN:
- {
- if(!response) return 1;
- strdel(inputtext, strfind(inputtext, "("), strlen(inputtext));
- new price=strval(inputtext), buf[128], bool:error=false;
- SetPVarInt(playerid, "sapi:selectedPrice", price);
- for(new i; i<sizeof(sapi_possiblePayments); i++)
- {
- error=true;
- if(price==sapi_possiblePayments[i][esp_payNetto])
- {
- format(buf, sizeof(buf), "Wyslij SMS o tresci %s na numer %d\nPamietaj, ze koszt tego SMS'a wynosi: %d (brutto: %.0f)\nKod zwrotny wpisz w ponizsze pole edycji.", sapi_possiblePayments[i][esp_text], sapi_possiblePayments[i][esp_codeText], sapi_possiblePayments[i][esp_payNetto], sapi_possiblePayments[i][esp_payBrutto]);
- error=false;
- break;
- }
- }
- if(error)
- {
- OnPlayerCommandText(playerid, SAPI_COMMAND_NAME);
- SendClientMessage(playerid, -1, "Wystapil blad, sprobuj ponownie.");
- return true;
- } else {
- ShowPlayerDialog(playerid, DIALOG_SAPI_PAID, DIALOG_STYLE_INPUT, "SAPI - Kupno", buf, "Gotowe", "Anuluj");
- return true;
- }
- }
- case DIALOG_SAPI_PAID:
- {
- if(!respone) return 1;
- new buf[320];
- format(buf, sizeof(buf), "prograjek.pl/api/payment/api_code_verify.php?payment=dotpay&userid=%s&code=%s", PG_USERID, inputtext);
- HTTP(playerid, HTTP_GET, buf, "", "onClientSendRequestPay");
- } return true;
- }
- return false;
- }
- // Functions
- forward onClientSendRequestPay(plr, response, s[]);
- public onClientSendRequestPay(plr, response, s[])
- {
- if(response!=200) {
- ShowPlayerDialog(plr, DIALOG_SAPI_PAIDINFO, DIALOG_STYLE_MSGBOX, "SAPI - Informacja", "Wystapil nieoczekiwany problem z hostem... Sprobuj ponownie.", "Zamknij", "");
- return;
- }
- if(strfind(s, "ok", false)!=-1)
- {
- ShowPlayerDialog(plr, DIALOG_SAPI_PAIDINFO, DIALOG_STYLE_MSGBOX, "SAPI - Informacja", "Weryfikacja kodu zwrotnego przeszla pomyslnie!\nTrwa aktywacja uslugi... (czegos tam)", "Zamknij", "");
- } else {
- ShowPlayerDialog(plr, DIALOG_SAPI_PAIDINFO, DIALOG_STYLE_MSGBOX, "SAPI - Informacja", "Weryfikacja kodu zwrotnego nie przeszla pomyslnie.\nPrawdopodobnie kod jest niepoprawny, lub wystapil nieoczekiwany problem z hostem.", "Zamknij", "");
- }
- }
- // Commands
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- if(!strcmp(SAPI_COMMAND_NAME, cmdtext, false))
- {
- new buf[10*30];
- for(new i; i<sizeof(sapi_possiblePayments); i++)
- {
- format(buf, sizeof(buf), "%s\n%d (%.0f)", sapi_possiblePayments[i][esp_payNetto], sapi_possiblePayments[i][esp_payBrutto]);
- }
- ShowPlayerDialog(playerid, DIALOG_MAIN, DIALOG_STYLE_LIST, "SAPI - Menu glowne", buf, "Wybierz", "Anuluj");
- return true;
- }
- return false;
- }
Advertisement
Add Comment
Please, Sign In to add comment