Advertisement
Guest User

Barracuda Laptop

a guest
Jul 21st, 2011
426
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 14.01 KB | None | 0 0
  1. #include <a_samp>
  2.  
  3. #define LAPTOP_MONEY    (0) // A laptop ara
  4.  
  5. // Internet - webcimek megadasara alkalmas
  6. public InternetBrowser(playerid, url[]);
  7. public InternetBrowser(playerid, url[])
  8. {
  9.         // Pelda:
  10.         if(CheckURL(url, "www.barracuda.co.cc"))
  11.         {
  12.             SendClientMessage(playerid, 0xFFFF00AA, "A Barracuda Szerver Weboldala!");
  13.             return 1;
  14.         }
  15.         // Vagy ha azt akarjuk, hogy a cimet felismerje mas alakban is
  16.         // Ha azt irjak be: http://www.google.hu/ , akkor is talalatot kapjon
  17.         // De itt fenn all a veszely, hogy a felhasznalo mast ir be es akkor is
  18.         // talalatot kap pl.: khm..::www.google.hu::..
  19.         if(CheckURL(url, "www.barracuda.co.cc", true))
  20.         {
  21.             SendClientMessage(playerid, 0xFFFF00AA, "A Barracuda Szerver Weboldala!");
  22.             return 1;
  23.         }
  24.         if(CheckURL(url, "barracuda.co.cc", true))
  25.         {
  26.             SendClientMessage(playerid, 0xFFFF00AA, "A Barracuda Szerver Weboldala!");
  27.             return 1;
  28.         }
  29.         if(CheckURL(url, "http://barracuda.co.cc", true))
  30.         {
  31.             SendClientMessage(playerid, 0xFFFF00AA, "A Barracuda Szerver Weboldala!");
  32.             return 1;
  33.         }
  34.         if(CheckURL(url, "www.google.com", true))
  35.         {
  36.             SendClientMessage(playerid, 0xFFFF00AA, "A Google fejlesztes alatt all!");
  37.             return 1;
  38.         }
  39.         if(CheckURL(url, "www.google.hu", true))
  40.         {
  41.             SendClientMessage(playerid, 0xFFFF00AA, "A Google fejlesztes alatt all!");
  42.             return 1;
  43.         }
  44.         if(CheckURL(url, "google.com", true))
  45.         {
  46.             SendClientMessage(playerid, 0xFFFF00AA, "A Google fejlesztes alatt all!");
  47.             return 1;
  48.         }
  49.         if(CheckURL(url, "google.hu", true))
  50.         {
  51.             SendClientMessage(playerid, 0xFFFF00AA, "A Google fejlesztes alatt all!");
  52.             return 1;
  53.         }
  54.         if(CheckURL(url, "http://google.hu", true))
  55.         {
  56.             SendClientMessage(playerid, 0xFFFF00AA, "A Google fejlesztes alatt all!");
  57.             return 1;
  58.         }
  59.         if(CheckURL(url, "http://google.com", true))
  60.         {
  61.             SendClientMessage(playerid, 0xFFFF00AA, "A Google fejlesztes alatt all!");
  62.             return 1;
  63.         }
  64.         if(CheckURL(url, "www.sa-mp.com", true))
  65.         {
  66.             SendClientMessage(playerid, 0xFFFF00AA, "Az igazi SA-MP Webje!");
  67.             return 1;
  68.         }
  69.         if(CheckURL(url, "www.forum.sa-mp.com", true))
  70.         {
  71.             SendClientMessage(playerid, 0xFFFF00AA, "Az igazi SA-MP Forumja!");
  72.             return 1;
  73.         }
  74.         if(CheckURL(url, "sa-mp.com", true))
  75.         {
  76.             SendClientMessage(playerid, 0xFFFF00AA, "Az igazi SA-MP Webje!");
  77.             return 1;
  78.         }
  79.         if(CheckURL(url, "forum.sa-mp.com", true))
  80.         {
  81.             SendClientMessage(playerid, 0xFFFF00AA, "Az igazi SA-MP Forumja!");
  82.             return 1;
  83.         }
  84.         if(CheckURL(url, "Hamarosan!", true))
  85.         {
  86.             SendClientMessage(playerid, 0xFFFF00AA, "Hamarosan csinalok rendes laptopott!");
  87.             return 1;
  88.         }
  89.         return ERROR_404(playerid, url);
  90. }
  91. //---------------------------------------
  92.  
  93. #define COLOR_GREEN     (0x33AA33AA)
  94. #define COLOR_RED               (0xAA3333AA)
  95. #define COLOR_YELLOW    (0xFFFF00AA)
  96.  
  97. new bool: pLaptop[MAX_PLAYERS];
  98. new pMail[MAX_PLAYERS][MAX_PLAYER_NAME];
  99. new pChat[MAX_PLAYERS][MAX_PLAYER_NAME];
  100. new pChatID[MAX_PLAYERS];
  101. new pChatMSG[MAX_PLAYERS][2048];
  102.  
  103. public OnPlayerDisconnect(playerid, reason)
  104. {
  105.         pLaptop[playerid] = false;
  106.         return 1;
  107. }
  108.  
  109. public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
  110. {
  111.         if(newinteriorid == 4 || newinteriorid == 6 || newinteriorid == 18)
  112.         {
  113.             SendClientMessage(playerid, COLOR_YELLOW, "[LAPTOP]: Vegyel laptopot! (/buy-laptop)");
  114.         }
  115.         if((oldinteriorid == 4 || oldinteriorid == 6 || oldinteriorid == 18) && pLaptop[playerid] == false)
  116.         {
  117.             SendClientMessage(playerid, COLOR_YELLOW, "[LAPTOP]: Miert nem vettel laptopot?");
  118.         }
  119.         return 1;
  120. }
  121.  
  122. public OnPlayerCommandText(playerid, cmdtext[])
  123. {
  124.         if(!strcmp("/buy-laptop", cmdtext, true))
  125.         {
  126.             new string[128];
  127.             new int = GetPlayerInterior(playerid);
  128.         if(int == 4 || int == 6 || int == 18 || int == 17)
  129.                 {
  130.                     if(GetPlayerMoney(playerid) >= LAPTOP_MONEY)
  131.                     {
  132.                         if(pLaptop[playerid] == true) return 1;
  133.                         GivePlayerMoney(playerid, GetPlayerMoney(playerid)-LAPTOP_MONEY);
  134.                         pLaptop[playerid] = true;
  135.                         SendClientMessage(playerid, COLOR_GREEN, "[LAPTOP]: Sikeresen vettel egy laptopot! Bekapcsolas:(/bekapcsolas)");
  136.                         } else {
  137.                                 format(string, 128, "[LAPTOP]: Nincs eleg penzed! Egy laptop %d$-ba kerul!", LAPTOP_MONEY);
  138.                         SendClientMessage(playerid, COLOR_RED, string);
  139.                     }
  140.                     } else {
  141.                     SendClientMessage(playerid, COLOR_RED, "[LAPTOP]: Csak 24/7 uzletekben vehetsz laptopot!");
  142.                 }
  143.                 return 1;
  144.         }
  145.         if(!strcmp("/bekapcsolas", cmdtext, true))
  146.         {
  147.             if(pLaptop[playerid] == true)
  148.             {
  149.                 ShowPlayerDialog(playerid, 1, DIALOG_STYLE_MSGBOX, "Betoltes", "Betoltod a Windowst?", "Igen", "Nem");
  150.                 } else {
  151.                 SendClientMessage(playerid, COLOR_RED, "[LAPTOP]: Neked nincs laptopod! Laptopot a 27/4 boltokban tudsz venni!");
  152.                 }
  153.                 return 1;
  154.         }
  155.         return 0;
  156. }
  157.  
  158. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  159. {
  160.         // ---- Fumenu
  161.         if(dialogid == 1)
  162.         {
  163.             if(response)
  164.         {
  165.             ShowPlayerDialog(playerid, 2, DIALOG_STYLE_LIST, "Fomenu - Windows 95:", "Microsoft Office Outlook 1995\nWindows Live Messenger 1.0\nMozilla Firefox", "Kivalaszt", "Kikapcs");
  166.         }
  167.         return 1;
  168.         }
  169.         // ---- Almen?k
  170.         else if(dialogid == 2)
  171.         {
  172.             switch(listitem)
  173.             {
  174.                 case 0: ShowPlayerDialog(playerid, 3, DIALOG_STYLE_INPUT, "Cimzett", "Jatekos neve:", "Ok", "Megse");
  175.                 case 1: ShowPlayerDialog(playerid, 9, DIALOG_STYLE_INPUT, "MSN cim", "Jatekos neve:", "Ok", "Megse");
  176.                 case 2: ShowPlayerDialog(playerid, 7, DIALOG_STYLE_INPUT, "Internet Explorer", "URL:", "Ok", "Megse");
  177.             }
  178.             return 1;
  179.         }
  180.  
  181.         //---- E-mail --------------------------------------------------------------
  182.         else if(dialogid == 3)
  183.         {
  184.             if(response)
  185.         {
  186.                         format(pMail[playerid], MAX_PLAYER_NAME, "%s", inputtext);
  187.                         ShowPlayerDialog(playerid, 4, DIALOG_STYLE_INPUT, "Uzenet szovege", "Ird be az uzenet szoveget:", "Kuldes", "Elvet");
  188.                         } else {
  189.                         ShowPlayerDialog(playerid, 2, DIALOG_STYLE_LIST, "Fomenu - Windows 95", "Microsoft Office Outlook 1995\nWindows Live Messenger 1.0\nMozilla Firefox", "Kivalaszt", "Kikapcs");
  190.                 }
  191.                 return 1;
  192.         }
  193.         else if(dialogid == 4)
  194.         {
  195.             if(response)
  196.             {
  197.                 new string[128], pName[MAX_PLAYER_NAME], giveplayerid;
  198.                 for(new i; i <= MAX_PLAYERS; i++)
  199.                 {
  200.                     GetPlayerName(i, pName, MAX_PLAYER_NAME);
  201.                                 if(strfind(pName, pMail[playerid], false) != -1)
  202.                                 {
  203.                                     giveplayerid = i;
  204.                                     break;
  205.                                 }
  206.                 }
  207.                         GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
  208.                         format(string, 128, "PM fogadva %s (%i): %s", pName, playerid, inputtext);
  209.                         SendClientMessage(giveplayerid, 0xFFFF22AA, string);
  210.                         GetPlayerName(giveplayerid, pName, MAX_PLAYER_NAME);
  211.                         format(string, 128, "PM elkuldve %s (%i): %s", pName, giveplayerid, inputtext);
  212.                         SendClientMessage(playerid, 0xFFCC2299, string);
  213.                         GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~n~~n~~n~~w~PRIVAT UZENET ELKULDVE!", 3000, 3);
  214.                 GameTextForPlayer(giveplayerid, "~n~~n~~n~~n~~n~~n~~n~~n~~n~~w~PRIVAT UZENET FOGADVA", 3000, 3);
  215.                 PlayerPlaySound(playerid, 1057, 0.0, 0.0, 0.0);
  216.                 PlayerPlaySound(giveplayerid, 1057, 0.0, 0.0, 0.0);
  217.                 } else {
  218.                 ShowPlayerDialog(playerid, 5, DIALOG_STYLE_MSGBOX, "Mentes", "Menti a valtozasokat?", "Mentes", "Kilepes");
  219.             }
  220.             return 1;
  221.         }
  222.         else if(dialogid == 5)
  223.         {
  224.             if(response)
  225.             {
  226.                 ShowPlayerDialog(playerid, 6, DIALOG_STYLE_MSGBOX, "Mentes", "Mentes sikertelen!", "Ok", "Megse");
  227.                 } else {
  228.                 ShowPlayerDialog(playerid, 2, DIALOG_STYLE_LIST, "Fomenu - Windows 95", "Microsoft Office Outlook 1995\nWindows Live Messenger 1.0\nMozilla Firefox", "Kivalaszt", "Kikapcs");
  229.             }
  230.             return 1;
  231.         }
  232.         else if(dialogid == 6)
  233.         {
  234.             ShowPlayerDialog(playerid, 2, DIALOG_STYLE_LIST, "Fomenu - Windows 95", "Microsoft Office Outlook 1995\nWindows Live Messenger 1.0\nMozilla Firefox", "Kivalaszt", "Kikapcs");
  235.             return 1;
  236.         }
  237.         //--------------------------------------------------------------------------
  238.         //--------------------------------------------------------------------------
  239.         //---- Internet Explorer ---------------------------------------------------
  240.         else if(dialogid == 7)
  241.         {
  242.             if(response)
  243.             {
  244.                 CallRemoteFunction("InternetBrowser", "ds", playerid, inputtext);
  245.                 } else {
  246.                 ShowPlayerDialog(playerid, 2, DIALOG_STYLE_LIST, "Fomenu - Windows 95", "Microsoft Office Outlook 1995\nWindows Live Messenger 1.0\nMozilla Firefox", "Kivalaszt", "Kikapcs");
  247.             }
  248.             return 1;
  249.         }
  250.         else if(dialogid == 8)
  251.         {
  252.             ShowPlayerDialog(playerid, 7, DIALOG_STYLE_INPUT, "Internet Explorer", "URL:", "Ok", "Megse");
  253.             return 1;
  254.         }
  255.         //--------------------------------------------------------------------------
  256.         //--------------------------------------------------------------------------
  257.         //---- MSN -----------------------------------------------------------------
  258.         else if(dialogid == 9)
  259.         {
  260.             if(response)
  261.             {
  262.                 new pName[MAX_PLAYER_NAME];
  263.                 format(pChat[playerid], MAX_PLAYER_NAME, "%s", inputtext);
  264.                 for(new i; i <= MAX_PLAYERS; i++)
  265.                 {
  266.                                 GetPlayerName(i, pName, MAX_PLAYER_NAME);
  267.                     if(strfind(pName, pChat[playerid], false) != -1)
  268.                     {
  269.                         pChatID[playerid] = i;
  270.                         pChatID[i] = playerid;
  271.                         strdel(pChatMSG[playerid], 0, strlen(pChatMSG[playerid]));
  272.                         strdel(pChatMSG[pChatID[playerid]], 0, strlen(pChatMSG[pChatID[playerid]]));
  273.                         break;
  274.                     }
  275.                 }
  276.                         ShowPlayerDialog(playerid, 10, DIALOG_STYLE_INPUT, "Uzenet szovege", "Ird be az uzenet szoveget:", "Kuldes", "Elvet");
  277.             }
  278.             return 1;
  279.         }
  280.         else if(dialogid == 10)
  281.         {
  282.             if(response)
  283.             {
  284.                 new pName[MAX_PLAYER_NAME];
  285.                 GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
  286.                 format(pChatMSG[playerid], 2048, "%s%s uzenete:\n * %s\n", pChatMSG[pChatID[playerid]], pName, inputtext);
  287.                 ShowPlayerDialog(pChatID[playerid], 11, DIALOG_STYLE_LIST, "Windows Live Messenger", pChatMSG[playerid], "Valasz", "Kilepes");
  288.             }
  289.         }
  290.         else if(dialogid == 11)
  291.         {
  292.             if(response)
  293.             {
  294.                 ShowPlayerDialog(playerid, 12, DIALOG_STYLE_INPUT, "Uzenet szovege", "Ird be az uzenet szoveget:", "Kuldes", "Elvet");
  295.             }
  296.         }
  297.         else if(dialogid == 12)
  298.         {
  299.             if(response)
  300.             {
  301.                 new pName[MAX_PLAYER_NAME];
  302.                 GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
  303.                 format(pChatMSG[playerid], 2048, "%s%s uzenete:\n * %s\n", pChatMSG[pChatID[playerid]], pName, inputtext);
  304.                 ShowPlayerDialog(pChatID[playerid], 13, DIALOG_STYLE_LIST, "Windows Live Messenger", pChatMSG[playerid], "Valasz", "Kilepes");
  305.             }
  306.         }
  307.         else if(dialogid == 13)
  308.         {
  309.             if(response)
  310.             {
  311.                 ShowPlayerDialog(playerid, 10, DIALOG_STYLE_INPUT, "Uzenet szovege", "Ird be az uzenet szoveget:", "Kuldes", "Elvet");
  312.             }
  313.         }
  314.         return 1;
  315. }
  316.  
  317. ERROR_404(playerid, url[])
  318. {
  319.         new string[64];
  320.         format(string, sizeof(string), "%s - 404", url);
  321.     ShowPlayerDialog(playerid, 8, DIALOG_STYLE_MSGBOX, string, "A keresett oldal nem talalhato!", "Ok", "Megse");
  322.     return 1;
  323. }
  324.  
  325. stock CheckURL(string[], url[], bool: search = false)
  326. {
  327.         if(search == false)
  328.         {
  329.                 for(new i; i <= strlen(string); i++)
  330.                 {
  331.                     if(string[i] != url[i])
  332.                     {
  333.                         return false;
  334.                         }
  335.                 }
  336.                 } else {
  337.                 if(strfind(string, url, false) != -1)
  338.                 {
  339.                     return true;
  340.                     } else {
  341.                     return false;
  342.                 }
  343.         }
  344.         return true;
  345. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement