Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #define LAPTOP_MONEY (0) // A laptop ara
- // Internet - webcimek megadasara alkalmas
- public InternetBrowser(playerid, url[]);
- public InternetBrowser(playerid, url[])
- {
- // Pelda:
- if(CheckURL(url, "www.barracuda.co.cc"))
- {
- SendClientMessage(playerid, 0xFFFF00AA, "A Barracuda Szerver Weboldala!");
- return 1;
- }
- // Vagy ha azt akarjuk, hogy a cimet felismerje mas alakban is
- // Ha azt irjak be: http://www.google.hu/ , akkor is talalatot kapjon
- // De itt fenn all a veszely, hogy a felhasznalo mast ir be es akkor is
- // talalatot kap pl.: khm..::www.google.hu::..
- if(CheckURL(url, "www.barracuda.co.cc", true))
- {
- SendClientMessage(playerid, 0xFFFF00AA, "A Barracuda Szerver Weboldala!");
- return 1;
- }
- if(CheckURL(url, "barracuda.co.cc", true))
- {
- SendClientMessage(playerid, 0xFFFF00AA, "A Barracuda Szerver Weboldala!");
- return 1;
- }
- if(CheckURL(url, "http://barracuda.co.cc", true))
- {
- SendClientMessage(playerid, 0xFFFF00AA, "A Barracuda Szerver Weboldala!");
- return 1;
- }
- if(CheckURL(url, "www.google.com", true))
- {
- SendClientMessage(playerid, 0xFFFF00AA, "A Google fejlesztes alatt all!");
- return 1;
- }
- if(CheckURL(url, "www.google.hu", true))
- {
- SendClientMessage(playerid, 0xFFFF00AA, "A Google fejlesztes alatt all!");
- return 1;
- }
- if(CheckURL(url, "google.com", true))
- {
- SendClientMessage(playerid, 0xFFFF00AA, "A Google fejlesztes alatt all!");
- return 1;
- }
- if(CheckURL(url, "google.hu", true))
- {
- SendClientMessage(playerid, 0xFFFF00AA, "A Google fejlesztes alatt all!");
- return 1;
- }
- if(CheckURL(url, "http://google.hu", true))
- {
- SendClientMessage(playerid, 0xFFFF00AA, "A Google fejlesztes alatt all!");
- return 1;
- }
- if(CheckURL(url, "http://google.com", true))
- {
- SendClientMessage(playerid, 0xFFFF00AA, "A Google fejlesztes alatt all!");
- return 1;
- }
- if(CheckURL(url, "www.sa-mp.com", true))
- {
- SendClientMessage(playerid, 0xFFFF00AA, "Az igazi SA-MP Webje!");
- return 1;
- }
- if(CheckURL(url, "www.forum.sa-mp.com", true))
- {
- SendClientMessage(playerid, 0xFFFF00AA, "Az igazi SA-MP Forumja!");
- return 1;
- }
- if(CheckURL(url, "sa-mp.com", true))
- {
- SendClientMessage(playerid, 0xFFFF00AA, "Az igazi SA-MP Webje!");
- return 1;
- }
- if(CheckURL(url, "forum.sa-mp.com", true))
- {
- SendClientMessage(playerid, 0xFFFF00AA, "Az igazi SA-MP Forumja!");
- return 1;
- }
- if(CheckURL(url, "Hamarosan!", true))
- {
- SendClientMessage(playerid, 0xFFFF00AA, "Hamarosan csinalok rendes laptopott!");
- return 1;
- }
- return ERROR_404(playerid, url);
- }
- //---------------------------------------
- #define COLOR_GREEN (0x33AA33AA)
- #define COLOR_RED (0xAA3333AA)
- #define COLOR_YELLOW (0xFFFF00AA)
- new bool: pLaptop[MAX_PLAYERS];
- new pMail[MAX_PLAYERS][MAX_PLAYER_NAME];
- new pChat[MAX_PLAYERS][MAX_PLAYER_NAME];
- new pChatID[MAX_PLAYERS];
- new pChatMSG[MAX_PLAYERS][2048];
- public OnPlayerDisconnect(playerid, reason)
- {
- pLaptop[playerid] = false;
- return 1;
- }
- public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
- {
- if(newinteriorid == 4 || newinteriorid == 6 || newinteriorid == 18)
- {
- SendClientMessage(playerid, COLOR_YELLOW, "[LAPTOP]: Vegyel laptopot! (/buy-laptop)");
- }
- if((oldinteriorid == 4 || oldinteriorid == 6 || oldinteriorid == 18) && pLaptop[playerid] == false)
- {
- SendClientMessage(playerid, COLOR_YELLOW, "[LAPTOP]: Miert nem vettel laptopot?");
- }
- return 1;
- }
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- if(!strcmp("/buy-laptop", cmdtext, true))
- {
- new string[128];
- new int = GetPlayerInterior(playerid);
- if(int == 4 || int == 6 || int == 18 || int == 17)
- {
- if(GetPlayerMoney(playerid) >= LAPTOP_MONEY)
- {
- if(pLaptop[playerid] == true) return 1;
- GivePlayerMoney(playerid, GetPlayerMoney(playerid)-LAPTOP_MONEY);
- pLaptop[playerid] = true;
- SendClientMessage(playerid, COLOR_GREEN, "[LAPTOP]: Sikeresen vettel egy laptopot! Bekapcsolas:(/bekapcsolas)");
- } else {
- format(string, 128, "[LAPTOP]: Nincs eleg penzed! Egy laptop %d$-ba kerul!", LAPTOP_MONEY);
- SendClientMessage(playerid, COLOR_RED, string);
- }
- } else {
- SendClientMessage(playerid, COLOR_RED, "[LAPTOP]: Csak 24/7 uzletekben vehetsz laptopot!");
- }
- return 1;
- }
- if(!strcmp("/bekapcsolas", cmdtext, true))
- {
- if(pLaptop[playerid] == true)
- {
- ShowPlayerDialog(playerid, 1, DIALOG_STYLE_MSGBOX, "Betoltes", "Betoltod a Windowst?", "Igen", "Nem");
- } else {
- SendClientMessage(playerid, COLOR_RED, "[LAPTOP]: Neked nincs laptopod! Laptopot a 27/4 boltokban tudsz venni!");
- }
- return 1;
- }
- return 0;
- }
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
- {
- // ---- Fumenu
- if(dialogid == 1)
- {
- if(response)
- {
- ShowPlayerDialog(playerid, 2, DIALOG_STYLE_LIST, "Fomenu - Windows 95:", "Microsoft Office Outlook 1995\nWindows Live Messenger 1.0\nMozilla Firefox", "Kivalaszt", "Kikapcs");
- }
- return 1;
- }
- // ---- Almen?k
- else if(dialogid == 2)
- {
- switch(listitem)
- {
- case 0: ShowPlayerDialog(playerid, 3, DIALOG_STYLE_INPUT, "Cimzett", "Jatekos neve:", "Ok", "Megse");
- case 1: ShowPlayerDialog(playerid, 9, DIALOG_STYLE_INPUT, "MSN cim", "Jatekos neve:", "Ok", "Megse");
- case 2: ShowPlayerDialog(playerid, 7, DIALOG_STYLE_INPUT, "Internet Explorer", "URL:", "Ok", "Megse");
- }
- return 1;
- }
- //---- E-mail --------------------------------------------------------------
- else if(dialogid == 3)
- {
- if(response)
- {
- format(pMail[playerid], MAX_PLAYER_NAME, "%s", inputtext);
- ShowPlayerDialog(playerid, 4, DIALOG_STYLE_INPUT, "Uzenet szovege", "Ird be az uzenet szoveget:", "Kuldes", "Elvet");
- } else {
- ShowPlayerDialog(playerid, 2, DIALOG_STYLE_LIST, "Fomenu - Windows 95", "Microsoft Office Outlook 1995\nWindows Live Messenger 1.0\nMozilla Firefox", "Kivalaszt", "Kikapcs");
- }
- return 1;
- }
- else if(dialogid == 4)
- {
- if(response)
- {
- new string[128], pName[MAX_PLAYER_NAME], giveplayerid;
- for(new i; i <= MAX_PLAYERS; i++)
- {
- GetPlayerName(i, pName, MAX_PLAYER_NAME);
- if(strfind(pName, pMail[playerid], false) != -1)
- {
- giveplayerid = i;
- break;
- }
- }
- GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
- format(string, 128, "PM fogadva %s (%i): %s", pName, playerid, inputtext);
- SendClientMessage(giveplayerid, 0xFFFF22AA, string);
- GetPlayerName(giveplayerid, pName, MAX_PLAYER_NAME);
- format(string, 128, "PM elkuldve %s (%i): %s", pName, giveplayerid, inputtext);
- SendClientMessage(playerid, 0xFFCC2299, string);
- GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~n~~n~~n~~w~PRIVAT UZENET ELKULDVE!", 3000, 3);
- GameTextForPlayer(giveplayerid, "~n~~n~~n~~n~~n~~n~~n~~n~~n~~w~PRIVAT UZENET FOGADVA", 3000, 3);
- PlayerPlaySound(playerid, 1057, 0.0, 0.0, 0.0);
- PlayerPlaySound(giveplayerid, 1057, 0.0, 0.0, 0.0);
- } else {
- ShowPlayerDialog(playerid, 5, DIALOG_STYLE_MSGBOX, "Mentes", "Menti a valtozasokat?", "Mentes", "Kilepes");
- }
- return 1;
- }
- else if(dialogid == 5)
- {
- if(response)
- {
- ShowPlayerDialog(playerid, 6, DIALOG_STYLE_MSGBOX, "Mentes", "Mentes sikertelen!", "Ok", "Megse");
- } else {
- ShowPlayerDialog(playerid, 2, DIALOG_STYLE_LIST, "Fomenu - Windows 95", "Microsoft Office Outlook 1995\nWindows Live Messenger 1.0\nMozilla Firefox", "Kivalaszt", "Kikapcs");
- }
- return 1;
- }
- else if(dialogid == 6)
- {
- ShowPlayerDialog(playerid, 2, DIALOG_STYLE_LIST, "Fomenu - Windows 95", "Microsoft Office Outlook 1995\nWindows Live Messenger 1.0\nMozilla Firefox", "Kivalaszt", "Kikapcs");
- return 1;
- }
- //--------------------------------------------------------------------------
- //--------------------------------------------------------------------------
- //---- Internet Explorer ---------------------------------------------------
- else if(dialogid == 7)
- {
- if(response)
- {
- CallRemoteFunction("InternetBrowser", "ds", playerid, inputtext);
- } else {
- ShowPlayerDialog(playerid, 2, DIALOG_STYLE_LIST, "Fomenu - Windows 95", "Microsoft Office Outlook 1995\nWindows Live Messenger 1.0\nMozilla Firefox", "Kivalaszt", "Kikapcs");
- }
- return 1;
- }
- else if(dialogid == 8)
- {
- ShowPlayerDialog(playerid, 7, DIALOG_STYLE_INPUT, "Internet Explorer", "URL:", "Ok", "Megse");
- return 1;
- }
- //--------------------------------------------------------------------------
- //--------------------------------------------------------------------------
- //---- MSN -----------------------------------------------------------------
- else if(dialogid == 9)
- {
- if(response)
- {
- new pName[MAX_PLAYER_NAME];
- format(pChat[playerid], MAX_PLAYER_NAME, "%s", inputtext);
- for(new i; i <= MAX_PLAYERS; i++)
- {
- GetPlayerName(i, pName, MAX_PLAYER_NAME);
- if(strfind(pName, pChat[playerid], false) != -1)
- {
- pChatID[playerid] = i;
- pChatID[i] = playerid;
- strdel(pChatMSG[playerid], 0, strlen(pChatMSG[playerid]));
- strdel(pChatMSG[pChatID[playerid]], 0, strlen(pChatMSG[pChatID[playerid]]));
- break;
- }
- }
- ShowPlayerDialog(playerid, 10, DIALOG_STYLE_INPUT, "Uzenet szovege", "Ird be az uzenet szoveget:", "Kuldes", "Elvet");
- }
- return 1;
- }
- else if(dialogid == 10)
- {
- if(response)
- {
- new pName[MAX_PLAYER_NAME];
- GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
- format(pChatMSG[playerid], 2048, "%s%s uzenete:\n * %s\n", pChatMSG[pChatID[playerid]], pName, inputtext);
- ShowPlayerDialog(pChatID[playerid], 11, DIALOG_STYLE_LIST, "Windows Live Messenger", pChatMSG[playerid], "Valasz", "Kilepes");
- }
- }
- else if(dialogid == 11)
- {
- if(response)
- {
- ShowPlayerDialog(playerid, 12, DIALOG_STYLE_INPUT, "Uzenet szovege", "Ird be az uzenet szoveget:", "Kuldes", "Elvet");
- }
- }
- else if(dialogid == 12)
- {
- if(response)
- {
- new pName[MAX_PLAYER_NAME];
- GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
- format(pChatMSG[playerid], 2048, "%s%s uzenete:\n * %s\n", pChatMSG[pChatID[playerid]], pName, inputtext);
- ShowPlayerDialog(pChatID[playerid], 13, DIALOG_STYLE_LIST, "Windows Live Messenger", pChatMSG[playerid], "Valasz", "Kilepes");
- }
- }
- else if(dialogid == 13)
- {
- if(response)
- {
- ShowPlayerDialog(playerid, 10, DIALOG_STYLE_INPUT, "Uzenet szovege", "Ird be az uzenet szoveget:", "Kuldes", "Elvet");
- }
- }
- return 1;
- }
- ERROR_404(playerid, url[])
- {
- new string[64];
- format(string, sizeof(string), "%s - 404", url);
- ShowPlayerDialog(playerid, 8, DIALOG_STYLE_MSGBOX, string, "A keresett oldal nem talalhato!", "Ok", "Megse");
- return 1;
- }
- stock CheckURL(string[], url[], bool: search = false)
- {
- if(search == false)
- {
- for(new i; i <= strlen(string); i++)
- {
- if(string[i] != url[i])
- {
- return false;
- }
- }
- } else {
- if(strfind(string, url, false) != -1)
- {
- return true;
- } else {
- return false;
- }
- }
- return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement