Advertisement
Guest User

Untitled

a guest
Jun 25th, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 1.84 KB | None | 0 0
  1. #include <a_samp>
  2.  
  3. //zrob tabele o jakiej kowleik nazwie w bazie danych i wloz tam w kazdy wpisie inny KOD, te 3000 kodow ;)
  4.  
  5. public OnPlayerConnect(playerid)
  6. {
  7.     //zapytanie aby pobieralo date waznosci
  8.     new Year, Month, Day;
  9.     getdate(Year, Month, Day);
  10.     if(ROK_Z_BAZY < Year && MIESIAC_Z_BAZY < Month && DZIEN_Z_BAZY < Day)
  11.     {
  12.         //zabiera premium, najlepiej wyzerowac czas w bazie danych
  13.     }
  14.     //pobieranie z bazy danych info czy jest VIPem, poprostu zrobic pole ze zmienna "ispremium" lub cos w tym stylu
  15.     if(ISPREMIUM_Z_BAZY_DANYCH == 1)
  16.     {
  17.         SetPVarInt(playerid, "Premium", 1);
  18.         SendClientMessage(playerid, 0xFFFFFFFF, "Jesteœ Graczem Premium!");
  19.     }
  20. }
  21.  
  22. public OnPlayerCommandText(playerid, cmdtext[])
  23. {
  24.     if(!strcmp("/premium", cmdtext, true, 10))
  25.     {
  26.         ShowPlayerDialog(playerid, 0, DIALOG_STYLE_INPUT, "Premium", "Tu na jaki nr z jaka trescia wyslac SMS wpiszcie!", "Aktywuj", "Anuluj");
  27.         return 1;
  28.     }
  29.     if(!strcmp("/testpcmd", cmdtext, true, 10))
  30.     {
  31.         if(!IsPlayerPremium(playerid))
  32.         {
  33.             //jesli nie jest premium
  34.             return 1;
  35.         }
  36.         //jesli jest premium
  37.         return 1;
  38.     }
  39.     return 0;
  40. }
  41.  
  42. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  43. {
  44.     if(dialogid == 0)
  45.     {
  46.         //pobieranie all kodow
  47.         if() //jakis KOD wybrany (w petli)
  48.         {
  49.             ShowPlayerDialog(playerid, 0, DIALOG_STYLE_INPUT, "Premium", "Gratulacje, zosta³eœ graczem premium!", "Ok", "Anuluj");
  50.             SetPVarInt(playerid, "Premium", 1);
  51.             //zapytanie aby zmeinialo czas premium (waznosc) na obecna data + 30 dni
  52.         }
  53.         else
  54.         {
  55.             ShowPlayerDialog(playerid, 0, DIALOG_STYLE_INPUT, "Premium", "Kod aktywacji jest niepoprawny!", "Aktywuj", "Anuluj");
  56.         }
  57.     }
  58.     return 1;
  59. }
  60.  
  61. stock IsPlayerPremium(playerid) //funkcja pozwala sprawdzic czy gracz jest VIPem
  62. {
  63.     if(GetPVarInt(playerid, "Premium") == 1) return 1;
  64.     return 0;
  65. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement