Advertisement
iMaikel

[FilterScript] Air House

Oct 4th, 2020
268
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 60.60 KB | None | 0 0
  1. Commands:
  2. RCON Commands:
  3. /Createhouse [You Can Create a House]
  4. /Deletehouse [You Can Delete a House]
  5. /Gotohouse [You Can Teleport yourself to a House]
  6. /hedit [You Can Edit House Options]
  7. /savehouses [you should do this after creating houses for more Confidence]
  8.  
  9. Player Commands:
  10. /Buyhouse [You Can Buy House]
  11. /Sellhousetomarket [You Can Sell House To Server]
  12. /Houseupgrade [You Can Upgrade Your House To Next Level]
  13. /Enter [You Can enter To Your House]
  14. /Exit [You Can Exit From Your House]
  15. /Heal [You Can Heal Yourself]
  16. /Hwithdraw [You Can Withdraw Money from your House]
  17. /Hdeposit [You Can Deposit Your Money To Your House]
  18. /Hlock [You Can Lock Your House Door]
  19.  
  20. /HouseHelp [You Can See All The Commands For AirHouse]
  21.  
  22. Features:
  23. 1.Very Easy to Use
  24. 2.Very Strong Save System dini
  25. 3.Dynamic Creating House
  26. 4.Dynamic Editing House
  27. 5.Easy RCON CMDs
  28. 6. Upgrade System
  29.  
  30. In Next Version:
  31. 1.Withdraw / Deposit Gun,Drug,Material & etc.
  32. 2.Rentable Houses.
  33. 3.More Levels For House
  34. 4.Create Some Interior
  35. 5.If Have Suggestion Say
  36.  
  37. Installation:
  38. Download file and extract it.Put Houses file into your Script file then put all includes into your pawno/includes file and put AirHouseV0.1 into filterscripts files. Now Put AirHouseV0.1 into server.cfg front filterscripts
  39. like:filterscripts AirHouseV0.1
  40. Note: It is Very important to put houses.cfg into your scriptfiles else will crash server.
  41. Note: If You don't update your plugins or includes CMDs won't Work.
  42. Note:And Plz Don't remove Credits.
  43.  
  44.  
  45.  
  46. //////////////////////////////////////////////////////////////////////////////////////////////////////
  47. // This Is Air-House System
  48. // Plz Dont Remove Credits
  49. #define FILTERSCRIPT
  50.  
  51. #include <a_samp>
  52. #include <zcmd>
  53. #include <streamer>
  54. #include <foreach>
  55. #include <sscanf2>
  56. #include <dini>
  57.  
  58. #if defined FILTERSCRIPT
  59. #pragma tabsize 0
  60. #define MAX_HOUSES 501
  61. #define CGE "{2A8A07}"
  62. #define COE "{E600FF}"
  63. #define CWE "{FFFFFF}"
  64. #define COLOR_GREY 0xAFAFAFFF
  65. #define COLOR_DARKRED 0xAA3333FF
  66. #define COLOR_WHITE 0xFFFFFFFF
  67. #define COLOR_GREEN 0x33AA33FF
  68. #define COLOR_YELLOW 0xFFFF00FF
  69. #define COLOR_PURPLE 0xC2A2DAFF
  70. #define COLOR_ORANGE 0xFF9900FF
  71. #define COLOR_RED 0xFF0606FF
  72. #define COLOR_LIGHTBLUE 0x33CCFFFF
  73. #define COLOR_LIGHTRED 0xFF6347FF
  74.  
  75.  
  76.  
  77. public OnFilterScriptInit()
  78. {
  79.        print("\n--------------------------------------");
  80.        print(" ------------AirHouse V0.1--------------");
  81.        print("--------------------------------------\n");
  82.        CheckFiles();
  83.        LoadHouses();
  84.        return 1;
  85. }
  86.  
  87. public OnFilterScriptExit()
  88. {
  89.        return 1;
  90. }
  91.  
  92. #else
  93.  
  94. main()
  95. {
  96.        print("\n----------------------------------");
  97.        print(" ----------Credit:AirBloG-----------");
  98.        print("----------------------------------\n");
  99.        CheckFiles();
  100.        LoadHouses();
  101. }
  102.  
  103. #endif
  104. ////////////////////////////////////////////////////////////////////////////////
  105. enum pInfo
  106. {
  107.        // Temp Values
  108.        pLoggedIn,
  109.        pSpawn,
  110.        // Permanent Values
  111.        pOwner,
  112.        pLevel,
  113.        pRented,
  114.        pHours,
  115.        pLocal,
  116.        pMoney,
  117.        pModel,
  118.        pHouse,
  119.        pVHouse,
  120.        pMaskOn,
  121.        pInt,
  122.        pPhousekey,
  123.        }
  124. new PlayerInfo[MAX_PLAYERS][pInfo];
  125. ////////////////////////////////////////////////////////////////////////////////
  126. enum houseInfo
  127. {
  128.        hLevel,
  129.        hPrice,
  130.        hStatus,
  131.        hOwner[32],
  132.        Float:hX,
  133.        Float:hY,
  134.        Float:hZ,
  135.        hOwned,
  136.        hMoney,
  137.        hTakings,
  138.        hRentabil,
  139.        hRent,
  140.        hInt,
  141.        hPickup,
  142.        Text3D:hText,
  143.        hSpawn
  144. }
  145. new HouseInfo[MAX_HOUSES][houseInfo];
  146. stock CheckFiles()
  147. {
  148.        if(!dini_Exists("houses.cfg")) dini_Create("houses.cfg");
  149.        return 1;
  150. }
  151. stock LoadHouses()
  152. {
  153.        new binfo[21][32];
  154.        new string[256];
  155.        new File:file = fopen("Houses/houses.cfg", io_read);
  156.        if(file)
  157.        {
  158.            new idx = 1;
  159.                while(idx < MAX_HOUSES)
  160.                {
  161.                    fread(file, string);
  162.                    split(string, binfo, '|');
  163.                    HouseInfo[idx][hLevel] = strval(binfo[0]);
  164.                    HouseInfo[idx][hPrice] = strval(binfo[1]);
  165.                    HouseInfo[idx][hStatus] = strval(binfo[2]);
  166.                    format(HouseInfo[idx][hOwner], 32, "%s", binfo[3]);
  167.                    HouseInfo[idx][hX] = floatstr(binfo[4]);
  168.                    HouseInfo[idx][hY] = floatstr(binfo[5]);
  169.                    HouseInfo[idx][hZ] = floatstr(binfo[6]);
  170.                    HouseInfo[idx][hMoney] = strval(binfo[7]);
  171.                        if(HouseInfo[idx][hLevel])
  172.                        {
  173.                            HouseInfo[idx][hPickup] = CreateDynamicPickup(1273, 1, HouseInfo[idx][hX], HouseInfo[idx][hY], HouseInfo[idx][hZ], 0);
  174.                if(!strcmp("The State", HouseInfo[idx][hOwner])) format(string, sizeof(string), ""COE"["CWE"%d, House (Lvl: %d)"COE"]\n"COE"Owner"CWE" %s\n"COE"Status"CWE" For Sale\n"CWE"$%d", idx, HouseInfo[idx][hLevel], HouseInfo[idx][hOwner], HouseInfo[idx][hPrice]);
  175.                                else format(string, sizeof(string), ""COE"["CWE"ID:%d, House (Lvl: %d)"COE"]\n"COE"Owner"CWE" %s\n"COE"Status"CWE" %s", idx, HouseInfo[idx][hLevel], HouseInfo[idx][hOwner], RHS(idx));
  176.                                HouseInfo[idx][hText] = CreateDynamic3DTextLabel(string, COLOR_WHITE, HouseInfo[idx][hX], HouseInfo[idx][hY], HouseInfo[idx][hZ]+0.3, 15);
  177.  
  178.                        }
  179.                        idx++;
  180.            }
  181.        }
  182.        print("Houses loaded successfully.");
  183.        return 1;
  184. }
  185.  
  186. stock SaveHouses()
  187. {
  188.        new idx = 1, File:file;
  189.        new string[256];
  190.        while(idx < MAX_HOUSES)
  191.        {
  192.            format(string, sizeof(string), "%d|%d|%d|%s|%f|%f|%f|%d\r\n",
  193.            HouseInfo[idx][hLevel],
  194.            HouseInfo[idx][hPrice],
  195.            HouseInfo[idx][hStatus],
  196.            HouseInfo[idx][hOwner],
  197.            HouseInfo[idx][hX],
  198.            HouseInfo[idx][hY],
  199.            HouseInfo[idx][hZ],
  200.            HouseInfo[idx][hMoney]
  201.                );
  202.            if(idx == 1)
  203.            {
  204.                file = fopen("Houses/houses.cfg", io_write);
  205.            }
  206.            else
  207.            {
  208.                file = fopen("Houses/houses.cfg", io_append);
  209.            }
  210.                fwrite(file, string);
  211.                fclose(file);
  212.                idx++;
  213.        }
  214.        print("Houses saved successfully.");
  215. }
  216. ////////////////////////////////////////////////////////////////////////////////
  217. public OnGameModeInit()
  218. {
  219.        // Don't use these lines if it's a filterscript
  220.        SetGameModeText("Blank Script");
  221.        CheckFiles();
  222.        LoadHouses();
  223.        AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
  224.        return 1;
  225. }
  226.  
  227. public OnGameModeExit()
  228. {
  229.        return 1;
  230. }
  231.  
  232. public OnPlayerRequestClass(playerid, classid)
  233. {
  234.        SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
  235.        SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
  236.        SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
  237.        return 1;
  238. }
  239.  
  240. public OnPlayerConnect(playerid)
  241. {
  242.        return 1;
  243. }
  244.  
  245. public OnPlayerDisconnect(playerid, reason)
  246. {
  247.        return 1;
  248. }
  249.  
  250. public OnPlayerSpawn(playerid)
  251. {
  252.        return 1;
  253. }
  254.  
  255. public OnPlayerDeath(playerid, killerid, reason)
  256. {
  257.        return 1;
  258. }
  259.  
  260. public OnVehicleSpawn(vehicleid)
  261. {
  262.        return 1;
  263. }
  264.  
  265. public OnVehicleDeath(vehicleid, killerid)
  266. {
  267.        return 1;
  268. }
  269.  
  270. public OnPlayerText(playerid, text[])
  271. {
  272.        return 1;
  273. }
  274.  
  275. public OnPlayerCommandText(playerid, cmdtext[])
  276. {
  277.        if (strcmp("/mycommand", cmdtext, true, 10) == 0)
  278.        {
  279.                // Do something here
  280.                return 1;
  281.        }
  282.        return 0;
  283. }
  284.  
  285. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  286. {
  287.        return 1;
  288. }
  289.  
  290. public OnPlayerExitVehicle(playerid, vehicleid)
  291. {
  292.        return 1;
  293. }
  294.  
  295. public OnPlayerStateChange(playerid, newstate, oldstate)
  296. {
  297.        return 1;
  298. }
  299.  
  300. public OnPlayerEnterCheckpoint(playerid)
  301. {
  302.        return 1;
  303. }
  304.  
  305. public OnPlayerLeaveCheckpoint(playerid)
  306. {
  307.        return 1;
  308. }
  309.  
  310. public OnPlayerEnterRaceCheckpoint(playerid)
  311. {
  312.        return 1;
  313. }
  314.  
  315. public OnPlayerLeaveRaceCheckpoint(playerid)
  316. {
  317.        return 1;
  318. }
  319.  
  320. public OnRconCommand(cmd[])
  321. {
  322.        return 1;
  323. }
  324.  
  325. public OnPlayerRequestSpawn(playerid)
  326. {
  327.        return 1;
  328. }
  329.  
  330. public OnObjectMoved(objectid)
  331. {
  332.        return 1;
  333. }
  334. new ScriptMoneyUpdated[MAX_PLAYERS];
  335. new ScriptMoney[MAX_PLAYERS];
  336. forward SafeGivePlayerMoney(plyid, amounttogive);
  337. public SafeGivePlayerMoney(plyid, amounttogive)
  338. {
  339.        new curHour, curMinute, curSecond;
  340.        gettime(curHour, curMinute, curSecond);
  341.        ScriptMoneyUpdated[plyid] = curSecond;
  342.        if (amounttogive < 0)
  343.        {
  344.                GivePlayerMoney(plyid, amounttogive);
  345.                ScriptMoney[plyid] = (ScriptMoney[plyid] + amounttogive);
  346.        }
  347.        else
  348.        {
  349.                ScriptMoney[plyid] = (ScriptMoney[plyid] + amounttogive);
  350.                GivePlayerMoney(plyid, amounttogive);
  351.        }
  352.        return 1;
  353. }
  354. public OnPlayerObjectMoved(playerid, objectid)
  355. {
  356.        return 1;
  357. }
  358.  
  359. public OnPlayerPickUpPickup(playerid, pickupid)
  360. {
  361.        return 1;
  362. }
  363.  
  364. public OnVehicleMod(playerid, vehicleid, componentid)
  365. {
  366.        return 1;
  367. }
  368.  
  369. public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
  370. {
  371.        return 1;
  372. }
  373.  
  374. public OnVehicleRespray(playerid, vehicleid, color1, color2)
  375. {
  376.        return 1;
  377. }
  378.  
  379. public OnPlayerSelectedMenuRow(playerid, row)
  380. {
  381.        return 1;
  382. }
  383.  
  384. public OnPlayerExitedMenu(playerid)
  385. {
  386.        return 1;
  387. }
  388.  
  389. public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
  390. {
  391.        return 1;
  392. }
  393.  
  394. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  395. {
  396.        return 1;
  397. }
  398.  
  399. public OnRconLoginAttempt(ip[], password[], success)
  400. {
  401.        return 1;
  402. }
  403.  
  404. public OnPlayerUpdate(playerid)
  405. {
  406.        return 1;
  407. }
  408.  
  409. public OnPlayerStreamIn(playerid, forplayerid)
  410. {
  411.        return 1;
  412. }
  413.  
  414. public OnPlayerStreamOut(playerid, forplayerid)
  415. {
  416.        return 1;
  417. }
  418.  
  419. public OnVehicleStreamIn(vehicleid, forplayerid)
  420. {
  421.        return 1;
  422. }
  423.  
  424. public OnVehicleStreamOut(vehicleid, forplayerid)
  425. {
  426.        return 1;
  427. }
  428.  
  429. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  430. {
  431.        return 1;
  432. }
  433.  
  434. public OnPlayerClickPlayer(playerid, clickedplayerid, source)
  435. {
  436.        return 1;
  437. }
  438.  
  439. CMD:createhouse(playerid, params[])
  440. {
  441.        new string[128];
  442.  
  443.        if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You are not an authorized to use this command.");
  444.        for(new idx=1; idx<MAX_HOUSES; idx++)
  445.        {
  446.            if(!HouseInfo[idx][hLevel])
  447.                {
  448.                    // Getting Business Setup
  449.                    new Float:X, Float:Y, Float:Z;
  450.                    GetPlayerPos(playerid, X, Y, Z);
  451.                    // Making Business
  452.                    HouseInfo[idx][hLevel] = 1;
  453.                    HouseInfo[idx][hPrice] = 955000;
  454.                    HouseInfo[idx][hStatus] = 0;
  455.                    format(HouseInfo[idx][hOwner], 32, "The State");
  456.                    HouseInfo[idx][hX] = X;
  457.                    HouseInfo[idx][hY] = Y;
  458.                    HouseInfo[idx][hZ] = Z;
  459.                    HouseInfo[idx][hMoney] = 0;
  460.                    HouseInfo[idx][hPickup] = CreateDynamicPickup(1273, 1, HouseInfo[idx][hX], HouseInfo[idx][hY], HouseInfo[idx][hZ], 0);
  461.            format(string, sizeof(string), ""COE"["CWE"ID:%d, House (Lvl: %d)"COE"]\n"COE"Owner"CWE" %s\n"COE"Status"CWE" For Sale\n"CWE"$%d", idx, HouseInfo[idx][hLevel], HouseInfo[idx][hOwner], HouseInfo[idx][hPrice]);
  462.                        HouseInfo[idx][hText] = CreateDynamic3DTextLabel(string, COLOR_WHITE, HouseInfo[idx][hX], HouseInfo[idx][hY], HouseInfo[idx][hZ]+0.3, 15);
  463.                        Log("logs/house.log", string);
  464.                        idx = MAX_HOUSES;
  465.                }
  466.        }
  467.        return 1;
  468. }
  469. CMD:deletehouse(playerid, params[])
  470. {
  471.        new id, string[128];
  472.        if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You are not an authorized to use this command.");
  473. //    if(!aDuty[playerid]) return SendClientMessage(playerid, COLOR_GREY, "You are not on admin duty.");
  474.        if(sscanf(params, "i", id)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /deletehouse [houseid]");
  475.        if(!HouseInfo[id][hLevel]) return SendClientMessage(playerid, COLOR_GREY, "Invalid business id.");
  476.    foreach(Player, i)
  477.        {
  478.            if(IsPlayerLoggedIn(i) && PlayerInfo[i][pHouse] == id)
  479.                {
  480.                    PlayerInfo[i][pHouse] = 0;
  481.                    format(string, sizeof(string), " Administrator %s has deleted your house.", RPN(playerid));
  482.                        SendClientMessage(i, COLOR_WHITE, string);
  483.                }
  484.        }
  485.        if(!strcmp("The State", HouseInfo[id][hOwner]))
  486.        {
  487.                format(string, sizeof(string), "{FF0000}Delete:{FF6347} %s has deleted house ID %d.", RPN(playerid), id);
  488.        }
  489.        else
  490.        {
  491.            format(string, sizeof(string), "{FF0000}Delete:{FF6347} %s has deleted %s's house. (ID %d)", RPN(playerid), HouseInfo[id][hOwner], id);
  492.        }
  493.        SendClientMessage(COLOR_DARKRED, 1, string);
  494.        Log("logs/house.log", string);
  495.        HouseInfo[id][hLevel] = 0;
  496.    HouseInfo[id][hPrice] = 0;
  497.    HouseInfo[id][hStatus] = 0;
  498.    format(HouseInfo[id][hOwner], 32, "");
  499.    HouseInfo[id][hX] = 0;
  500.    HouseInfo[id][hY] = 0;
  501.    HouseInfo[id][hZ] = 0;
  502.    HouseInfo[id][hMoney] = 0;
  503.    DestroyDynamicPickup(HouseInfo[id][hPickup]);
  504.    DestroyDynamic3DTextLabel(HouseInfo[id][hText]);
  505.        return 1;
  506. }
  507. CMD:hedit(playerid, params[])
  508. {
  509.        new bizid, string[128], input;
  510.  
  511.        if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You are not an authorized to use this command.");
  512. //    if(!aDuty[playerid]) return SendClientMessage(playerid, COLOR_GREY, "You are not on admin duty.");
  513.        if(sscanf(params, "s[32]", params))
  514.        {
  515.                SendClientMessage(playerid, COLOR_WHITE, "USAGE: /hedit [option] [houseid]");
  516.                SendClientMessage(playerid, COLOR_GREY, "OPTIONS: location | price | level");
  517.                return 1;
  518.        }
  519.        if(!strcmp(params, "location", true, 8))
  520.        {
  521.            if(sscanf(params, "s[32]i", params, bizid)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /hedit location [house]");
  522.        new idx = bizid;
  523.        if(!HouseInfo[bizid][hLevel]) return SendClientMessage(playerid, COLOR_GREY, "Invalid house id.");
  524.                GetPlayerPos(playerid, HouseInfo[idx][hX], HouseInfo[idx][hY], HouseInfo[idx][hZ]);
  525.                DestroyDynamicPickup(HouseInfo[idx][hPickup]);
  526.        HouseInfo[idx][hPickup] = CreateDynamicPickup(1273, 1, HouseInfo[idx][hX], HouseInfo[idx][hY], HouseInfo[idx][hZ], 0);
  527.                DestroyDynamic3DTextLabel(HouseInfo[idx][hText]);
  528.        if(!strcmp("The State", HouseInfo[idx][hOwner])) format(string, sizeof(string), ""COE"["CWE"%d, House (Lvl: %d)"COE"]\n"COE"Owner"CWE" %s\n"COE"Status"CWE" For Sale\n"CWE"$%d", idx, HouseInfo[idx][hLevel], HouseInfo[idx][hOwner], HouseInfo[idx][hPrice]);
  529.                else format(string, sizeof(string), ""COE"["CWE"%d, House (Lvl: %d)"COE"]\n"COE"Owner"CWE" %s\n"COE"Status"CWE" %s", idx, HouseInfo[idx][hLevel], HouseInfo[idx][hOwner], RHS(idx));
  530.                HouseInfo[idx][hText] = CreateDynamic3DTextLabel(string, COLOR_WHITE, HouseInfo[idx][hX], HouseInfo[idx][hY], HouseInfo[idx][hZ]+0.3, 15);
  531.        }
  532.        else if(!strcmp(params, "price", true, 5))
  533.        {
  534.        if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You are not an authorized to use this command.");
  535.            if(sscanf(params, "s[32]ii", params, bizid, input)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /house price [house] [price]");
  536.        new idx = bizid;
  537.                if(!HouseInfo[idx][hLevel]) return SendClientMessage(playerid, COLOR_GREY, "Invalid house id.");
  538.                if(strcmp("The State", HouseInfo[bizid][hOwner])) return SendClientMessage(playerid, COLOR_GREY, "You can't edit the price of owned businesses.");
  539.            HouseInfo[bizid][hPrice] = input;
  540.            format(string, sizeof(string), ""COE"["CWE"%d, House (Lvl: %d)"COE"]\n"COE"Owner"CWE" %s\n"COE"Status"CWE" For Sale\n"CWE"$%d", idx, HouseInfo[idx][hLevel], HouseInfo[idx][hOwner], HouseInfo[idx][hPrice]);
  541.                UpdateDynamic3DTextLabelText(HouseInfo[bizid][hText], COLOR_WHITE, string);
  542.  
  543.        }
  544.        else if(!strcmp(params, "level", true, 5))
  545.        {
  546.                if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You are not an authorized to use this command.");
  547.            if(sscanf(params, "s[32]ii", params, bizid, input)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /house level [houseid] [level]");
  548.        new idx = bizid;
  549.        //if(!HouseInfo[bizid][hLevel]) return SendClientMessage(playerid, COLOR_GREY, "Invalid house id.");
  550.        if(input < 1 || input > 11) return SendClientMessage(playerid, COLOR_GREY, "Levels are between 1 and 11.");
  551.            HouseInfo[bizid][hLevel] = input;
  552.        if(!strcmp("The State", HouseInfo[idx][hOwner])) format(string, sizeof(string), ""COE"["CWE"%d, House (Lvl: %d)"COE"]\n"COE"Owner"CWE" %s\n"COE"Status"CWE" For Sale\n"CWE"$%d", idx, HouseInfo[idx][hLevel], HouseInfo[idx][hOwner], HouseInfo[idx][hPrice]);
  553.                else format(string, sizeof(string), ""COE"["CWE"%d, House (Lvl: %d)"COE"]\n"COE"Owner"CWE" %s\n"COE"Status"CWE" %s", idx, HouseInfo[idx][hLevel], HouseInfo[idx][hOwner], RHS(idx));
  554.                UpdateDynamic3DTextLabelText(HouseInfo[bizid][hText], COLOR_WHITE, string);
  555.        }
  556.        return 1;
  557. }
  558. CMD:gotohouse(playerid, params[])
  559. {
  560.    new idx, string[128];
  561.        if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You are not an authorized to use this command.");
  562. //    if(!aDuty[playerid]) return SendClientMessage(playerid, COLOR_GREY, "You are not on admin duty.");
  563.        if(sscanf(params, "i", idx)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /gotohouse [houseid]");
  564.        if(!HouseInfo[idx][hLevel]) return SendClientMessage(playerid, COLOR_GREY, "Invalid house id.");
  565.        SetPlayerVirtualWorld(playerid, 0);
  566.        SetPlayerInterior(playerid, 0);
  567.        SetPlayerPos(playerid, HouseInfo[idx][hX], HouseInfo[idx][hY], HouseInfo[idx][hZ]);
  568.        format(string, sizeof(string), " You have teleported to house ID %d.", idx);
  569.        SendClientMessage(playerid, COLOR_WHITE, string);
  570.        return 1;
  571. }
  572.  
  573. CMD:buyhouse(playerid, params[])
  574. {
  575.        new string[128], done;
  576.  
  577.        if(PlayerInfo[playerid][pHouse]) return SendClientMessage(playerid, COLOR_GREY, "You already have a houses.");
  578.        for(new idx=1; idx<MAX_HOUSES; idx++)
  579.        {
  580.            if(IsPlayerInRangeOfPoint(playerid, 2, HouseInfo[idx][hX], HouseInfo[idx][hY], HouseInfo[idx][hZ]))
  581.            {
  582.                        if(!strcmp("The State", HouseInfo[idx][hOwner], false))
  583.                        {
  584.                            if(GetPlayerMoney(playerid) < HouseInfo[idx][hPrice]) return SendClientMessage(playerid, COLOR_GREY, "You don't have enough money to buy this house.");
  585.                                GivePlayerMoney(playerid, -HouseInfo[idx][hPrice]);
  586.                                if(PlayerInfo[playerid][pHouse]) PlayerInfo[playerid][pVHouse] = idx;
  587.                                else PlayerInfo[playerid][pHouse] = idx;
  588.                            format(HouseInfo[idx][hOwner], 32, "%s", RPNU(playerid));
  589.                            format(string, sizeof(string), ""COE"["CWE"%d, House (Lvl: %d)"COE"]\n"COE"Owner"CWE" %s\n"COE"Status"CWE" %s", idx, HouseInfo[idx][hLevel], HouseInfo[idx][hOwner], RHS(idx));
  590.                                UpdateDynamic3DTextLabelText(HouseInfo[idx][hText], COLOR_WHITE, string);
  591.                                SendClientMessage(playerid, COLOR_GREEN, " You have successfully bought a house.");
  592.                                SendClientMessage(playerid, COLOR_WHITE, " Type /househelp to view your house commands.");
  593.                                format(string, sizeof(string), "%s has bought house id %d.", RPN(playerid), idx);
  594.                                Log("logs/house.log", string);
  595.                                idx = MAX_HOUSES;
  596.                                done = 1;
  597.                        }
  598.                        if(idx == MAX_HOUSES-1 && !done)
  599.                        {
  600.                            SendClientMessage(playerid, COLOR_GREY, "This house is owned by someone else.");
  601.                        }
  602.            }
  603.            if(idx == MAX_HOUSES-1 && !done)
  604.            {
  605.                SendClientMessage(playerid, COLOR_GREY, "You are not near a buyable house.");
  606.            }
  607.        }
  608.        return 1;
  609. }
  610. CMD:exit(playerid,params[])
  611. {
  612.        new done, string[128];
  613.        if(IsPlayerInRangeOfPoint(playerid, 2, 243.9951,304.9418,999.1484) || IsPlayerInRangeOfPoint(playerid, 2, 2259.6702,-1135.8542,1050.6328) || IsPlayerInRangeOfPoint(playerid, 2, 2308.8254,-1212.8070,1049.0234) || IsPlayerInRangeOfPoint(playerid, 2, 260.7436,1237.5563,1084.2578)
  614.        || IsPlayerInRangeOfPoint(playerid, 2, -42.5742,1405.6521,1084.4297) || IsPlayerInRangeOfPoint(playerid, 2, 2468.6787,-1698.2617,1013.5078) || IsPlayerInRangeOfPoint(playerid, 2, 2365.2183,-1135.4014,1050.8750) || IsPlayerInRangeOfPoint(playerid, 2, 2270.1270,-1210.4855,1047.5625)
  615.        || IsPlayerInRangeOfPoint(playerid, 2, 2324.4424,-1149.2057,1050.7101) || IsPlayerInRangeOfPoint(playerid, 2, 83.0863,1322.3020,1083.8662) ||  IsPlayerInRangeOfPoint(playerid, 2, 225.6631,1022.3559,1084.0150)) // Houses
  616.        {
  617.            new idx;
  618.                idx = GetPlayerVirtualWorld(playerid)-500;
  619.                if(!done && idx < MAX_HOUSES && HouseInfo[idx][hLevel])
  620.                {
  621.                        format(string, sizeof(string), "* %s pushes the door and exits the house.", RPN(playerid));
  622.                        if(PlayerInfo[playerid][pMaskOn] == 1)
  623.                        {
  624.                        format(string, sizeof(string), "* Stranger pushes the door and exits the house.");
  625.                        }
  626.                        else
  627.                        {
  628.                                format(string, sizeof(string), "* %s pushes the door and exits the house.", RPN(playerid));
  629.                        }
  630.                        SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
  631.                SetPlayerPos(playerid, HouseInfo[idx][hX], HouseInfo[idx][hY], HouseInfo[idx][hZ]);
  632.                SetPlayerInterior(playerid, 0);
  633.                SetPlayerVirtualWorld(playerid, 0);
  634.                done = 1;
  635.        }
  636.        }
  637.        return 1;
  638. }
  639. CMD:hlock(playerid,params[])
  640. {
  641.    new string[128], idx, done, lockdone;
  642.        if(PlayerInfo[playerid][pHouse])
  643.        {
  644.            idx = PlayerInfo[playerid][pHouse];
  645.            if(IsPlayerInRangeOfPoint(playerid, 2, HouseInfo[idx][hX], HouseInfo[idx][hY], HouseInfo[idx][hZ]))
  646.            {
  647.                if(!HouseInfo[PlayerInfo[playerid][pHouse]][hStatus])
  648.                {
  649.                        HouseInfo[PlayerInfo[playerid][pHouse]][hStatus] = 1;
  650.                                format(string, sizeof(string), ""COE"["CWE"%d, House (Lvl: %d)"COE"]\n"COE"Owner"CWE" %s\n"COE"Status"CWE" %s", idx, HouseInfo[idx][hLevel], HouseInfo[idx][hOwner], RHS(idx));
  651.                    UpdateDynamic3DTextLabelText(HouseInfo[PlayerInfo[playerid][pHouse]][hText], COLOR_WHITE, string);
  652.                        format(string, sizeof(string), "* %s takes out their house keys and unlocks it.", RPN(playerid));
  653.                                SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
  654.                                GameTextForPlayer(playerid, "~g~House Unlocked", 3500, 3);
  655.                        }
  656.                        else if(HouseInfo[PlayerInfo[playerid][pHouse]][hStatus])
  657.                {
  658.                        HouseInfo[PlayerInfo[playerid][pHouse]][hStatus] = 0;
  659.                                format(string, sizeof(string), ""COE"["CWE"%d, House (Lvl: %d)"COE"]\n"COE"Owner"CWE" %s\n"COE"Status"CWE" %s", idx, HouseInfo[idx][hLevel], HouseInfo[idx][hOwner], RHS(idx));
  660.                    UpdateDynamic3DTextLabelText(HouseInfo[PlayerInfo[playerid][pHouse]][hText], COLOR_WHITE, string);
  661.                        format(string, sizeof(string), "* %s takes out their house keys and locks it.", RPN(playerid));
  662.                                SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
  663.                                GameTextForPlayer(playerid, "~r~House Locked", 3500, 3);
  664.                        }
  665.                        done = 1;
  666.                        lockdone = 1;
  667.                }
  668.        }
  669.        if(PlayerInfo[playerid][pVHouse] && !done)
  670.        {
  671.                idx = PlayerInfo[playerid][pVHouse];
  672.                if(IsPlayerInRangeOfPoint(playerid, 2, HouseInfo[idx][hX], HouseInfo[idx][hY], HouseInfo[idx][hZ]))
  673.            {
  674.                if(!HouseInfo[PlayerInfo[playerid][pVHouse]][hStatus])
  675.                {
  676.                        HouseInfo[PlayerInfo[playerid][pVHouse]][hStatus] = 1;
  677.                                format(string, sizeof(string), ""COE"["CWE"%d, House (Lvl: %d)"COE"]\n"COE"Owner"CWE" %s\n"COE"Status"CWE" %s", idx, HouseInfo[idx][hLevel], HouseInfo[idx][hOwner], RHS(idx));
  678.                    UpdateDynamic3DTextLabelText(HouseInfo[PlayerInfo[playerid][pVHouse]][hText], COLOR_WHITE, string);
  679.                        format(string, sizeof(string), "* %s takes out their house keys and unlocks it.", RPN(playerid));
  680.                                SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
  681.                                GameTextForPlayer(playerid, "~g~House Unlocked", 3500, 3);
  682.                        }
  683.                        else if(HouseInfo[PlayerInfo[playerid][pVHouse]][hStatus])
  684.                {
  685.                        HouseInfo[PlayerInfo[playerid][pVHouse]][hStatus] = 0;
  686.                                format(string, sizeof(string), ""COE"["CWE"%d, House (Lvl: %d)"COE"]\n"COE"Owner"CWE" %s\n"COE"Status"CWE" %s", idx, HouseInfo[idx][hLevel], HouseInfo[idx][hOwner], RHS(idx));
  687.                    UpdateDynamic3DTextLabelText(HouseInfo[PlayerInfo[playerid][pVHouse]][hText], COLOR_WHITE, string);
  688.                        format(string, sizeof(string), "* %s takes out their house keys and locks it.", RPN(playerid));
  689.                                SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
  690.                                GameTextForPlayer(playerid, "~r~House Locked", 3500, 3);
  691.                        }
  692.                        lockdone = 1;
  693.                        return 1;
  694.                }
  695.        }
  696.        return 1;
  697.    if(!lockdone)
  698.        {
  699.            SendClientMessage(playerid, COLOR_GREY, "You are not near something you can lock/unlock.");
  700.        }
  701.        return 1;
  702. }
  703. CMD:sellhousetomarket(playerid, params[])
  704. {
  705.        new string[128], done;
  706.  
  707.        if(!PlayerInfo[playerid][pHouse] && !PlayerInfo[playerid][pVHouse]) return SendClientMessage(playerid, COLOR_GREY, "You don't own a house.");
  708.        if(sscanf(params, "s[8]", params)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /sellhousetomarket confirm");
  709.        if(!strcmp(params, "confirm", true))
  710.        {
  711.            new idx = PlayerInfo[playerid][pHouse];
  712.            if(IsPlayerInRangeOfPoint(playerid, 2, HouseInfo[PlayerInfo[playerid][pHouse]][hX], HouseInfo[PlayerInfo[playerid][pHouse]][hY], HouseInfo[PlayerInfo[playerid][pHouse]][hZ]))
  713.            {
  714.                GivePlayerMoney(playerid, (75*HouseInfo[PlayerInfo[playerid][pHouse]][hPrice])/100);
  715.                        HouseInfo[PlayerInfo[playerid][pHouse]][hStatus] = 0;
  716.                    format(HouseInfo[PlayerInfo[playerid][pHouse]][hOwner], 32, "The State");
  717.                    format(string, sizeof(string), ""COE"["CWE"%d, House (Lvl: %d)"COE"]\n"COE"Owner"CWE" %s\n"COE"Status"CWE" For Sale\n"CWE"$%d", idx, HouseInfo[idx][hLevel], HouseInfo[idx][hOwner], HouseInfo[idx][hPrice]);
  718.                    UpdateDynamic3DTextLabelText(HouseInfo[PlayerInfo[playerid][pHouse]][hText], COLOR_WHITE, string);
  719.                    PlayerInfo[playerid][pHouse] = 0;
  720.                    SendClientMessage(playerid, COLOR_GREEN, " You have successfully sold your house to The State. (75 percent of the original price was paid back)");
  721.            format(string, sizeof(string), "%s has sold house id %d to the market.", RPN(playerid), idx);
  722.                        Log("logs/house.log", string);
  723.                        done = 1;
  724.            }
  725.                if(!done)
  726.                {
  727.                        idx = PlayerInfo[playerid][pVHouse];
  728.                    if(IsPlayerInRangeOfPoint(playerid, 2, HouseInfo[idx][hX], HouseInfo[idx][hY], HouseInfo[idx][hZ]))
  729.                    {
  730.                        GivePlayerMoney(playerid, (75*HouseInfo[idx][hPrice])/100);
  731.                                HouseInfo[idx][hStatus] = 0;
  732.                            format(HouseInfo[idx][hOwner], 32, "The State");
  733.                            format(string, sizeof(string), ""COE"["CWE"%d, House (Lvl: %d)"COE"]\n"COE"Owner"CWE" %s\n"COE"Status"CWE" For Sale\n"CWE"$%d", idx, HouseInfo[idx][hLevel], HouseInfo[idx][hOwner], HouseInfo[idx][hPrice]);
  734.                            UpdateDynamic3DTextLabelText(HouseInfo[idx][hText], COLOR_WHITE, string);
  735.                            PlayerInfo[playerid][pVHouse] = 0;
  736.                            SendClientMessage(playerid, COLOR_GREEN, " You have successfully sold your house to The State. (75 percent of the original price was paid back)");
  737.                    format(string, sizeof(string), "%s has sold house id %d to the market.", RPN(playerid), idx);
  738.                                Log("logs/house.log", string);
  739.                                done = 1;
  740.                    }
  741.                }
  742.            if(!done)
  743.            {
  744.                SendClientMessage(playerid, COLOR_GREY, "You are not near your house.");
  745.                return 1;
  746.            }
  747.    }
  748.        return 1;
  749. }
  750. CMD:hdeposit(playerid, params[])
  751. {
  752.    new string[128], option[32], amount;
  753.    new idx = PlayerInfo[playerid][pHouse];
  754.  
  755.    if(!PlayerInfo[playerid][pHouse] && !PlayerInfo[playerid][pVHouse]) return SendClientMessage(playerid, COLOR_GREY, "You don't own a house.");
  756.    if(GetPlayerVirtualWorld(playerid)-500 != idx && !PlayerInfo[playerid][pVHouse]) return SendClientMessage(playerid, COLOR_GREY, "You are not inside your house.");
  757.    if(GetPlayerVirtualWorld(playerid)-500 != idx && PlayerInfo[playerid][pVHouse])
  758.        {
  759.                idx = PlayerInfo[playerid][pVHouse];
  760.            if(GetPlayerVirtualWorld(playerid)-500 != idx) return SendClientMessage(playerid, COLOR_GREY, "You are not inside your house.");
  761.        }
  762.        if(sscanf(params, "s[32]", option))
  763.    {
  764.        SendClientMessage(playerid, COLOR_WHITE, "USAGE: /hdeposit [item]");
  765.        SendClientMessage(playerid, COLOR_GREY, "ITEMS: money ");
  766. /*        format(string, sizeof(string), "SAFE: $%d | %d Weed | %d Crack", HouseInfo[idx][hMoney], HouseInfo[idx][hWeed], HouseInfo[idx][hCrack]);
  767.                SendClientMessage(playerid, COLOR_WHITE, string);
  768.                format(string, sizeof(string), "SAFE: Weapon 1: %s (%d Ammo) | Weapon 2: %s (%d Ammo) | Weapon 3: %s (%d Ammo)", RWN(HouseInfo[idx][hGun][0]), HouseInfo[idx][hGunAmmo][0], RWN(HouseInfo[idx][hGun][1]), HouseInfo[idx][hGunAmmo][1], RWN(HouseInfo[idx][hGun][2]), HouseInfo[idx][hGunAmmo][2]);
  769.        SendClientMessage(playerid, COLOR_WHITE, string);
  770.                format(string, sizeof(string), "SAFE: Weapon 4: %s (%d Ammo) | Weapon 5: %s (%d Ammo)", RWN(HouseInfo[idx][hGun][3]), HouseInfo[idx][hGunAmmo][3], RWN(HouseInfo[idx][hGun][4]), HouseInfo[idx][hGunAmmo][4]);
  771.        SendClientMessage(playerid, COLOR_WHITE, string);*/
  772.                return 1;
  773.    }
  774.        if(sscanf(params, "s[32]", option))
  775.        {
  776.                SendClientMessage(playerid, COLOR_WHITE, "USAGE: /hdeposit [item]");
  777.                SendClientMessage(playerid, COLOR_GREY, "ITEMS: money");
  778.                return 1;
  779.        }
  780.        if(!strcmp(option, "money", true, 5))
  781.        {
  782.  
  783.                if(sscanf(params, "s[32]i", option, amount)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /hsafe deposit money [amount]");
  784.                if(GetPlayerMoney(playerid) < amount ) return SendClientMessage(playerid, COLOR_GREY, "Shoma in Andaze Pool Nadarid.");
  785.        if(amount < 1) return SendClientMessage(playerid,COLOR_RED,"Money should be more than $1");
  786.                HouseInfo[idx][hMoney] += amount;
  787.                GivePlayerMoney(playerid, -amount);
  788.                format(string, sizeof(string), "* %s opens their vault, puts $%d inside and closes it.", RPN(playerid), amount);
  789.        SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
  790.  
  791.  
  792.        }
  793. return 1;
  794. }
  795. CMD:hwithdraw(playerid, params[])
  796. {
  797.        new string[128], option[32], amount;
  798.        new idx = PlayerInfo[playerid][pHouse];
  799.  
  800.    if(!PlayerInfo[playerid][pHouse] && !PlayerInfo[playerid][pVHouse]) return SendClientMessage(playerid, COLOR_GREY, "You don't own a house.");
  801.    if(GetPlayerVirtualWorld(playerid)-500 != idx && !PlayerInfo[playerid][pVHouse]) return SendClientMessage(playerid, COLOR_GREY, "You are not inside your house.");
  802.    if(GetPlayerVirtualWorld(playerid)-500 != idx && PlayerInfo[playerid][pVHouse])
  803.        {
  804.                idx = PlayerInfo[playerid][pVHouse];
  805.            if(GetPlayerVirtualWorld(playerid)-500 != idx) return SendClientMessage(playerid, COLOR_GREY, "You are not inside your house.");
  806.        }
  807.    if(sscanf(params, "s[32]", option))
  808.    {
  809.        SendClientMessage(playerid, COLOR_WHITE, "USAGE: /hsafe withdraw [item]");
  810.        SendClientMessage(playerid, COLOR_GREY, "ITEMS:  money");
  811.        /*format(string, sizeof(string), "SAFE: $%d | %d Weed | %d Crack", HouseInfo[idx][hMoney], HouseInfo[idx][hWeed], HouseInfo[idx][hCrack]);
  812.                SendClientMessage(playerid, COLOR_WHITE, string);
  813.                format(string, sizeof(string), "SAFE: Weapon 1: %s (%d Ammo) | Weapon 2: %s (%d Ammo) | Weapon 3: %s (%d Ammo)", RWN(HouseInfo[idx][hGun][0]), HouseInfo[idx][hGunAmmo][0], RWN(HouseInfo[idx][hGun][1]), HouseInfo[idx][hGunAmmo][1], RWN(HouseInfo[idx][hGun][2]), HouseInfo[idx][hGunAmmo][2]);
  814.        SendClientMessage(playerid, COLOR_WHITE, string);
  815.                format(string, sizeof(string), "SAFE: Weapon 4: %s (%d Ammo) | Weapon 5: %s (%d Ammo)", RWN(HouseInfo[idx][hGun][3]), HouseInfo[idx][hGunAmmo][3], RWN(HouseInfo[idx][hGun][4]), HouseInfo[idx][hGunAmmo][4]);
  816.        SendClientMessage(playerid, COLOR_WHITE, string);*/
  817.                return 1;
  818.    }
  819.    if(!strcmp(option, "money", true, 5))
  820.    {
  821.        if(sscanf(params, "s[32]i", option, amount)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /hsafe withdraw money [amount]");
  822.        if(HouseInfo[idx][hMoney] < amount) return SendClientMessage(playerid, COLOR_GREY, "You don't have that much money in your house vault.");
  823.        HouseInfo[idx][hMoney] -= amount;
  824.        GivePlayerMoney(playerid, amount);
  825.        format(string, sizeof(string), "* %s opens their vault, takes $%d and closes it.", RPN(playerid), amount);
  826.                SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
  827.    }
  828.    return 1;
  829. }
  830. CMD:Househelp(playerid, params[])
  831. {
  832.  
  833.        SendClientMessage(playerid, COLOR_ORANGE, ""COE"---------------------["CWE" HouseHelp "COE"]---------------------");
  834.        SendClientMessage(playerid, COLOR_YELLOW, "[HOUSE]: {FFFFFF}/buyhouse /hdeposit /hwithdraw /hlock /houseupgrade /sellhousetomarket /heal");
  835.    return 1;
  836. }
  837. CMD:heal(playerid, params[])
  838. {
  839.    if(!IsAtHouse(playerid)) return SendClientMessage(playerid, COLOR_GREY, "   Shoma Nistid Dar  House");
  840.        if(GetPlayerMoney(playerid) < 100) return SendClientMessage(playerid, COLOR_GREY, "You Dont Have This Much cash. ($100)");
  841.        ShowPlayerDialog(playerid,829,DIALOG_STYLE_MSGBOX,"Health & Armor","================================\nThis will cost 100$\n\nType: Health & Armour Recovery","Pay","Enseraf");
  842.        return 1;
  843.        }
  844. CMD:enter(playerid,params[])
  845. {
  846. new string[128];
  847. for(new idx=1; idx<MAX_HOUSES; idx++) // Dynamic Houses
  848.        {
  849.                if(IsPlayerInRangeOfPoint(playerid, 2, HouseInfo[idx][hX], HouseInfo[idx][hY], HouseInfo[idx][hZ]))
  850.            {
  851.                    if(!HouseInfo[idx][hStatus] && PlayerInfo[playerid][pHouse] != idx && PlayerInfo[playerid][pVHouse] != idx) return SendClientMessage(playerid, COLOR_GREY, "This house is locked.");
  852.                format(string, sizeof(string), "* %s pushes the door and enters the house.", RPN(playerid));
  853.                        if(PlayerInfo[playerid][pMaskOn] == 1)
  854.                        {
  855.                           format(string, sizeof(string), "* Stranger pushes the door and enters the house.");
  856.                        }
  857.                        else
  858.                        {
  859.                                format(string, sizeof(string), "* %s pushes the door and enters the house.", RPN(playerid));
  860.                        }
  861.                        SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
  862.                SetPlayerVirtualWorld(playerid, idx+500);
  863.                        if(HouseInfo[idx][hLevel] == 1)
  864.                        {
  865.                                SetPlayerPos(playerid, 243.9951,304.9418,999.1484);
  866.                        SetPlayerFacingAngle(playerid, 267.0980);
  867.                        SetCameraBehindPlayer(playerid);
  868.                        SetPlayerInterior(playerid, 1);
  869.                        }
  870.                        else if(HouseInfo[idx][hLevel] == 2)
  871.                        {
  872.                                SetPlayerPos(playerid, 2259.6702,-1135.8542,1050.6328);
  873.                        SetPlayerFacingAngle(playerid, 267.3974);
  874.                        SetCameraBehindPlayer(playerid);
  875.                        SetPlayerInterior(playerid, 10);
  876.                        }
  877.                        else if(HouseInfo[idx][hLevel] == 3)
  878.                        {
  879.                                SetPlayerPos(playerid, 2308.8254,-1212.8070,1049.0234);
  880.                        SetPlayerFacingAngle(playerid, 359.8550);
  881.                        SetCameraBehindPlayer(playerid);
  882.                        SetPlayerInterior(playerid, 6);
  883.                        }
  884.                        else if(HouseInfo[idx][hLevel] == 4)
  885.                        {
  886.                                SetPlayerPos(playerid, 260.7436,1237.5563,1084.2578);
  887.                        SetPlayerFacingAngle(playerid, 1.6415);
  888.                        SetCameraBehindPlayer(playerid);
  889.                        SetPlayerInterior(playerid, 9);
  890.                        }
  891.                        else if(HouseInfo[idx][hLevel] == 5)
  892.                        {
  893.                                SetPlayerPos(playerid, -42.5742,1405.6521,1084.4297);
  894.                        SetPlayerFacingAngle(playerid, 359.1347);
  895.                        SetCameraBehindPlayer(playerid);
  896.                        SetPlayerInterior(playerid, 8);
  897.                        }
  898.                        else if(HouseInfo[idx][hLevel] == 6)
  899.                        {
  900.                                SetPlayerPos(playerid, 2468.6787,-1698.2617,1013.5078);
  901.                        SetPlayerFacingAngle(playerid, 89.1791);
  902.                        SetCameraBehindPlayer(playerid);
  903.                        SetPlayerInterior(playerid, 2);
  904.                        }
  905.                        else if(HouseInfo[idx][hLevel] == 7)
  906.                        {
  907.                                SetPlayerPos(playerid, 2365.2183,-1135.4014,1050.8750);
  908.                        SetPlayerFacingAngle(playerid, 359.8550);
  909.                        SetCameraBehindPlayer(playerid);
  910.                        SetPlayerInterior(playerid, 8);
  911.                        }
  912.                        else if(HouseInfo[idx][hLevel] == 8)
  913.                        {
  914.                                SetPlayerPos(playerid, 2270.1270,-1210.4855,1047.5625);
  915.                        SetPlayerFacingAngle(playerid, 89.4224);
  916.                        SetCameraBehindPlayer(playerid);
  917.                        SetPlayerInterior(playerid, 10);
  918.                        }
  919.                        else if(HouseInfo[idx][hLevel] == 9)
  920.                        {
  921.                                SetPlayerPos(playerid, 2324.4424,-1149.2057,1050.7101);
  922.                        SetPlayerFacingAngle(playerid, 0.7248);
  923.                        SetCameraBehindPlayer(playerid);
  924.                        SetPlayerInterior(playerid, 12);
  925.                        }
  926.                        else if(HouseInfo[idx][hLevel] == 10)
  927.                        {
  928.                                SetPlayerPos(playerid, 83.0863,1322.3020,1083.8662);
  929.                        SetPlayerFacingAngle(playerid, 359.5183);
  930.                        SetCameraBehindPlayer(playerid);
  931.                        SetPlayerInterior(playerid, 9);
  932.                        }
  933.                        else if(HouseInfo[idx][hLevel] == 11)
  934.                        {
  935.                                SetPlayerPos(playerid, 225.6631,1022.3559,1084.0150);
  936.                        SetPlayerFacingAngle(playerid, 359.5183);
  937.                        SetCameraBehindPlayer(playerid);
  938.                        SetPlayerInterior(playerid, 7);
  939.                        }
  940.                }
  941.        }
  942.        return 1;
  943. }
  944. CMD:houseupgrade(playerid, params[])
  945. {
  946.        new string[128], idx = PlayerInfo[playerid][pHouse], price;
  947.    if(!PlayerInfo[playerid][pHouse]) return SendClientMessage(playerid, COLOR_GREY, "You don't own a house.");
  948.        if(!PlayerInfo[playerid][pVHouse])
  949.        {
  950.            if(!IsPlayerInRangeOfPoint(playerid, 2, HouseInfo[idx][hX], HouseInfo[idx][hY], HouseInfo[idx][hZ])) return SendClientMessage(playerid, COLOR_GREY, "You are not near your house.");
  951.        }
  952.        else
  953.        {
  954.            new done;
  955.            if(!IsPlayerInRangeOfPoint(playerid, 2, HouseInfo[idx][hX], HouseInfo[idx][hY], HouseInfo[idx][hZ]))
  956.                {
  957.                        done ++;
  958.                    idx = PlayerInfo[playerid][pVHouse];
  959.                    if(!IsPlayerInRangeOfPoint(playerid, 2, HouseInfo[idx][hX], HouseInfo[idx][hY], HouseInfo[idx][hZ])) done ++;
  960.                }
  961.                if(done == 2) return SendClientMessage(playerid, COLOR_GREY, "You are not near your house.");
  962.  
  963.        }
  964.        if(sscanf(params, "s[8]", params)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /houseupgrade confirm");
  965.        if(HouseInfo[idx][hLevel] >= 11) return SendClientMessage(playerid, COLOR_GREY, "Your house already has the maximum level possible.");
  966.        if(!strcmp(params, "confirm", true))
  967.        {
  968.            price = 500000;
  969.                if(GetPlayerMoney(playerid) < price)
  970.                {
  971.                    format(string, sizeof(string), "You need $%d to upgrade your house.", price);
  972.                        SendClientMessage(playerid, COLOR_GREY, string);
  973.                        return 1;
  974.                }
  975.                HouseInfo[idx][hLevel] ++;
  976.                GivePlayerMoney(playerid, -price);
  977.                format(string, sizeof(string), " You have upgraded your house to level %d.", HouseInfo[idx][hLevel]);
  978.                SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
  979.                format(string, sizeof(string), ""COE"["CWE"%d, House (Lvl: %d)"COE"]\n"COE"Owner"CWE" %s\n"COE"Status"CWE" %s", idx, HouseInfo[idx][hLevel], HouseInfo[idx][hOwner], RHS(idx));
  980.                UpdateDynamic3DTextLabelText(HouseInfo[idx][hText], COLOR_WHITE, string);
  981.        }
  982.        return 1;
  983. }
  984. CMD:savehouses(playerid, params[])
  985. {
  986.        if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You are not rcon admin.");
  987.        SaveHouses();
  988.    new string[128];
  989.    format(string, sizeof(string), "{FF0000}[Manual Save]{FF6347} houses are saved");
  990.        SendClientMessageToAll(COLOR_LIGHTRED, string);
  991.        return 1;
  992. }
  993. /*new playername[MAX_PLAYER_NAME];
  994.  
  995. CMD:makerentable(playerid,params[])
  996. {
  997.        new tmp[256];
  998.        new string[256];
  999.        new idx;
  1000.            if(IsPlayerConnected(playerid))
  1001.                {
  1002.                        new bouse = PlayerInfo[playerid][pPhousekey];
  1003.                        GetPlayerName(playerid, playername, sizeof(playername));
  1004.                        if (bouse != 255 && strcmp(playername, HouseInfo[PlayerInfo[playerid][pPhousekey]][hOwner], true) == 0)
  1005.                        {
  1006.                                tmp = strtok(params, idx);
  1007.                                if(!strlen(tmp))
  1008.                                {
  1009.                                        SendClientMessage(playerid, COLOR_WHITE, "USAGE: /setrentable [0/1]");
  1010.                                }
  1011.                                HouseInfo[bouse][hRentabil] = strval(tmp);
  1012.                                SaveHouses();
  1013.                                format(string, sizeof(string), "House rentable set to %d.", HouseInfo[bouse][hRentabil]);
  1014.                                SendClientMessage(playerid, COLOR_WHITE, string);
  1015.                                return 1;
  1016.                        }
  1017.                        else
  1018.                        {
  1019.                                SendClientMessage(playerid, COLOR_WHITE, "   You don't own a house !");
  1020.                                return 1;
  1021.                        }
  1022.                }
  1023.                return 1;
  1024.        }
  1025. CMD:setrent(playerid,params[])
  1026.        {
  1027.                new tmp[256];
  1028.        new string[256];
  1029.        new idx;
  1030.            if(IsPlayerConnected(playerid))
  1031.                {
  1032.                        new bouse = PlayerInfo[playerid][pPhousekey];
  1033.                        GetPlayerName(playerid, playername, sizeof(playername));
  1034.                        if (bouse != 255 && strcmp(playername, HouseInfo[PlayerInfo[playerid][pPhousekey]][hOwner], true) == 0)
  1035.                        {
  1036.                                tmp = strtok(params, idx);
  1037.                                if(!strlen(tmp))
  1038.                                {
  1039.                                        SendClientMessage(playerid, COLOR_WHITE, "USAGE: /setrent [RentFee]");
  1040.                                        return 1;
  1041.                                }
  1042.                                if(strval(tmp) < 1 || strval(tmp) > 9999)
  1043.                                {
  1044.                                        SendClientMessage(playerid, COLOR_WHITE, "Minimum rent is $1, Maximum rent is $9999.");
  1045.                                        return 1;
  1046.                                }
  1047.                                HouseInfo[bouse][hRent] = strval(tmp);
  1048.                                SaveHouses();
  1049.                                format(string, sizeof(string), "House rent set to $%s", FormatNumber(HouseInfo[bouse][hRent]));
  1050.                                SendClientMessage(playerid, COLOR_WHITE, string);
  1051.                                return 1;
  1052.                        }
  1053.                        else
  1054.                        {
  1055.                                SendClientMessage(playerid, COLOR_WHITE, "   You don't own a house");
  1056.                                return 1;
  1057.                        }
  1058.                }
  1059.                return 1;
  1060.        }
  1061. CMD:renthouse(playerid,params[])
  1062.        {
  1063.  
  1064.                if(IsPlayerConnected(playerid))
  1065.                {
  1066.                        new Float:oldposx, Float:oldposy, Float:oldposz;
  1067.                        GetPlayerName(playerid, playername, sizeof(playername));
  1068.                        GetPlayerPos(playerid, oldposx, oldposy, oldposz);
  1069.                        for(new h = 0; h < sizeof(HouseInfo); h++)
  1070.                        {
  1071.                if(PlayerToPoint(2.0, playerid, HouseInfo[h][hX], HouseInfo[h][hY], HouseInfo[h][hZ]) && HouseInfo[h][hOwned] == 1 &&  HouseInfo[h][hRentabil] == 1)
  1072.                                {
  1073.                                        if(HouseInfo[h][hInsurance] == 1)
  1074.                                        {
  1075.                                            SCM(playerid, COLOR_CRS2, "** This house has no insurance and you can not rent a room.");
  1076.                                            return 1;
  1077.                                        }
  1078.                                        if(PlayerInfo[playerid][pPhousekey] != 255 && strcmp(playername, HouseInfo[PlayerInfo[playerid][pPhousekey]][hOwner], true) == 0)
  1079.                                        {
  1080.                                                SendClientMessage(playerid, COLOR_WHITE, "** You already own a house, type /sellhouse if you want to rent this one.");
  1081.                                                return 1;
  1082.                                        }
  1083.                                        if(GetPlayerMoney(playerid) > HouseInfo[h][hRent])
  1084.                                        {
  1085.                                                PlayerInfo[playerid][pPhousekey] = h;
  1086.                                                PlayerInfo[playerid][pRented] = h;
  1087.                                                PlayerInfo[playerid][pRented] = 1;
  1088.                                                SafeGivePlayerMoney(playerid,-HouseInfo[h][hRent]);
  1089.                                                HouseInfo[h][hTakings] = HouseInfo[h][hTakings]+HouseInfo[h][hRent];
  1090. //                                              SetPlayerInterior(playerid,HouseInfo[h][hInt]);
  1091. //                                              SetPlayerVirtualWorld(playerid,HouseInfo[h][hWorld]);
  1092. //                                              PlayerInfo[playerid][pVirWorld] = HouseInfo[h][hWorld];
  1093. //                                              SetPlayerMapIcon(playerid,h + 20,HouseInfo[h][hEntrancex],HouseInfo[h][hEntrancey],HouseInfo[h][hEntrancez],31,COLOR_LIGHTRED);
  1094.                                                SetPlayerPos(playerid,HouseInfo[h][hX],HouseInfo[h][hY],HouseInfo[h][hZ]);
  1095.                                                GameTextForPlayer(playerid, "~w~Welcome Home~n~You can exit at any time by moving to this door and press enter", 5000, 3);
  1096.                                                PlayerInfo[playerid][pInt] = HouseInfo[h][hInt];
  1097.                                                PlayerInfo[playerid][pLocal] = h;
  1098.                                                SendClientMessage(playerid, COLOR_WHITE, "** Congratulations, You can enter and exit here anytime.");
  1099.                                                SendClientMessage(playerid, COLOR_WHITE, "** Type /help to review the new property help section.");
  1100.                                                OnPlayerUpdate(playerid);
  1101.                                                return 1;
  1102.                                        }
  1103.                                        else
  1104.                                        {
  1105.                                                SendClientMessage(playerid, COLOR_WHITE, "You don't have the cash for that");
  1106.                                                return 1;
  1107.                                        }
  1108.                                }
  1109.                        }
  1110.                }
  1111.                return 1;
  1112.        }
  1113. */
  1114.  
  1115.  
  1116.  
  1117.      
  1118.      
  1119.      
  1120.      
  1121.      
  1122.      
  1123.  
  1124.  
  1125.  
  1126.  
  1127. /*forward PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z);
  1128. public PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z)
  1129. {
  1130.    if(IsPlayerConnected(playerid))
  1131.        {
  1132.                new Float:oldposx, Float:oldposy, Float:oldposz;
  1133.                new Float:tempposx, Float:tempposy, Float:tempposz;
  1134.                GetPlayerPos(playerid, oldposx, oldposy, oldposz);
  1135.                tempposx = (oldposx -x);
  1136.                tempposy = (oldposy -y);
  1137.                tempposz = (oldposz -z);
  1138.                //printf("DEBUG: X:%f Y:%f Z:%f",posx,posy,posz);
  1139.                if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
  1140.                {
  1141.                        return 1;
  1142.                }
  1143.        }
  1144.        return 0;
  1145. }
  1146.  
  1147. FormatNumber(number)
  1148. {
  1149.   new Str[15];
  1150.   format(Str, 15, "%d", number);
  1151.  
  1152.   if (strlen(Str) < sizeof(Str))
  1153.   {
  1154.      if (number >= 1000 && number < 10000)
  1155.             strins( Str, ",", 1, sizeof(Str));
  1156.  
  1157.      else if (number >= 10000 && number < 100000)
  1158.           strins(Str, ",", 2, sizeof(Str));
  1159.  
  1160.      else if (number >= 100000 && number < 1000000)
  1161.           strins(Str, ",", 3, sizeof(Str));
  1162.  
  1163.      else if (number >= 1000000 && number < 10000000)
  1164.           strins(Str, ",", 1, sizeof(Str)),strins(Str, ",", 5, sizeof(Str));
  1165.  
  1166.      else if (number >= 10000000 && number < 100000000)
  1167.           strins(Str, ",", 2, sizeof(Str)),strins(Str, ",", 6, sizeof(Str));
  1168.  
  1169.      else if (number >= 100000000 && number < 1000000000)
  1170.           strins(Str, ",", 3, sizeof(Str)),strins(Str, ",", 7, sizeof(Str));
  1171.  
  1172.      else if (number >= 1000000000 && number < 10000000000)
  1173.           strins(Str, ",", 1, sizeof(Str)),
  1174.           strins(Str, ",", 5, sizeof(Str)),
  1175.           strins(Str, ",", 9, sizeof(Str));
  1176.      else format(Str, 10, "%d", number);
  1177.   }
  1178.   else  format( Str, 15, "<BUG>" );
  1179.   return Str;
  1180. }
  1181. strtok(const string[], &index)
  1182. {
  1183.        new length = strlen(string);
  1184.        while ((index < length) && (string[index] <= ' '))
  1185.        {
  1186.                index++;
  1187.        }
  1188.  
  1189.        new offset = index;
  1190.        new result[20];
  1191.        while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
  1192.        {
  1193.                result[index - offset] = string[index];
  1194.                index++;
  1195.        }
  1196.        result[index - offset] = EOS;
  1197.        return result;
  1198. }*/
  1199. stock split(const strsrc[], strdest[][], delimiter)
  1200. {
  1201.    new i, li;
  1202.    new aNum;
  1203.    new len;
  1204.    while(i <= strlen(strsrc))
  1205.    {
  1206.        if(strsrc[i] == delimiter || i == strlen(strsrc))
  1207.        {
  1208.            len = strmid(strdest[aNum], strsrc, li, i, 128);
  1209.            strdest[aNum][len] = 0;
  1210.            li = i+1;
  1211.            aNum++;
  1212.        }
  1213.        i++;
  1214.    }
  1215.    return 1;
  1216. }
  1217. stock IsPlayerLoggedIn(playerid)
  1218. {
  1219.        if(IsPlayerConnected(playerid))
  1220.        {
  1221.            if(PlayerInfo[playerid][pLoggedIn])
  1222.            {
  1223.                return 1;
  1224.            }
  1225.        }
  1226.        return 0;
  1227. }
  1228. stock RPN(playerid)
  1229. {
  1230.        new string[25];
  1231.        if(PlayerInfo[playerid][pMaskOn] == 0)format(string, sizeof(string), "%s");
  1232. //      else if(PlayerInfo[playerid][pMaskOn] == 1)format(string, sizeof(string), "Stranger");
  1233.        return string;
  1234. }
  1235. stock Log(sz_fileName[], sz_input[]) {
  1236.  
  1237.        new     sz_logEntry[156], i_dateTime[2][3], File: fileHandle = fopen(sz_fileName, io_append);
  1238.        gettime(i_dateTime[0][0], i_dateTime[0][1], i_dateTime[0][2]);
  1239.        getdate(i_dateTime[1][0], i_dateTime[1][1], i_dateTime[1][2]);
  1240.        format(sz_logEntry, sizeof(sz_logEntry), "[%i/%i/%i - %i:%i:%i] %s\r\n", i_dateTime[1][0], i_dateTime[1][1], i_dateTime[1][2], i_dateTime[0][0], i_dateTime[0][1], i_dateTime[0][2], sz_input);
  1241.        fwrite(fileHandle, sz_logEntry);
  1242.        return fclose(fileHandle);
  1243. }
  1244. stock RHS(bizid)
  1245. {
  1246.        new string[16];
  1247.        if(!HouseInfo[bizid][hStatus]) format(string, sizeof(string), "Closed");
  1248.    else if(HouseInfo[bizid][hStatus]) format(string, sizeof(string), "Open");
  1249.        return string;
  1250. }
  1251.  
  1252. stock RPNU(playerid)
  1253. {
  1254.        new name[MAX_PLAYER_NAME];
  1255.        GetPlayerName(playerid, name, sizeof(name));
  1256.        return name;
  1257. }
  1258. stock SendNearbyMessage(playerid, Float:radius, string[], col1, col2, col3, col4, col5)
  1259. {
  1260.        new Float:x, Float:y, Float:z;
  1261.        GetPlayerPos(playerid, x, y, z);
  1262.        new Float:ix, Float:iy, Float:iz;
  1263.        new Float:cx, Float:cy, Float:cz;
  1264.        foreach(Player, i)
  1265.        {
  1266.            if(IsPlayerLoggedIn(i))
  1267.            {
  1268.                if(GetPlayerInterior(playerid) == GetPlayerInterior(i) && GetPlayerVirtualWorld(playerid) == GetPlayerVirtualWorld(i))
  1269.                {
  1270.                                GetPlayerPos(i, ix, iy, iz);
  1271.                                cx = (x - ix);
  1272.                                cy = (y - iy);
  1273.                                cz = (z - iz);
  1274.                                if(((cx < radius/16) && (cx > -radius/16)) && ((cy < radius/16) && (cy > -radius/16)) && ((cz < radius/16) && (cz > -radius/16)))
  1275.                                {
  1276.                                    SendClientMessage(i, col1, string);
  1277.                                }
  1278.                                else if(((cx < radius/8) && (cx > -radius/8)) && ((cy < radius/8) && (cy > -radius/8)) && ((cz < radius/8) && (cz > -radius/8)))
  1279.                                {
  1280.                                    SendClientMessage(i, col2, string);
  1281.                                }
  1282.                                else if(((cx < radius/4) && (cx > -radius/4)) && ((cy < radius/4) && (cy > -radius/4)) && ((cz < radius/4) && (cz > -radius/4)))
  1283.                                {
  1284.                                    SendClientMessage(i, col3, string);
  1285.                                }
  1286.                                else if(((cx < radius/2) && (cx > -radius/2)) && ((cy < radius/2) && (cy > -radius/2)) && ((cz < radius/2) && (cz > -radius/2)))
  1287.                                {
  1288.                                    SendClientMessage(i, col4, string);
  1289.                                }
  1290.                                else if(((cx < radius) && (cx > -radius)) && ((cy < radius) && (cy > -radius)) && ((cz < radius) && (cz > -radius)))
  1291.                                {
  1292.                                    SendClientMessage(i, col5, string);
  1293.                                }
  1294.                        }
  1295.            }
  1296.        }
  1297.        return 1;
  1298. }
  1299.  
  1300. IsAtHouse(playerid)
  1301. {
  1302.        if(IsPlayerConnected(playerid))
  1303.        {
  1304.                if(IsPlayerInRangeOfPoint(playerid, 20.0, 243.9951, 304.9418, 999.1484)) // House 1
  1305.                {
  1306.                        return 1;
  1307.                }
  1308.                else if(IsPlayerInRangeOfPoint(playerid, 20.0, 2259.6702, -1135.8542, 1050.6328)) // House 2
  1309.                {
  1310.                        return 1;
  1311.                }
  1312.                else if(IsPlayerInRangeOfPoint(playerid, 20.0, 2308.8254, -1212.8070, 1049.0234)) // House 3
  1313.                {
  1314.                        return 1;
  1315.                }
  1316.                else if(IsPlayerInRangeOfPoint(playerid, 20.0, 260.7436, 1237.5563, 1084.2578)) // House 4
  1317.                {
  1318.                        return 1;
  1319.                }
  1320.                else if(IsPlayerInRangeOfPoint(playerid, 20.0, -42.5742, 1405.6521, 1084.4297)) // House 5
  1321.                {
  1322.                        return 1;
  1323.                }
  1324.                else if(IsPlayerInRangeOfPoint(playerid, 20.0, 2468.6787, -1698.2617, 1013.5078)) // House 6
  1325.                {
  1326.                        return 1;
  1327.                }
  1328.                else if(IsPlayerInRangeOfPoint(playerid, 20.0, 2365.2183, -1135.4014, 1050.8750)) // House 7
  1329.                {
  1330.                        return 1;
  1331.                }
  1332.                else if(IsPlayerInRangeOfPoint(playerid, 20.0, 2270.1270, -1210.4855, 1047.5625)) // House 8
  1333.                {
  1334.                        return 1;
  1335.                }
  1336.                else if(IsPlayerInRangeOfPoint(playerid, 20.0, 2324.4424, -1149.2057, 1050.7101)) // House 9
  1337.                {
  1338.                        return 1;
  1339.                }
  1340.                else if(IsPlayerInRangeOfPoint(playerid, 20.0, 83.0863, 1322.3020, 1083.8662)) // House 10
  1341.                {
  1342.                        return 1;
  1343.                }
  1344.                else if(IsPlayerInRangeOfPoint(playerid, 30.0, 225.6631,1022.3559,1084.0150)) // House 11
  1345.                {
  1346.                        return 1;
  1347.                }
  1348.        }
  1349.        return 0;
  1350. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement