Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- _________________________________________________
- | Scriptname : Haus-System |
- | Version : 1.0 |
- | |
- | Eine Produktion vom Script SAMP-Hilfe.de Team |
- | |
- | Erstellt am: 25.05.2011 |
- | Mapname: - |
- | |
- | Hauptscripter: SAMP-Hilfe |
- | Co-Scripter: - |
- | Tester: DaveAdU + VitO + Erdal |
- | |
- | Info: |
- | Bitte die Copyriht drine lassen ! |
- | |
- |_________________________________________________|
- | |
- | Herstellerseite: www.SAMP-Hilfe.de |
- | ICQ Messenger: 317-105-176 |
- | |
- | Copyright 2011 by SAMP-Hilfe |
- |_________________________________________________|
- */
- #include <a_samp>
- #include <dini>
- #include <dudb>
- //#include <MapIconStreamer>
- #include <nIcons>
- #pragma unused strtok
- #pragma unused ret_memcpy
- #pragma unused nIconAddForAll
- forward OnPlayerHouse();
- new point;
- enum PLAYER_PARAMS
- {
- HouseArea
- }
- new PlayerParameters[MAX_PLAYERS][PLAYER_PARAMS];
- #define MAX_HOUSES 55
- new HouseInfo[MAX_HOUSES];
- new InfoPoint[MAX_HOUSES][256];
- new H_Icon[MAX_PLAYERS][MAX_HOUSES];
- new pCP[MAX_PLAYERS];
- new Menu:menu;
- new hmode[MAX_PLAYERS];
- new InHouse[MAX_PLAYERS];
- //new HouseCP[MAX_HOUSES];
- new IsIcon[MAX_PLAYERS][MAX_HOUSES];
- new Float:hPos[MAX_PLAYERS][3];
- #define GREEN 0x33AA33AA
- #define RED 0xAA3333AA
- #define COLOR_LIGHTRED 0xFF0000AA
- #define COLOR_YELLOW 0xFFFF00AA
- #define WHITE 0xFFFFFFAA
- forward SpawnAtHouse(playerid);
- public OnFilterScriptInit()
- {
- print("+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+");
- print("+~ Haus System by SAMP-Hilfe ~+");
- print("+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+");
- nIconsInit();
- SetTimer("OnPlayerHouse", 800, 1);
- menu = CreateMenu("Zuhause", 2, 200.0, 100.0, 150.0, 150.0);
- AddMenuItem(menu, 0, "Essen");
- AddMenuItem(menu, 0, "Trinken");
- AddMenuItem(menu, 0, "Schutzweste");
- AddMenuItem(menu, 0, "Sawnoff holen");
- AddMenuItem(menu, 0, "M4 holen");
- AddMenuItem(menu, 0, "Tec9 holen");
- AddMenuItem(menu, 0, "Messer holen");
- AddMenuItem(menu, 0, "Menu verlassen");
- return 1;
- }
- stock HouseCheckpointUpdate(playerid)
- { // X Y Z intX intY intZ Name Preis - ID CP int v score
- // ============================ [Ganton] ================================ //
- AddHouse(playerid,2498.4651,-1643.4498,13.7826, 244.4119,305.0329,999.1484, "Nr. 1", 80000, true, 0, 5/2, 1, 1, 400); // Ganton Haus, Klein
- AddHouse(playerid,2512.8579,-1650.8561,14.0938, 271.8849,306.6319,999.1484, "Nr. 2", 90000, true, 1, 5/2, 2, 2, 450); // Ganton Haus, Klein
- AddHouse(playerid,2413.7310,-1647.5107,13.7500, 244.4119,305.0329,999.1484, "Nr. 3", 85000, true, 2, 5/2, 1, 3, 600); // Ganton Haus, Klein
- AddHouse(playerid,2362.7473,-1643.7504,14.0596, 271.8849,306.6319,999.1484, "Nr. 4", 100000, true, 3, 5/2, 2, 4, 550); // Ganton Haus, Klein
- AddHouse(playerid,2308.7966,-1715.1124,14.6496, 244.4119,305.0329,999.1484, "Nr. 5", 95000, true, 4, 5/2, 1, 5, 490); // Ganton Haus, Klein
- // ========================== [Idlewood] ================================ //
- AddHouse(playerid,2142.6399,-1605.8600,14.3516, 244.4119,305.0329,999.1484, "Nr. 6", 120000, true, 5, 5/2, 1, 6, 600); // Idlewood Wohnung, Klein
- AddHouse(playerid,2140.6243,-1652.0769,15.0859, 244.4119,305.0329,999.1484, "Nr. 7", 180000, true, 6, 5/2, 1, 7, 820); // Idlewood Wohnung, Klein
- AddHouse(playerid,2016.3441,-1629.8438,13.5469, 271.8849,306.6319,999.1484, "Nr. 8", 1100000, true, 7, 5/2, 2, 8, 570); // Idlewood Haus, Klein
- // ========================== [El Corona] =============================== //
- AddHouse(playerid,1937.2717,-1911.5787,15.2568, 244.4119,305.0329,999.1484, "Nr. 9", 140000, true, 8, 5/2, 1, 9, 680); // El Corona Haus, Klein
- AddHouse(playerid,1892.0405,-1916.1093,15.2568, 271.8849,306.6319,999.1484, "Nr. 10", 150000, true, 9, 5/2, 2, 10, 700); // El Corona Haus, Klein
- AddHouse(playerid,1854.2461,-1915.4453,15.2568, 244.4119,305.0329,999.1484, "Nr. 11", 170000, true, 10, 5/2, 1, 11, 770); // El Corona Haus, Klein
- // ========================= [Verona Beach] ============================= //
- AddHouse(playerid,865.1669,-1634.8881,14.9297, 290.4616,1475.1036,1080.2578, "Nr. 12", 180000, true, 11, 5/2, 15, 12, 780); // Verona Beach Wohung, Mittel
- AddHouse(playerid,798.1665,-1728.9434,13.5469, 2454.7170,-1700.8715,1013.5151, "Nr. 13", 190000, true, 12, 5/2, 2, 13, 880); // Verona Beach Haus, Mittel
- AddHouse(playerid,795.0920,-1691.1942,14.4633, 2324.4199,-1145.5683,1050.7100, "Nr. 14", 200000, true, 13, 5/2, 12, 14, 650); // Verona Beach Haus, Mittel
- AddHouse(playerid,305.3226,-1771.3724,4.5383, 245.8472,304.7715,999.1484, "Nr. 15", 220000, true, 14, 5/2, 1, 15, 820); // Verona Beach Haus, Klein
- AddHouse(playerid,280.9468,-1768.6292,4.5159, 2454.7170,-1700.8715,1013.5151, "Nr. 16", 240000, true, 15, 5/2, 2, 16, 900); // Verona Beach Haus, Mittel
- AddHouse(playerid,206.9534,-1770.4280,4.3414, 235.508994,1189.169897,1080.339966, "Nr. 17", 300000, true, 16, 5/2, 3, 17, 1000); // Verona Beach Haus, Groß
- AddHouse(playerid,168.2644,-1769.2476,4.4744, 225.630997,1022.479980,1084.069946, "Nr. 18", 350000, true, 17, 5/2, 7, 18, 1100); // Verona Beach Haus, Groß
- // ============================ [Marina] ================================ //
- AddHouse(playerid,656.9088,-1652.3427,15.4063, 2454.7170,-1700.8715,1013.5151, "Nr. 19", 195000, true, 18, 5/2, 2, 19, 760); // Marina Haus, Mittel
- AddHouse(playerid,693.2025,-1601.8683,15.0469, 2324.4199,-1145.5683,1050.7100, "Nr. 20", 186000, true, 19, 5/2, 12, 20, 840); // Marina Haus, Mittel
- AddHouse(playerid,694.0329,-1705.7675,3.8195, 2454.7170,-1700.8715,1013.5151, "Nr. 21", 192000, true, 20, 5/2, 2, 21, 710); // Marina Haus, Mittel
- // =========================== [Vinewood] =============================== //
- AddHouse(playerid,297.7927,-1337.0178,53.4415, 235.508994,1189.169897,1080.339966, "Nr. 22", 310000, true, 21, 5/2, 3, 22, 1050); // Vinewood Haus, Groß
- AddHouse(playerid,397.9923,-1271.4000,50.0198, 225.630997,1022.479980,1084.069946, "Nr. 23", 320000, true, 22, 5/2, 7, 23, 1200); // Vinewood Haus, Groß
- AddHouse(playerid,431.6050,-1252.6893,51.5809, 235.508994,1189.169897,1080.339966, "Nr. 24", 315000, true, 23, 5/2, 3, 24, 1300); // Vinewood Haus, Groß
- AddHouse(playerid,552.8708,-1200.1661,44.8315, 225.630997,1022.479980,1084.069946, "Nr. 25", 330000, true, 24, 5/2, 7, 25, 1150); // Vinewood Haus, Groß
- AddHouse(playerid,497.5518,-1094.4314,82.3592, 235.508994,1189.169897,1080.339966, "Nr. 26", 350000, true, 25, 5/2, 3, 26, 1250); // Vinewood Haus, Groß
- AddHouse(playerid,724.9747,-998.1309,52.7344, 225.630997,1022.479980,1084.069946, "Nr. 27", 340000, true, 26, 5/2, 7, 27, 1350); // Vinewood Haus, Groß
- AddHouse(playerid,909.8192,-816.4182,103.1260, 235.508994,1189.169897,1080.339966, "Nr. 28", 320000, true, 27, 5/2, 3, 28, 1400); // Vinewood Haus, Groß
- AddHouse(playerid,1093.7415,-805.5349,107.4189, 225.630997,1022.479980,1084.069946, "Nr. 29", 360000, true, 28, 5/2, 7, 29, 1150); // Vinewood Haus, Groß
- AddHouse(playerid,898.7935,-677.9189,116.8904, 235.508994,1189.169897,1080.339966, "Nr. 30", 370000, true, 29, 5/2, 3, 30, 1500); // Vinewood Haus, Groß
- AddHouse(playerid,868.1270,-716.3992,105.6797, 225.630997,1022.479980,1084.069946, "Nr. 31", 380000, true, 30, 5/2, 7, 31, 1550); // Vinewood Haus, Groß
- AddHouse(playerid,848.7702,-745.1958,94.9693, 235.508994,1189.169897,1080.339966, "Nr. 32", 300000, true, 31, 5/2, 3, 32, 1600); // Vinewood Haus, Groß
- AddHouse(playerid,809.3463,-758.9326,76.5314, 225.630997,1022.479980,1084.069946, "Nr. 33", 390000, true, 32, 5/2, 7, 33, 1100); // Vinewood Haus, Groß
- // ========================= [Mullholland] ============================== //
- AddHouse(playerid,1248.3545,-877.4985,46.6406, 295.1389,1474.4699,1080.5198, "Nr. 34", 150000, true, 33, 5/2, 15, 34, 660); // Mullholland Wohung, Mittel
- AddHouse(playerid,1290.5410,-897.0990,46.6251, 385.8039,1471.7698,1080.2099, "Nr. 35", 133000, true, 34, 5/2, 15, 35, 590); // Mullholland Wohung, Mittel
- // ======================= [Playa de Seville] =========================== //
- AddHouse(playerid,2802.8972,-1963.0831,13.5469, 244.4119,305.0329,999.1484, "Nr. 36", 122000, true, 35, 5/2, 1, 36, 610); // Playa de Seville Wohung, klein
- // ========================= [Willowfield] ============================== //
- AddHouse(playerid,2333.2524,-1944.5338,14.9688, 244.4119,305.0329,999.1484, "Nr. 37", 85000, true, 36, 5/2, 1, 37, 440); // Willowfield Wohung, klein
- AddHouse(playerid,2296.5334,-1883.3855,14.2344, 271.8849,306.6319,999.1484, "Nr. 38", 91000, true, 37, 5/2, 2, 38, 500); // Willowfield Wohung, klein
- AddHouse(playerid,2261.4285,-1905.9822,14.9375, 244.4119,305.0329,999.1484, "Nr. 39", 87000, true, 38, 5/2, 1, 39, 490); // Willowfield Wohung, klein
- AddHouse(playerid,2241.8647,-1882.9817,14.2344, 271.8849,306.6319,999.1484, "Nr. 40", 99000, true, 39, 5/2, 2, 40, 390); // Willowfield Wohung, klein
- // ========================= [Las Colinas] ============================== //
- AddHouse(playerid,2043.9211,-966.1533,43.7993, 2454.7170,-1700.8715,1013.5151, "Nr. 41", 285000, true, 40, 5/2, 2, 41, 640); // Las Colinas Haus, Mittel
- AddHouse(playerid,2122.6895,-970.0249,58.2074, 271.8849,306.6319,999.1484, "Nr. 42", 87000, true, 41, 5/2, 2, 42, 770); // Las Colinas Haus, Klein
- AddHouse(playerid,2260.4504,-1019.9237,59.2901, 2324.4199,-1145.5683,1050.7100, "Nr. 43", 88000, true, 42, 5/2, 12, 43, 650); // Las Colinas Haus, Mittel
- AddHouse(playerid,2287.6318,-1080.5319,47.7299, 244.4119,305.0329,999.1484, "Nr. 44", 90000, true, 43, 5/2, 1, 44, 910); // Las Colinas Haus, Klein
- AddHouse(playerid,2335.3860,-1044.3040,52.3582, 271.8849,306.6319,999.1484, "Nr. 45", 76000, true, 44, 5/2, 2, 45, 700); // Las Colinas Haus, Klein
- AddHouse(playerid,2373.0625,-1052.2159,54.1343, 244.4119,305.0329,999.1484, "Nr. 46", 74000, true, 45, 5/2, 1, 46, 550); // Las Colinas Haus, Klein
- AddHouse(playerid,2389.4150,-1037.9227,53.5661, 271.8849,306.6319,999.1484, "Nr. 47", 69000, true, 46, 5/2, 2, 47, 610); // Las Colinas Haus, Klein
- AddHouse(playerid,2440.3816,-1056.5548,54.7387, 244.4119,305.0329,999.1484, "Nr. 48", 98000, true, 47, 5/2, 1, 48, 760); // Las Colinas Haus, Klein
- AddHouse(playerid,2440.4692,-1010.7724,54.3438, 271.8849,306.6319,999.1484, "Nr. 49", 77000, true, 48, 5/2, 2, 49, 520); // Las Colinas Haus, Klein
- AddHouse(playerid,2478.8416,-1063.2539,66.8359, 244.4119,305.0329,999.1484, "Nr. 50", 89000, true, 49, 5/2, 1, 50, 430); // Las Colinas Haus, Klein
- AddHouse(playerid,2560.4478,-1034.3489,69.5742, 271.8849,306.6319,999.1484, "Nr. 51", 100000, true, 50, 5/2, 2, 51, 410); // Las Colinas Haus, Klein
- AddHouse(playerid,2629.0369,-1068.2804,69.6141, 2454.7170,-1700.8715,1013.5151, "Nr. 52", 59000, true, 51, 5/2, 2, 52, 999); // Las Colinas Haus, Mittel
- AddHouse(playerid,2626.8401,-1098.6176,69.3709, 2324.4199,-1145.5683,1050.7100, "Nr. 53", 301000, true, 52, 5/2, 12, 53, 1100); // Las Colinas Haus, Mittel
- hmode[playerid]=1;
- return 1;
- }
- stock AddHouse(playerid, Float:x, Float:y, Float:z, Float:ix, Float:iy, Float:iz, name[], preis, bool:kaufbar, houseid, cpsize, interiorid, vwid, score)
- {
- if(hmode[playerid]==0)
- {
- if(!fexist(HouseFile(houseid)))
- {
- dini_Create(HouseFile(houseid));
- dini_Set(HouseFile(houseid), "Name", name);
- dini_IntSet(HouseFile(houseid), "Preis", preis);
- dini_FloatSet(HouseFile(houseid), "x", x);
- dini_FloatSet(HouseFile(houseid), "y", y);
- dini_FloatSet(HouseFile(houseid), "z", z);
- dini_FloatSet(HouseFile(houseid), "ix", ix);
- dini_FloatSet(HouseFile(houseid), "iy", iy);
- dini_FloatSet(HouseFile(houseid), "iz", iz);
- dini_IntSet(HouseFile(houseid), "InteriorID", interiorid);
- dini_IntSet(HouseFile(houseid), "VirtualWorld", vwid);
- dini_IntSet(HouseFile(houseid), "Score", score);
- if(kaufbar)
- {
- dini_IntSet(HouseFile(houseid), "Kaufbar", 1);
- //H_Icon = CreateMapIcon(31, GREEN, dini_Int(HouseFile(houseid), "x"), dini_Int(HouseFile(houseid), "y"), dini_Int(HouseFile(houseid), "z"));
- } else {
- dini_IntSet(HouseFile(houseid), "Kaufbar", 0);
- // H_Icon = CreateMapIcon(32, RED, dini_Int(HouseFile(houseid), "x"), dini_Int(HouseFile(houseid), "y"), dini_Int(HouseFile(houseid), "z"));
- }
- }
- //new Float:xp, Float:yp, Float:zp;
- //GetPlayerPos(playerid, xp, yp, zp);
- /*if(PlayerToPoint(7, playerid, x,y,z))
- {
- PlayerParameters[playerid][HouseArea]=houseid;
- HouseInfo[houseid]=1;
- if(!IsPlayerInCheckpoint(playerid)) point = SetPlayerCheckpoint(playerid, x, y, z, cpsize);
- } else if(PlayerParameters[playerid][HouseArea]==houseid)
- {
- DisablePlayerCheckpoint(playerid);
- PlayerParameters[playerid][HouseArea]=-1;
- HouseInfo[houseid]=0;
- }*/
- //HouseCP[houseid] = CPS_AddCheckpoint(x,y,z,cpsize,7);
- //if(/*GetDistanceBetweenTwoPoints(x,y, xp,yp) < 40)*/PlayerToPoint(70, playerid, x, y, z))
- //{
- //if(PlayerParameters[playerid][HouseArea]!=houseid)
- //{
- //SetPlayerCheckpoint(playerid, x, y, z, cpsize);
- //PlayerParameters[playerid][HouseArea]=houseid;
- /*if(kaufbar)
- {
- H_Icon = CreateMapIcon(31, GREEN, dini_Int(HouseFile(houseid), "x"), dini_Int(HouseFile(houseid), "y"), dini_Int(HouseFile(houseid), "z"));
- } else {
- H_Icon = CreateMapIcon(32, RED, dini_Int(HouseFile(houseid), "x"), dini_Int(HouseFile(houseid), "y"), dini_Int(HouseFile(houseid), "z"));
- }*/
- /*DestroyMapIcon(H_Icon[houseid]);
- if(dini_Int(HouseFile(houseid), "Kaufbar") == 0)
- {
- H_Icon[houseid] = CreateMapIcon(32, RED, dini_Int(HouseFile(houseid), "x"), dini_Int(HouseFile(houseid), "y"), dini_Int(HouseFile(houseid), "z"));
- } else {
- H_Icon[houseid] = CreateMapIcon(31, GREEN, dini_Int(HouseFile(houseid), "x"), dini_Int(HouseFile(houseid), "y"), dini_Int(HouseFile(houseid), "z"));
- }*/
- if(IsIcon[playerid][houseid] == 0)
- {
- H_Icon[playerid][houseid] = nIconAddForPlayer(playerid,x,y,z,31);
- IsIcon[playerid][houseid] = 1;
- }
- if(dini_Int(HouseFile(houseid), "Kaufbar") == 1)
- {
- nIconDestroy(playerid,H_Icon[playerid][houseid]);
- nIconAddForPlayer(playerid,x,y,z,31);
- } else //ChangeMapIconInfo(playerid,H_Icon[playerid][houseid], x,y,z, 31, 800);
- if(dini_Int(HouseFile(houseid), "Kaufbar") == 0)
- {
- //ChangeMapIconInfo(playerid,H_Icon[playerid][houseid], x,y,z, 32, 800);
- nIconDestroy(playerid,H_Icon[playerid][houseid]);
- nIconAddForPlayer(playerid,x,y,z,32);
- }
- // }
- /*} else //if(PlayerParameters[playerid][HouseArea]==houseid)
- {
- //PlayerParameters[playerid][HouseArea]=-1;
- //DisablePlayerCheckpoint(playerid);
- DestroyMapIcon(H_Icon[houseid]);
- }*/
- HouseInfo[houseid]=1;
- } else {
- if(PlayerToPoint(7, playerid, x,y,z))
- {
- PlayerParameters[playerid][HouseArea]=houseid;
- HouseInfo[houseid]=1;
- if(!IsPlayerInCheckpoint(playerid)) point = SetPlayerCheckpoint(playerid, x, y, z, cpsize);
- } else if(PlayerParameters[playerid][HouseArea]==houseid)
- {
- DisablePlayerCheckpoint(playerid);
- PlayerParameters[playerid][HouseArea]=-1;
- HouseInfo[houseid]=0;
- }
- }
- return 1;
- }
- stock HouseFile(house)
- {
- new string[256];
- format(string, sizeof(string), "/HSystem/%d.house", house);
- return string;
- }
- stock PlayerFile(playerid)
- {
- new string[256];
- format(string,sizeof(string), "/HSystem/User/%s.owner", Playername(playerid));
- return string;
- }
- stock GetDistanceBetweenTwoPoints(Float:x,Float:y, Float:x1,Float:y1)
- {
- new Float:tmpdis;
- tmpdis = floatsqroot(floatpower(floatabs(floatsub(x,x1)),2)+floatpower(floatabs(floatsub(y,y1)),2));
- return floatround(tmpdis);
- }
- stock SendPlayerText(playerid, const text[])
- {
- return SendClientMessage(playerid, 0xFFFF00FF, text);
- }
- stock SendClientText(playerid, const text[])
- {
- return SendClientMessage(playerid, COLOR_YELLOW, text);
- }
- stock SendErrorText(playerid, const text[])
- {
- return SendClientMessage(playerid, WHITE, text);
- }
- stock GetPlayerid(name[])
- {
- for (new i = 0; i < MAX_PLAYERS; i++)
- {
- if (IsPlayerConnected(i))
- {
- if(strcmp(Playername(i), name, true) == 0)
- {
- return i;
- }
- }
- }
- return INVALID_PLAYER_ID;
- }
- stock Playername(playerid) {
- new name[MAX_PLAYER_NAME];
- GetPlayerName(playerid, name, MAX_PLAYER_NAME);
- return name;
- }
- stock str(value)
- {
- new string[256];
- format(string, sizeof(string), "%d", value);
- return string;
- }
- public OnPlayerEnterCheckpoint(playerid)
- {/*
- new houseid;
- new CP = CPS_GetPlayerCheckpoint(playerid);
- //for(new i = 0; i<MAX_HOUSES; i++)
- //{
- //if(CP == HouseCP[i])
- //{
- houseid = HouseCP[CP];
- new string[256];
- // new string[256], houseid;
- // houseid=PlayerParameters[playerid][HouseArea];
- if(HouseInfo[houseid]==1)
- {
- if(dini_Int(HouseFile(houseid), "Kaufbar") == 1){
- SendPlayerText(playerid, "[INFO] Haus steht zum Verkauf !");
- format(string, sizeof(string), "Preis: %d | Score: %d", dini_Int(HouseFile(houseid), "Preis"), dini_Int(HouseFile(houseid), "Score"));
- SendPlayerText(playerid, string);
- format(string, sizeof(string), "Haus: %s", dini_Get(HouseFile(houseid), "Name"));
- SendPlayerText(playerid, string);
- SendPlayerText(playerid, "Befehl: /kaufen");
- }
- if(dini_Isset(HouseFile(houseid), "Besitzer"))
- {
- format(string, sizeof(string), "Haus: %s", dini_Get(HouseFile(houseid), "Name"));
- SendPlayerText(playerid, string);
- format(string, sizeof(string), "Besitzer: %s", dini_Get(HouseFile(houseid), "Besitzer"));
- SendPlayerText(playerid, string);
- }
- } else if(HouseInfo[houseid]==2)
- {
- SendPlayerText(playerid, InfoPoint[houseid]);
- }
- // }
- //}
- */
- new string[256], houseid;
- houseid=PlayerParameters[playerid][HouseArea];
- if(HouseInfo[houseid]==1)
- {
- if(dini_Int(HouseFile(houseid), "Kaufbar") == 1){
- format(string, sizeof(string), "== Du kannst Haus %s für %d $ & %s Score kaufen (/househelp)", dini_Get(HouseFile(houseid), "Name"),dini_Int(HouseFile(houseid), "Preis"), dini_Get(HouseFile(houseid), "Score"));
- SendPlayerText(playerid, string);
- }
- if(dini_Isset(HouseFile(houseid), "Besitzer"))
- {
- format(string, sizeof(string), "== Haus %s gehört %s", dini_Get(HouseFile(houseid), "Name"),dini_Get(HouseFile(houseid), "Besitzer"));
- SendPlayerText(playerid, string);
- }
- } else if(HouseInfo[houseid]==2)
- {
- SendPlayerText(playerid, InfoPoint[houseid]);
- }
- return 1;
- }
- public OnPlayerHouse()
- {
- for (new i = 0; i < MAX_PLAYERS; i++)
- {
- if (IsPlayerConnected(i))
- {
- HouseCheckpointUpdate(i);
- }
- }
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- hmode[playerid]=0;
- //tAxI_OnPlayerConnect2(playerid);
- //HouseCheckpointUpdate(playerid);
- //SetTimerEx("HouseCheckpointUpdate", 800, 1, "d", playerid);
- SetPlayerVirtualWorld(playerid, 0);
- InHouse[playerid]=0;
- pCP[playerid]=0;
- //SendClientMessage(playerid, GREEN, "== Haussystem Version 1.0 by SAMP-Hilfe.de ==");
- return 1;
- }
- public OnPlayerSpawn(playerid)
- {
- SpawnAtHouse(playerid);
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- //tAxI_OnPlayerDisconnect(playerid);
- return 1;
- }
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- new string[256];
- new name[MAX_PLAYER_NAME];
- GetPlayerName(playerid,name,sizeof(name));
- if(strcmp(cmdtext, "/kaufen", true) == 0)
- {
- new houseid = PlayerParameters[playerid][HouseArea];
- if(!IsPlayerInCheckpoint(playerid) || HouseInfo[houseid]!=1) return SendErrorText(playerid, "SERVER: Du musst in einen Haus Checkpoint stehen!");
- if(fexist(PlayerFile(playerid)))
- {
- if(dini_Int(PlayerFile(playerid), "OwnHaus") == 1) return SendErrorText(playerid, "SERVER: Du hast bereits ein Haus!");
- }
- if(strcmp(dini_Get(HouseFile(houseid), "Name"), Playername(playerid), true) == 0) return SendErrorText(playerid, "SERVER: Das Haus gehört dir schon!");
- if(dini_Int(HouseFile(houseid), "Kaufbar") == 0) return SendErrorText(playerid, "SERVER: Das Haus steht nicht zum Verkauf! Also kannst du es nicht kaufen!");
- new preis;
- new score;
- preis=dini_Int(HouseFile(houseid), "Preis");
- score=dini_Int(HouseFile(houseid), "Score");
- if(preis > GetPlayerMoney(playerid)) return SendErrorText(playerid, "SERVER: Du hast nicht genug Geld um dir das Haus zu Kaufen!");
- if(score > GetPlayerScore(playerid)) return SendErrorText(playerid, "SERVER: Du hast nicht genug Scores um dir das Haus zu Kaufen!");
- /*if(dini_Isset(HouseFile(houseid), "Besitzer"))
- {
- format(string, sizeof(string), "[INFO] Du hast %s von %s abgekauft !", dini_Get(HouseFile(houseid), "Name"), dini_Get(HouseFile(houseid), "Besitzer"));
- SendPlayerText(playerid, string);
- new sellerid = GetPlayerid(dini_Get(HouseFile(houseid), "Besitzer"));
- dini_Set(PlayerFile(sellerid), "OwnHaus", "0");
- dini_Set(PlayerFile(sellerid), "Haus", "-1");
- if(IsPlayerConnected(sellerid))
- {
- GivePlayerMoney(sellerid, preis);
- format(string, sizeof(string), "[INFO] %s hat einen Käufer gefunden ! Der neue Käufer von deinem Haus ist %s", dini_Get(HouseFile(houseid), "Name"), Playername(playerid));
- SendPlayerText(sellerid, string);
- } else {
- dini_IntSet(udb_encode(dini_Get(HouseFile(houseid), "Besitzer")), "money", preis + dini_Int(udb_encode(dini_Get(HouseFile(houseid), "Besitzer")), "money"));
- }
- } else {*/
- format(string, sizeof(string), "== Du hast dir Haus %s für %d gekauft! (/househelp)", dini_Get(HouseFile(houseid), "Name"),dini_Int(HouseFile(houseid), "Preis"));
- SendClientText(playerid, string);
- //}
- dini_IntSet(HouseFile(houseid), "Kaufbar", 0);
- for(new i = 0;i<MAX_PLAYERS;i++) hmode[playerid]=0;
- //DestroyMapIcon(H_Icon[houseid]);
- //H_Icon[houseid] = CreateMapIcon(32, RED, dini_Int(HouseFile(houseid), "x"), dini_Int(HouseFile(houseid), "y"), dini_Int(HouseFile(houseid), "z"));
- GivePlayerMoney(playerid, preis * -1);
- dini_Set(HouseFile(houseid), "Besitzer", Playername(playerid));
- if(!fexist(PlayerFile(playerid))) dini_Create(PlayerFile(playerid));
- dini_Set(PlayerFile(playerid), "Name", Playername(playerid));
- dini_IntSet(PlayerFile(playerid), "Haus", houseid);
- dini_IntSet(PlayerFile(playerid), "OwnHaus", 1);
- return 1;
- }
- if(strcmp(cmdtext, "/verkaufen", true) == 0)
- {
- new houseid = PlayerParameters[playerid][HouseArea];
- if(!IsPlayerInCheckpoint(playerid) || HouseInfo[houseid]!=1) return SendErrorText(playerid, "SERVER: Du musst in deinen Haus Checkpoint stehen !");
- if(!dini_Isset(HouseFile(houseid), "Besitzer")) return SendErrorText(playerid, "SERVER: Das Haus gehört dir nicht !");
- if(strcmp(dini_Get(HouseFile(houseid), "Besitzer"), Playername(playerid), true) == 0)
- {
- new preis=dini_Int(HouseFile(houseid), "Preis");
- if(!fexist(PlayerFile(playerid))) dini_Create(PlayerFile(playerid));
- dini_IntSet(PlayerFile(playerid), "Haus", -1);
- dini_IntSet(PlayerFile(playerid), "OwnHaus", 0);
- GivePlayerMoney(playerid, preis);
- //DestroyMapIcon(H_Icon[houseid]);
- //H_Icon[houseid] = CreateMapIcon(31, GREEN, dini_Int(HouseFile(houseid), "x"), dini_Int(HouseFile(houseid), "y"), dini_Int(HouseFile(houseid), "z"));
- dini_IntSet(HouseFile(houseid), "Kaufbar", 1);
- dini_Unset(HouseFile(houseid), "Besitzer");
- SendClientText(playerid, "== Du hast dein Haus verkauft!");
- for(new i = 0;i<MAX_PLAYERS;i++) hmode[playerid]=0;
- } else {
- SendErrorText(playerid, "SERVER: Das Haus gehört dir nicht!");
- }
- //if(strcmp(dini_Get(HouseFile(houseid), "Besitzer"), Playername(playerid), true) == 0)
- //{
- // if(!strlen(params)) return SendPlayerText(playerid, "USAGE: /sell [preis]");
- /*if(dini_Int(HouseFile(houseid), "Kaufbar") == 1) return SendPlayerText(playerid, "[INFO] Dein Haus steht schon zum Verkauf !");
- dini_IntSet(HouseFile(houseid), "Kaufbar", 1);
- SendPlayerText(playerid, "[INFO] Du hast dein Haus zum Verkauf freigegeben !");
- } else {
- SendPlayerText(playerid, "[INFO] Das Haus gehört dir nicht !");
- }
- return 1;
- }
- */
- return 1;
- }
- /*
- if(strcmp(cmdtext, "/nvkaufen", true) == 0)
- {
- new houseid = PlayerParameters[playerid][HouseArea];
- if(!IsPlayerInCheckpoint(playerid) || HouseInfo[houseid]!=1) return SendPlayerText(playerid, "[INFO] Du musst in einen Haus Checkpoint stehen !");
- if(!dini_Isset(HouseFile(houseid), "Besitzer")) return SendPlayerText(playerid, "[INFO] Das Haus gehört dir nicht !");
- if(strcmp(dini_Get(HouseFile(houseid), "Besitzer"), Playername(playerid), true) == 0)
- {
- if(dini_Int(HouseFile(houseid), "Kaufbar") == 0) return SendPlayerText(playerid, "[INFO] Du hast dein Haus schon vom Verkauf weggenommen !");
- dini_IntSet(HouseFile(houseid), "Kaufbar", 0);
- SendPlayerText(playerid, "[INFO] Dein Haus steht nun nicht mehr zum Verkauf !");
- } else {
- SendPlayerText(playerid, "[INFO] Dieses Haus gehört dir nicht!");
- }
- return 1;
- }*/
- if(strcmp(cmdtext, "/betreten", true) == 0)
- {
- new houseid = PlayerParameters[playerid][HouseArea];
- if(!IsPlayerInCheckpoint(playerid) || HouseInfo[houseid]!=1) return SendErrorText(playerid, "SERVER: Du musst in einen Haus Checkpoint stehen !");
- if(!dini_Isset(HouseFile(houseid), "Besitzer")) return SendErrorText(playerid, "SERVER: Das Haus gehört dir nicht !");
- if(strcmp(dini_Get(HouseFile(houseid), "Besitzer"), Playername(playerid), true) == 0)
- {
- for(new i = 0; i<MAX_PLAYERS; i++)
- {
- if(IsPlayerInCheckpoint(i) && point!=999)
- {
- if(PlayerParameters[i][HouseArea] == houseid)
- {
- GetPlayerPos(i, hPos[i][0], hPos[i][1], hPos[i][2]);
- SetPlayerPos(i, dini_Int(HouseFile(houseid), "ix"),dini_Int(HouseFile(houseid), "iy"),dini_Int(HouseFile(houseid), "iz"));
- SetPlayerInterior(i, dini_Int(HouseFile(houseid), "InteriorID"));
- SetPlayerVirtualWorld(i, dini_Int(HouseFile(houseid), "VirtualWorld"));
- InHouse[i] = 1;
- format(string, sizeof(string), "== Willkommen %s, bei %s im Haus (/househelp)", name, dini_Get(HouseFile(houseid), "Besitzer"), dini_Get(HouseFile(houseid), "name"));
- SendPlayerText(playerid, string);
- }
- }
- }
- //GetPlayerPos(playerid, hPos[playerid][0], hPos[playerid][1], hPos[playerid][2]);
- //SetPlayerPos(playerid, dini_Int(HouseFile(houseid), "ix"),dini_Int(HouseFile(houseid), "iy"),dini_Int(HouseFile(houseid), "iz"));
- //SetPlayerInterior(playerid, dini_Int(HouseFile(houseid), "InteriorID"));
- //SetPlayerVirtualWorld(playerid, dini_Int(HouseFile(houseid), "VirtualWorld"));
- } else {
- SendErrorText(playerid, "SERVER: Das Haus gehört dir nicht!");
- }
- return 1;
- }
- /*if(strcmp(cmdtext, "/rein", true) == 0)
- {
- if(!IsPlayerAdmin(playerid)) return SendErrorText(playerid, "SERVER: Du bist kein Administrator!");
- new houseid = PlayerParameters[playerid][HouseArea];
- if(!IsPlayerInCheckpoint(playerid) || HouseInfo[houseid]!=1) return SendErrorText(playerid, "SERVER: Du musst in einen Haus Checkpoint stehen!");
- if(IsPlayerInCheckpoint(playerid))
- {
- if(PlayerToPoint(1,dini_Int(HouseFile(houseid), "x"), dini_Int(HouseFile(houseid), "y"), dini_Int(HouseFile(houseid), "z"), playerid))
- {
- GetPlayerPos(playerid, hPos[playerid][0], hPos[playerid][1], hPos[playerid][2]);
- SetPlayerPos(playerid, dini_Int(HouseFile(houseid), "ix"),dini_Int(HouseFile(houseid), "iy"),dini_Int(HouseFile(houseid), "iz"));
- SetPlayerInterior(playerid, dini_Int(HouseFile(houseid), "InteriorID"));
- SetPlayerVirtualWorld(playerid, dini_Int(HouseFile(houseid), "VirtualWorld"));
- InHouse[playerid] = 1;
- //format(string, sizeof(string), "== Willkommen im Haus %s von %s (/househelp)", dini_Get(HouseFile(houseid), "Name"), dini_Get(HouseFile(houseid), "Besitzer"));
- //SendPlayerText(playerid, string);
- }
- }
- //GetPlayerPos(playerid, hPos[playerid][0], hPos[playerid][1], hPos[playerid][2]);
- //SetPlayerPos(playerid, dini_Int(HouseFile(houseid), "ix"),dini_Int(HouseFile(houseid), "iy"),dini_Int(HouseFile(houseid), "iz"));
- //SetPlayerInterior(playerid, dini_Int(HouseFile(houseid), "InteriorID"));
- //SetPlayerVirtualWorld(playerid, dini_Int(HouseFile(houseid), "VirtualWorld"));
- return 1;
- }*/
- if(strcmp(cmdtext, "/rein", true) == 0)
- {
- if(!IsPlayerAdmin(playerid)) return SendErrorText(playerid, "SERVER: Du bist kein Administrator!");
- new houseid = PlayerParameters[playerid][HouseArea];
- if(!IsPlayerInCheckpoint(playerid) || HouseInfo[houseid]!=1) return SendErrorText(playerid, "SERVER: Du musst in einen Haus Checkpoint stehen!");
- if(IsPlayerInCheckpoint(playerid))
- {
- GetPlayerPos(playerid, hPos[playerid][0], hPos[playerid][1], hPos[playerid][2]);
- SetPlayerPos(playerid, dini_Int(HouseFile(houseid), "ix"),dini_Int(HouseFile(houseid), "iy"),dini_Int(HouseFile(houseid), "iz"));
- SetPlayerInterior(playerid, dini_Int(HouseFile(houseid), "InteriorID"));
- SetPlayerVirtualWorld(playerid, dini_Int(HouseFile(houseid), "VirtualWorld"));
- InHouse[playerid] = 1;
- format(string, sizeof(string), "== Willkommen im Haus %s von %s (/househelp)", dini_Get(HouseFile(houseid), "Name"), dini_Get(HouseFile(houseid), "Besitzer"));
- SendPlayerText(playerid, string);
- }
- //GetPlayerPos(playerid, hPos[playerid][0], hPos[playerid][1], hPos[playerid][2]);
- //SetPlayerPos(playerid, dini_Int(HouseFile(houseid), "ix"),dini_Int(HouseFile(houseid), "iy"),dini_Int(HouseFile(houseid), "iz"));
- //SetPlayerInterior(playerid, dini_Int(HouseFile(houseid), "InteriorID"));
- //SetPlayerVirtualWorld(playerid, dini_Int(HouseFile(houseid), "VirtualWorld"));
- return 1;
- }
- if(strcmp(cmdtext, "/verlassen", true) == 0)
- {
- //new houseid = PlayerParameters[playerid][HouseArea];
- if(InHouse[playerid] == 1)
- {
- InHouse[playerid]=0;
- SetPlayerVirtualWorld(playerid, 0);
- SetPlayerPos(playerid, hPos[playerid][0], hPos[playerid][1], hPos[playerid][2]);
- //SetPlayerPos(playerid, dini_Int(HouseFile(houseid), "x"),dini_Int(HouseFile(houseid), "y"),dini_Int(HouseFile(houseid), "z")+5);
- SetPlayerInterior(playerid, 0);
- SendClientText(playerid, "== Du hast das Haus verlassen!");
- } else {
- SendErrorText(playerid, "SERVER: Du bist in keinem Haus!");
- }
- return 1;
- }
- if(strcmp(cmdtext, "/menu", true) == 0)
- {
- if(InHouse[playerid] == 1)
- {
- ShowMenuForPlayer(menu, playerid);
- }
- else
- {
- SendErrorText(playerid, "SERVER: Du bist in keinem Haus!");
- }
- return 1;
- }
- if(strcmp(cmdtext, "/househelp", true) == 0)
- {
- SendClientMessage(playerid, COLOR_YELLOW,"============== Haushilfe ==============");
- SendClientMessage(playerid, COLOR_YELLOW,"== Kaufen: /kaufen, /verkaufen");
- SendClientMessage(playerid, COLOR_YELLOW,"== Haus: /betreten, /verlassen, /menu");
- SendClientMessage(playerid, COLOR_YELLOW,"=======================================");
- return 1;
- }
- return 0;
- }
- public SpawnAtHouse(playerid)
- {
- if(dini_Int(PlayerFile(playerid), "OwnHaus") == 1)
- {
- new houseid = dini_Int(PlayerFile(playerid), "Haus");
- SetPlayerPos(playerid,dini_Int(HouseFile(houseid), "x"),dini_Int(HouseFile(houseid), "y"),dini_Int(HouseFile(houseid), "z"));
- }
- return 1;
- }
- public OnPlayerSelectedMenuRow(playerid, row)
- {
- new Menu:current;
- current = GetPlayerMenu(playerid);
- if(current == menu)
- {
- switch(row)
- {
- case 0:
- {
- //Essen
- new Float:health;
- GetPlayerHealth(playerid,health);
- SetPlayerHealth(playerid,health+30);
- ShowMenuForPlayer(menu,playerid);
- }
- case 1:
- {
- //Trinken
- new Float:health;
- GetPlayerHealth(playerid,health);
- SetPlayerHealth(playerid,health+30);
- ShowMenuForPlayer(menu,playerid);
- }
- case 2:
- {
- //Schutzweste
- SetPlayerArmour(playerid, 100.0);
- ShowMenuForPlayer(menu,playerid);
- }
- case 3:
- {
- //Sawnoff holen
- GivePlayerWeapon(playerid, 26, 500);
- ShowMenuForPlayer(menu,playerid);
- }
- case 4:
- {
- //M4 holen
- GivePlayerWeapon(playerid, 31, 500);
- ShowMenuForPlayer(menu,playerid);
- }
- case 5:
- {
- //Tec9 holen
- GivePlayerWeapon(playerid, 32, 500);
- ShowMenuForPlayer(menu,playerid);
- }
- case 6:
- {
- //Messer holen
- GivePlayerWeapon(playerid, 4, 500);
- ShowMenuForPlayer(menu,playerid);
- }
- case 7:
- {
- //Schließen
- HideMenuForPlayer(menu,playerid);
- }
- }
- }
- return 1;
- }
- stock PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z)
- {
- if(IsPlayerConnected(playerid))
- {
- new Float:oldposx, Float:oldposy, Float:oldposz;
- new Float:tempposx, Float:tempposy, Float:tempposz;
- GetPlayerPos(playerid, oldposx, oldposy, oldposz);
- tempposx = (oldposx -x);
- tempposy = (oldposy -y);
- tempposz = (oldposz -z);
- if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
- {
- return 1;
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement