Advertisement
Guest User

Leopard

a guest
Nov 29th, 2008
944
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 45.62 KB | None | 0 0
  1. #include <a_samp>
  2.  
  3. //Update Leopard 2008
  4.  
  5. new SaveFile[50] = "Houses.pwn";
  6.  
  7. //new CarFile[50] = "HouseCarCoord.pwn";
  8.  
  9. #define COLOR_BLUE 0x024EFDFF
  10. #define COLOR_YELLOW 0xFAD029FF
  11. /*
  12. new RandomColors[7][1] =
  13. {
  14.     {0}, //Black
  15.     {2}, //Blue
  16.     {42}, //Red
  17.     {6}, //Yellow/Orange
  18.     {126}, //Pink
  19.     {33}, //Grey
  20.     {86} //Green
  21. };
  22.  
  23. //============================{ Cars )
  24.  
  25. new RandomCarsSmall[4][1] =
  26. {
  27.     {496}, //Blista
  28.     {410}, //Manana
  29.     {529}, //Willard
  30.     {589} //Club
  31. };
  32.  
  33. new RandomCarsMedium[6][1] =
  34. {
  35.     {542},//Clover
  36.     {445},//Admiral
  37.     {562},//Elegy
  38.     {533},//Feltzer
  39.     {426},//Premier
  40.     {560}//Sultan
  41. };
  42.  
  43. new RandomCarsModern[7][1] =
  44. {
  45.     {477},//zr350
  46.     {551},//Merit
  47.     {558},//Uranus
  48.     {559},//Jester
  49.     {561},//Stratum (Family car)
  50.     {587},//Euros
  51.     {522}//NRG
  52. };
  53.  
  54. new RandomCarsMansion[8][1]=
  55. {
  56.     {409},//Stretch
  57.     {411},//Infernus
  58.     {415},//Cheetah
  59.     {429},//Banshee
  60.     {451},//Turismo
  61.     {480},//Comet
  62.     {506},//SuperGT
  63.     {541}//Bullet
  64. };
  65. */
  66.  
  67. new HouseID;
  68. //new HouseCarID;
  69.  
  70. enum nameENUM
  71. {
  72.     name[256]
  73. };
  74.  
  75. new HouseInfo[400][nameENUM]; //max pickup=400
  76.  
  77. new saved[MAX_OBJECTS];
  78.  
  79. public OnFilterScriptInit()
  80. {
  81.     print("\n----------------------------------------------------");
  82.     print(" Coords-Saver by Rafelder, Heavily modified by Leopard");
  83.     print("                                                LOADED");
  84.     print("-------------------------------------------------------\n");
  85.     WritePwn();
  86.     return 1;
  87. }
  88.  
  89. public OnFilterScriptExit()
  90. {
  91.     print("\n----------------------------------------------------");
  92.     print(" Coords-Saver by Rafelder, Heavily modified by Leopard");
  93.     print("                                              UNLOADED");
  94.     print("-------------------------------------------------------\n");
  95.     for(new i; i < GetMaxPlayers(); i++)
  96.     {
  97.         if(IsPlayerConnected(i))
  98.         {
  99.             for(new h = 0; h < MAX_OBJECTS; h++)
  100.             {
  101.                 DestroyPlayerObject(i, saved[h]);
  102.             }
  103.         }
  104.     }
  105.     WritePwn();
  106. }
  107.  
  108. public OnPlayerConnect(playerid)
  109. {
  110.     SendClientMessage(playerid, COLOR_YELLOW, "SERVER: House mode on. Type /savehousehelp for a list of commands. Type /done when you are done.");
  111.     return 1;
  112. }
  113.  
  114.  
  115. public OnPlayerCommandText(playerid, cmdtext[])
  116. {
  117.     if(IsPlayerAdmin(playerid))
  118.     {
  119.         //deactivated until later
  120. /*      if (strcmp(cmdtext, "/carsmall", true) == 0)
  121.         {
  122.             new vID = HouseCarID++;
  123.             new Float:X, Float:Y, Float:Z, Float:Angle;
  124.             new str[256];
  125.             new File:iCarFile = fopen(CarFile, io_append);
  126.             new rand = random(sizeof(RandomCarsSmall));
  127.             new iColorRandom = random(sizeof(RandomColors));
  128.            
  129.             GetPlayerPos(playerid, X, Y, Z);
  130.             GetPlayerFacingAngle(playerid, Float:Angle);
  131.             format(str, 256, "AddHouseCar(%d, %d, %f, %f, %f, %f, %d, %d, 5*60*1000); //small types of car\r\n", vID, RandomCarsSmall[rand][0], X, Y, Z, Angle, RandomColors[iColorRandom][0], RandomColors[iColorRandom][0]);
  132.             print(str);
  133.             fwrite(iCarFile, str);
  134.             fclose(iCarFile);
  135.             SendClientMessage(playerid, COLOR_BLUE, str);
  136.             CreatePlayerObject(playerid, 1277, X, Y, Z, 0, 0, 0);
  137.             return 1;
  138.         }
  139.         if(strcmp(cmdtext, "/carmedium", true) == 0)
  140.         {
  141.             new vID = HouseCarID++;
  142.             new Float:X, Float:Y, Float:Z, Float:Angle;
  143.             new str[256];
  144.             new File:iCarFile = fopen(CarFile, io_append);
  145.             new Random = random(sizeof(RandomCarsMedium)); //5 car's to choose
  146.             new iColorRandom = random(sizeof(RandomColors));
  147.            
  148.             GetPlayerPos(playerid, X, Y, Z);
  149.             GetPlayerFacingAngle(playerid, Float:Angle);
  150.             format(str, 256, "AddHouseCar(%d, %d, %f, %f, %f, %f, %d, %d, 5*60*1000); //medium car\r\n", vID, RandomCarsMedium[Random][0], X, Y, Z, Angle, RandomColors[iColorRandom][0], RandomColors[iColorRandom][0]);
  151.             print(str);
  152.             fwrite(iCarFile, str);
  153.             fclose(iCarFile);
  154.             SendClientMessage(playerid, COLOR_BLUE, str);
  155.             CreatePlayerObject(playerid, 1277, X, Y, Z, 0, 0, 0);
  156.             return 1;
  157.         }
  158.         if(strcmp(cmdtext, "/carmodern", true) == 0)
  159.         {
  160.             new vID = HouseCarID++;
  161.             new Float:X, Float:Y, Float:Z, Float:Angle;
  162.             new str[256];
  163.             new File:iCarFile = fopen(CarFile, io_append);
  164.             new Random = random(sizeof(RandomCarsModern));
  165.             new iColorRandom = random(sizeof(RandomColors));
  166.  
  167.             GetPlayerPos(playerid, X, Y, Z);
  168.             GetPlayerFacingAngle(playerid, Float:Angle);
  169.             format(str, 256, "AddHouseCar(%d, %d, %f, %f, %f, %f, %d, %d, 5*60*1000); //carmodern\r\n", vID, RandomCarsModern[Random][0], X, Y, Z, Angle, RandomColors[iColorRandom][0], RandomColors[iColorRandom][0]);
  170.             print(str);
  171.             fwrite(iCarFile, str);
  172.             fclose(iCarFile);
  173.             SendClientMessage(playerid, COLOR_BLUE, str);
  174.             CreatePlayerObject(playerid, 1277, X, Y, Z, 0, 0, 0);
  175.             return 1;
  176.         }
  177.         if(strcmp(cmdtext, "/carmansion", true) == 0)
  178.         {
  179.             new vID = HouseCarID++;
  180.             new Float:X, Float:Y, Float:Z, Float:Angle;
  181.             new str[256];
  182.             new File:iCarFile = fopen(CarFile, io_append);
  183.             new Random = random(sizeof(RandomCarsMansion));
  184.             new iColorRandom = random(sizeof(RandomColors));
  185.  
  186.             GetPlayerPos(playerid, X, Y, Z);
  187.             GetPlayerFacingAngle(playerid, Float:Angle);
  188.             format(str, 256, "AddHouseCar(%d, %d, %f, %f, %f, %f, %d, %d, 5*60*1000); //mansion type car\r\n", vID, RandomCarsMansion[Random][0], X, Y, Z, Angle, RandomColors[iColorRandom][0], RandomColors[iColorRandom][0]);
  189.             print(str);
  190.             fwrite(iCarFile, str);
  191.             fclose(iCarFile);
  192.             SendClientMessage(playerid, COLOR_BLUE, str);
  193.             CreatePlayerObject(playerid, 1277, X, Y, Z, 0, 0, 0);
  194.             return 1;
  195.         }
  196.         */
  197.         //beginning of house
  198.  
  199.         if (strcmp(cmdtext, "/housesmall", true) == 0)
  200.         {
  201.             new ID = HouseID++;
  202.             new Float:X, Float:Y, Float:Z;
  203.  
  204.             GetPlayerPos(playerid, X, Y, Z);
  205.            
  206.             format(HouseInfo[ID][name], sizeof(HouseInfo), "AddHouse(%d, %f, %f, %f, 2251.85, -1138.16, 1050.63, 50000, 49000, 9, %d); //Small house\r\n", ID, X, Y, Z, random(255));
  207.             print(HouseInfo[ID][name]);
  208.             SendClientMessage(playerid, COLOR_YELLOW, HouseInfo[ID]);
  209.             saved[ID] = CreatePlayerObject(playerid, 1273, Float:X, Float:Y, Float:Z, 0, 0, 0);
  210.             return 1;
  211.         }
  212.         if (strcmp(cmdtext, "/housemedium", true) == 0)
  213.         {
  214.             new ID = HouseID++;
  215.             new Float:X, Float:Y, Float:Z;
  216.  
  217.             GetPlayerPos(playerid, X, Y, Z);
  218.             format(HouseInfo[ID][name], sizeof(HouseInfo), "AddHouse(%d, %f, %f, %f, 2496.65, -1696.55, 1014.74, 10000, 90000, 3, %d);//Medium House\r\n", ID, X, Y, Z, random(255));
  219.             print(HouseInfo[ID][name]);
  220.             SendClientMessage(playerid, COLOR_YELLOW, HouseInfo[ID]);
  221.             saved[ID] = CreatePlayerObject(playerid, 1273, Float:X, Float:Y, Float:Z, 0, 0, 0);
  222.             return 1;
  223.         }
  224.         if (strcmp(cmdtext, "/housemodern", true) == 0)
  225.         {
  226.             new ID = HouseID++;
  227.             new Float:X, Float:Y, Float:Z;
  228.  
  229.             GetPlayerPos(playerid, X, Y, Z);
  230.             format(HouseInfo[ID][name], sizeof(HouseInfo), "AddHouse(%d, %f, %f, %f, 2324.33, -1144.79, 1050.71, 150000, 140000, 12, %d);//Big house\r\n", ID, X, Y, Z, random(255));
  231.             print(HouseInfo[ID][name]);
  232.             SendClientMessage(playerid, COLOR_YELLOW, HouseInfo[ID]);
  233.             saved[ID] = CreatePlayerObject(playerid, 1273, Float:X, Float:Y, Float:Z, 0, 0, 0);
  234.             return 1;
  235.         }
  236.         if (strcmp(cmdtext, "/housemansion", true) == 0)
  237.         {
  238.             new ID = HouseID++;
  239.             new Float:X, Float:Y, Float:Z;
  240.  
  241.             GetPlayerPos(playerid, X, Y, Z);
  242.             format(HouseInfo[ID][name], sizeof(HouseInfo), "AddHouse(%d, %f, %f, %f, 1299.14, -794.77, 1084.00, 30000, 31090, 5, %d); //Mansion\r\n", ID, X, Y, Z, random(255));
  243.             print(HouseInfo[ID][name]);
  244.             SendClientMessage(playerid, COLOR_YELLOW, HouseInfo[ID]);
  245.             saved[ID] = CreatePlayerObject(playerid, 1273, Float:X, Float:Y, Float:Z, 0, 0, 0);
  246.             return 1;
  247.         }
  248.         if (strcmp(cmdtext, "/savehousehelp", true) == 0)
  249.         {
  250.             SendClientMessage(playerid, COLOR_BLUE, "---===[ HouseSave For House Inc By Antironix ]===---");
  251.             SendClientMessage(playerid, COLOR_YELLOW, "-=> Type /housesmall to save pos for a small house");
  252.             SendClientMessage(playerid, COLOR_YELLOW, "-=> Type /housemedium to save pos for medium house");
  253.             SendClientMessage(playerid, COLOR_YELLOW, "-=> Type /housemodern to save a pos for a modern house");
  254.             SendClientMessage(playerid, COLOR_YELLOW, "-=> Type /housemansion to save a house as a mansion");
  255.             SendClientMessage(playerid, COLOR_YELLOW, "-=> Type \"/savecarhelp\" for a list of car commands");
  256.             SendClientMessage(playerid, COLOR_BLUE, "--===[-------------Have a nice day!-----------]===--");
  257.             return 1;
  258.         }
  259.         /*
  260.         if(strcmp(cmdtext, "/savecarhelp", true) == 0)
  261.         {
  262.             SendClientMessage(playerid, COLOR_BLUE, "----===[ CarSave For House Inc By Antironix ]===----");
  263.             SendClientMessage(playerid, COLOR_YELLOW, "-=> Type /carsmall to save a car for a small house");
  264.             SendClientMessage(playerid, COLOR_YELLOW, "-=> Type /carmedium to save a car for a medium house");
  265.             SendClientMessage(playerid, COLOR_YELLOW, "-=> Type /carmodern to save a car for a modern house");
  266.             SendClientMessage(playerid, COLOR_YELLOW, "-=> Type /carmansion to save a car for a mansion !");
  267.             SendClientMessage(playerid, COLOR_BLUE, "--===[-------------Have a nice day!-----------]===--");
  268.             return 1;
  269.         }
  270.         */
  271.         if(strcmp(cmdtext, "/done", true) == 0)
  272.         {
  273.             #define scm SendClientMessage
  274.             scm(playerid, COLOR_YELLOW, "SERVER: You have completed your house building. The houses will be saves as Houses.pwn.");
  275.             scm(playerid, COLOR_YELLOW, "SERVER: Put it in your \"filterscripts\" folder and write in server.cfg: filterscripts Houses.");
  276.             scm(playerid, COLOR_YELLOW, "Thanks for using my filterscript! Greetings from Leopard.");
  277.             WritePwn();
  278.             SendRconCommand("unloadfs savehouse");
  279.         }
  280.     }
  281.     return 0;
  282. }
  283.  
  284. // DO NOT CHANGE IF YOU ARE A NOOB! v
  285.  
  286. stock WritePwn()
  287. {
  288.    
  289.         new str[200];
  290.         new File:file = fopen(SaveFile, io_write);
  291.    
  292.         fwrite(file, "#include <a_samp>\r\n");
  293.         fwrite(file, "#include <dudb>\r\n");
  294.         fwrite(file, "#define dcmd(%1,%2,%3) if ((strcmp((%3)[1], #%1, true, (%2)) == 0) && ((((%3)[(%2) + 1] == 0) && (dcmd_%1(playerid, \"\")))||(((%3)[(%2) + 1] == 32) && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1\r\n");
  295.         fwrite(file, "//script by Leopard, original created by Antironix\r\n");
  296.         format(str, 100, "#define MAX_HOUSES %d\r\n", HouseID);
  297.         fwrite(file, str);
  298.         fwrite(file, "#define MAX_RENTCOST 1000\n\r#define MIN_RENTCOST 500\n\r#define MAX_BUY_CARS 8\r\n");
  299.         fwrite(file, "#define CAR_DELIVER_TIME 1\r\n");
  300.         fwrite(file, "new HOUSE_STATS = 0; //0=stats on pickup, reverse if 1.\r\n");
  301.         fwrite(file, " \r\n");
  302.         fwrite(file, "enum CarInfo {CarModel,CarName[24],CarCost};\r\n");
  303.         fwrite(file, "new Buyable_Cars[MAX_BUY_CARS][CarInfo] =\r\n");
  304.         fwrite(file, "{  //Modelid, Buy Name, Price\r\n");
  305.         fwrite(file, "\t{411,\"Infernus\",0},\r\n\t{522,\"NRG-500\",50000},\r\n\t{451,\"Turismo\",50000},\r\n\t{541,\"Bullet\",50000},\r\n\t{415,\"Cheetah\",50000},\r\n\t{429,\"Banshee\",50000},\r\n\t{494,\"Hotring\",50000},\r\n\t{556,\"Monster\",50000}\r\n");
  306.         fwrite(file, "};\r\n");
  307.         fwrite(file, "#define Cost_Admiral 50000\r\n");
  308.         fwrite(file, "//----------------------------\r\n#define c_y 0xFFFF00AA\r\n#define c_r 0xAA3333AA\r\nnew HousePickup[MAX_HOUSES];\r\nnew playerinterior[MAX_PLAYERS]=-1;\r\nnew inhousepickup[MAX_PLAYERS];\r\nnew playericonhouse[MAX_PLAYERS];\r\nnew Float:housex, Float:housey, Float:housez;\r\nnew housemapicon[MAX_PLAYERS];\r\nnew playerworld[MAX_PLAYERS];\r\nnew bool:KillVeh[MAX_VEHICLES] = false;\r\nforward rentfee();\r\nforward newcar();\r\nforward KillVehicle(carid);\r\n");
  309.         fwrite(file, "enum HouseInfo {Name[24],Renter[24],Rentable,Rentcost,Cost,Sell,Interior,Virtualworld,Locked,Float:InteriorX,Float:InteriorY,Float:InteriorZ,Float:iconx,Float:icony,Float:iconz,Rentfee}\r\n");
  310.         fwrite(file, "new hInfo[MAX_HOUSES][HouseInfo];\r\n");
  311.         fwrite(file, "enum HouseCarInfo {HouseCar,GotCar,Houseid,CarModel,Float:CarX,Float:CarY,Float:CarZ,CarColor1,CarColor2,Respawn_Delay,NewCar}\r\n");
  312.         fwrite(file, "new cInfo[MAX_HOUSES][HouseCarInfo];\r\n");
  313.         fwrite(file, "public OnFilterScriptInit()\r\n{\r\n\tprint(\"--------------------------------------\");\r\n\tprint(\" Simple House System by Antironix\");\r\n\tprint(\"--------------------------------------\");\r\n");
  314.         for(new i = 0; i < HouseID; i++)
  315.         {
  316.             if(HouseInfo[i][name])
  317.             {
  318.                 format(str, sizeof(str), "\t%s\r\n", HouseInfo[i][name]);
  319.                 fwrite(file, str); //write the string inside that
  320.             }
  321.         }
  322.         //done with all the house
  323.         fwrite(file, "\tSetTimer(\"rentfee\", 1*60*60*1000, 1);//1 hour\r\n\tSetTimer(\"newcar\", CAR_DELIVER_TIME*60*10*1000,1);//1 hour\r\n");
  324.         fwrite(file, "\treturn 0;\r\n}\r\n");
  325.  
  326.         fwrite(file, "public OnFilterScriptExit()\r\n{\r\n\tfor(new i=0;i<MAX_HOUSES;i++)\r\n\t{\r\n\t\tDestroyPickup(HousePickup[i]);\r\n\t\tDestroyVehicle(cInfo[i][HouseCar]);\r\n\t}\r\n}\r\n");
  327.  
  328.         fwrite(file, "public OnPlayerCommandText(playerid,cmdtext[])\r\n{\r\n\tdcmd(buy,3,cmdtext);\r\n\tdcmd(sell,4,cmdtext);\r\n\tdcmd(enter,5,cmdtext);\r\n\tdcmd(exit,4,cmdtext);\r\n\tdcmd(lock,4,cmdtext);\r\n\tdcmd(unlock,6,cmdtext);\r\n");
  329.        
  330.         fwrite(file, "\tdcmd(home,4,cmdtext);\r\n\tdcmd(setrent,7,cmdtext);\r\n\tdcmd(rent,4,cmdtext);\r\n\tdcmd(unrent,6,cmdtext);\r\n\tdcmd(house,5,cmdtext);\r\n\tdcmd(housestats,10,cmdtext);\r\n\tdcmd(getrent,7,cmdtext);\r\n\tdcmd(payrent,7,cmdtext);\r\n\tdcmd(ordercar,8,cmdtext);\r\n\treturn 0;\r\n}\r\n");
  331.        
  332.         fwrite(file, "AddHouse(houseid, Float:iconX, Float:iconY, Float:iconZ, Float:interiorX, Float:interiorY, Float:interiorZ, Costa, Sella, Interiora, virtualworld)\r\n{\r\n");
  333.         fwrite(file, "\tnew house[256];\r\n\tformat(house, sizeof(house), \"Houses/houseid%d\",houseid);\r\n");
  334.         fwrite(file, "\tif(!dini_Exists(house))\r\n\t{\r\n");
  335.         fwrite(file, "\t\tdini_Create(house);\r\n\t\tformat(hInfo[houseid][Name], 24, \"ForSale\");\r\n\t\tdini_Set(house, \"Name\", \"ForSale\");\r\n\t\tformat(hInfo[houseid][Renter], 24, \"ForRent\");\r\n\t\tdini_Set(house, \"Renter\", \"ForRent\");\r\n\t\thInfo[houseid][Rentable] = 0;\r\n\t\tdini_IntSet(house, \"Rentable\", 0);\r\n\t\thInfo[houseid][Rentcost] = 0;\r\n");
  336.         fwrite(file, "\t\tdini_IntSet(house, \"Rentcost\", 0);\r\n\t\thInfo[houseid][Cost] = Costa;\r\n\t\tdini_IntSet(house, \"Cost\", Costa);\r\n\t\thInfo[houseid][Sell] = Sella;\r\n\t\tdini_IntSet(house, \"Sell\", Sella);\r\n\t\thInfo[houseid][Interior] = Interiora;\r\n\t\tdini_IntSet(house, \"Interior\", Interiora);\r\n");
  337.         fwrite(file, "\t\tdini_IntSet(house, \"Virtualworld\", virtualworld);\r\n\t\thInfo[houseid][Virtualworld] = virtualworld;\r\n\t\thInfo[houseid][Locked] = 1;\r\n\t\tdini_IntSet(house, \"Locked\", 1);\r\n");
  338.         fwrite(file, "\t\thInfo[houseid][InteriorX] = interiorX;\r\n\t\thInfo[houseid][InteriorY] = interiorY;\r\n\t\thInfo[houseid][InteriorZ] = interiorZ;\r\n\t\tdini_FloatSet(house, \"X\", interiorX);\r\n\t\tdini_FloatSet(house, \"Y\", interiorY);\r\n\t\tdini_FloatSet(house, \"Z\", interiorZ);\r\n\t\tdini_IntSet(house, \"RentPay\", 0);\r\n\t\tdini_IntSet(house, \"RentGet\", 0);\r\n\t\tcInfo[houseid][HouseCar] = 429;\r\n");
  339.         fwrite(file, "\t\tdini_IntSet(house, \"HouseCar\", 0);\r\n\t\tcInfo[houseid][CarModel] = 429;\r\n\t\tdini_IntSet(house, \"CarModel\", 0);\r\n\t\tcInfo[houseid][CarX] = 0;\r\n\t\tcInfo[houseid][CarY] = 0;\r\n\t\tcInfo[houseid][CarZ] = 0;\r\n\t\tdini_FloatSet(house, \"CarX\", 0);\r\n\t\tdini_FloatSet(house, \"CarY\", 0);\r\n");
  340.         fwrite(file, "\t\tdini_FloatSet(house, \"CarZ\", 0);\r\n\t\tcInfo[houseid][CarColor1] = 0;\r\n\t\tcInfo[houseid][CarColor2] = 0;\r\n\t\tdini_IntSet(house, \"CarColor1\", 0);\r\n\t\tdini_IntSet(house, \"CarColor2\", 0);\r\n\t\tcInfo[houseid][GotCar] = 0;\r\n\t\tprint(\"-\");\r\n\t\tprint(\"--------------House Created--------------\");");
  341.         fwrite(file, "\r\n\t\tprintf(\"- Houseid: \%d\", houseid);\r\n\t\tprintf(\"- Buy Cost: \%d\", Costa);\r\n\t\tprintf(\"- Sell Cost: \%d\", Sella);\r\n\t\tprintf(\"- Interior: \%d\", Interiora);\r\n\t\tprintf(\"- VirtualWorld: \%d\", virtualworld);\r\n\t\tprint(\"-----------------------------------------\");\r\n\t\tprint(\"-\");\r\n");
  342.         fwrite(file, "\t}\r\n\telse\r\n\t{\r\n");
  343.         fwrite(file, "\t\tformat(hInfo[houseid][Name], 24, dini_Get(house, \"Name\"));\r\n\t\tformat(hInfo[houseid][Renter], 24, dini_Get(house, \"Renter\"));\r\n\t\thInfo[houseid][Rentable] = dini_Int(house, \"Rentable\");\r\n\t\thInfo[houseid][Rentcost] = dini_Int(house, \"Rentcost\");\r\n");
  344.         fwrite(file, "\t\thInfo[houseid][Cost] = dini_Int(house, \"Cost\");\r\n\t\thInfo[houseid][Sell] = dini_Int(house, \"Sell\");\r\n\t\thInfo[houseid][Interior] = dini_Int(house, \"Interior\");\r\n\t\thInfo[houseid][Locked] = dini_Int(house, \"Locked\");\r\n");
  345.         fwrite(file, "\t\thInfo[houseid][InteriorX] = dini_Float(house, \"X\");\r\n\t\thInfo[houseid][InteriorY] = dini_Float(house, \"Y\");\r\n\t\thInfo[houseid][InteriorZ] = dini_Float(house, \"Z\");\r\n\t\thInfo[houseid][Virtualworld] = dini_Int(house, \"Virtualworld\");\r\n");
  346.         fwrite(file, "\t}\r\n\thInfo[houseid][iconx]=iconX;\r\n\thInfo[houseid][icony]=iconY;\r\n\thInfo[houseid][iconz]=iconZ;\r\n\tformat(house, sizeof(house), \"Houses/houseid\%d\",houseid);\r\n");
  347.         fwrite(file, "\tif(strcmp(hInfo[playericonhouse[houseid]][Name],\"ForSale\",true)==0)\r\n\t{\r\n\t\tHousePickup[houseid] = CreatePickup(1273, 23, iconX, iconY, iconZ);//not bought\r\n\t}\r\n\telse\r\n\t{\r\n\t\tHousePickup[houseid] = CreatePickup(1272,23, iconX, iconY, iconZ);//bought\r\n\t}\r\n}\r\n");
  348.        
  349.         //AddHouseCar
  350.         fwrite(file, "AddHouseCar(houseid, modelid, Float:Carx, Float:Cary, Float:Carz, color1, color2, respawn_delay)\r\n{\r\n\tnew house[256];\r\n\tformat(house, sizeof(house), \"Houses/houseid\%d\",houseid);\r\n\tif(dini_Exists(house))\r\n\t{\r\n\t\tcInfo[houseid][GotCar] = 1;\r\n\t\tif(dini_Int(house, \"CarModel\")==0)\r\n\t\t{\r\n\t\t\tdini_IntSet(house, \"CarModel\", modelid);\r\n\t\t\tcInfo[houseid][CarModel] = modelid;\r\n");
  351.         fwrite(file, "\t\t\tcInfo[houseid][CarX] = Carx;\r\n\t\t\tcInfo[houseid][CarY] = Cary;\r\n\t\t\tcInfo[houseid][CarZ] = Carz;\r\n\t\t\tdini_FloatSet(house, \"CarX\", Carx);\r\n\t\t\tdini_FloatSet(house, \"CarY\", Cary);\r\n\t\t\tdini_FloatSet(house, \"CarZ\", Carz);\r\n");
  352.         fwrite(file, "\t\t\tcInfo[houseid][CarColor1] = color1;\r\n\t\t\tcInfo[houseid][CarColor2] = color2;\r\n\t\t\tdini_IntSet(house, \"CarColor1\", color1);\r\n\t\t\tdini_IntSet(house, \"CarColor2\", color2);\r\n\t\t\tdini_IntSet(house, \"Respawn_Delay\", respawn_delay);\r\n");
  353.         fwrite(file, "\t\t\tcInfo[houseid][Respawn_Delay] = respawn_delay;\r\n\t\t\tcInfo[houseid][HouseCar] = CreateVehicle(cInfo[houseid][CarModel], Carx, Cary, Carz, 0.0, color1, color2, respawn_delay);\r\n\t\t\tprint(\"-\");\r\n");
  354.         fwrite(file, "\t\t\tprint(\"--------------Car Created--------------\");\r\n\t\t\tprintf(\"- Car Houseid: \%d\", houseid);\r\n\t\t\tprintf(\"- Modelid: \%d\", modelid);\r\n\t\t\tprintf(\"- Color 1: \%d\", color1);\r\n\t\t\tprintf(\"- Color 2: \%d\", color2);\r\n\t\t\tprintf(\"- Respawn Delay: \%d\", respawn_delay);\r\n");
  355.         fwrite(file, "\t\t\tprint(\"---------------------------------------\");\r\n\t\t\tprint(\"-\");\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tcInfo[houseid][CarModel] = dini_Int(house, \"CarModel\");\r\n\t\t}\r\n\t\tcInfo[houseid][CarX] = dini_Int(house, \"CarX\");\r\n");
  356.         fwrite(file, "\t\tcInfo[houseid][CarY] = dini_Int(house, \"CarY\");\r\n\t\tcInfo[houseid][CarZ] = dini_Int(house, \"CarZ\");\r\n\t\tcInfo[houseid][CarColor1] = dini_Int(house, \"CarColor1\");\r\n\t\tcInfo[houseid][CarColor2] = dini_Int(house, \"CarColor2\");\r\n");
  357.         fwrite(file, "\t\tcInfo[houseid][Respawn_Delay] = dini_Int(house, \"Respawn_Delay\");\r\n\t\tcInfo[houseid][HouseCar] = CreateVehicle(cInfo[houseid][CarModel], Carx, Cary, Carz, 0.0, color1, color2, respawn_delay);\r\n\t}\r\n}\r\n");
  358.        
  359.         fwrite(file, "stock SpawnPlayerAtHouse(playerid)\r\n{\r\n\tnew str1[256],pname[24],str[256];\r\n\tGetPlayerName(playerid, pname, sizeof(pname));\r\n\tformat(str1, sizeof(str1), \"Houses/Users/\%s\", udb_encode(pname));\r\n\tif (dini_Exists(str1))\r\n\t{\r\n\t\tif(dini_Int(str1,\"Houseid\")!=-255)\r\n\t\t{\r\n\t\t\tnew Float:x,Float:y,Float:z;\r\n");
  360.         fwrite(file, "\t\t\tstr = dini_Get(str1,\"SpawnInt\");\r\n\t\t\tSetPlayerInterior(playerid, strval(str));\r\n\t\t\tplayerinterior[playerid] = strval(str);\r\n\t\t\tx = dini_Float(str1,\"SpawnX\");\r\n\t\t\ty = dini_Float(str1,\"SpawnY\");\r\n\t\t\tz = dini_Float(str1,\"SpawnZ\");\r\n\t\t\tSetPlayerPos(playerid, x, y, z);\r\n\t\t}\r\n\t}\r\n\treturn 1;\r\n}\r\n");
  361.        
  362.         fwrite(file, "public OnPlayerSpawn(playerid) { SpawnPlayerAtHouse(playerid); }");
  363.         fwrite(file, "GetHouseStats(playerid, pickupid)\r\n{\r\n\tfor(new i=0;i<MAX_HOUSES;i++)\r\n\t{\r\n\t\tif(pickupid==HousePickup[i])\r\n\t\t{\r\n\t\t\tif(HOUSE_STATS==0)\r\n\t\t\t{\r\n");
  364.         fwrite(file, "\t\t\t\tnew str3[256];\r\n\t\t\t\tformat(str3, sizeof(str3), \"Owned by: \%s\", hInfo[i][Name]);\r\n\t\t\t\tSendClientMessage(playerid, c_y, str3);\r\n\t\t\t\tif(strcmp(hInfo[i][Renter],\"ForRent\",true))\r\n\t\t\t\t{\r\n\t\t\t\t\tformat(str3, sizeof(str3), \"Rented by: \%s\", hInfo[i][Renter]);\r\n");
  365.         fwrite(file, "\t\t\t\t\tSendClientMessage(playerid, c_y, str3);\r\n\t\t\t\t}\r\n\t\t\t\tformat(str3,sizeof(str3),\"Cost: \%d\",hInfo[i][Cost]);\r\n\t\t\t\tSendClientMessage(playerid, c_y, str3);\r\n\t\t\t}\r\n\t\t\tinhousepickup[playerid] = GetTickCount();\r\n\t\t\tplayericonhouse[playerid] = i;\r\n\t\t}\r\n\t}\r\n}\r\n");
  366.         fwrite(file, "dcmd_sell(playerid,params[])\r\n{\r\n\t#pragma unused params\r\n\tnew timestamp = GetTickCount();\r\n\tif(timestamp - inhousepickup[playerid] > 5000)\r\n\t{\r\n\t\tSendClientMessage(playerid, c_r, \"You are not in a house icon!\");\r\n\t\treturn 1;\r\n");
  367.         fwrite(file, "\t}\r\n\tnew str[255],str1[256],pname[24];\r\n\tGetPlayerName(playerid, pname, 24);\r\n\tformat(str1, sizeof(str1), \"Houses/houseid\%d\", playericonhouse[playerid]);\r\n\tif (strcmp(hInfo[playericonhouse[playerid]][Name],pname,false)) return SendClientMessage(playerid, c_r, \"This house isn't yours!\");\r\n\tSendClientMessage(playerid, c_y, \"You have sold your house!\");\r\n");
  368.         fwrite(file, "\tformat(str, sizeof(str), \"\%s has sold houseid 0\",pname);\r\n\tprint(str);\r\n\tGivePlayerMoney(playerid, hInfo[playericonhouse[playerid]][Sell]);\r\n\tdini_Set(str1, \"Name\", \"ForSale\");\r\n\thInfo[playericonhouse[playerid]][Locked] = dini_IntSet(str1,\"Locked\",1);\r\n\tformat(hInfo[playericonhouse[playerid]][Name],255,\"ForSale\");\r\n");
  369.         fwrite(file, "\tformat(str1, sizeof(str1), \"Houses/Users/\%s\", udb_encode(pname));\r\n\tif (!dini_Exists(str1)) dini_Create(str1);\r\n\tdini_IntSet(str1, \"Houseid\", -255);\r\n\tDestroyPickup(HousePickup[playericonhouse[playerid]]);\r\n");
  370.         fwrite(file, "\tHousePickup[playericonhouse[playerid]] = CreatePickup(1273, 23, hInfo[playericonhouse[playerid]][iconx], hInfo[playericonhouse[playerid]][icony], hInfo[playericonhouse[playerid]][iconz]);\r\n\tRemovePlayerMapIcon(playerid, housemapicon[playerid]);\r\n\treturn 1;\r\n}\r\n");
  371.        
  372.         fwrite(file, "dcmd_buy(playerid,params[])\r\n{\r\n\t#pragma unused params\r\n\tnew timestamp = GetTickCount();\r\n\tif(timestamp - inhousepickup[playerid] > 5000)\r\n\t{\r\n\t\tSendClientMessage(playerid, c_r, \"You are not in a house icon!\");\r\n\t\treturn 1;\r\n\t}\r\n\tnew str[255],str1[255],pname[24];\r\n\tGetPlayerName(playerid, pname, 24);\r\n\tformat(str1, sizeof(str1), \"Houses/Users/\%s\", udb_encode(pname));\r\n\tif(dini_Exists(str1))\r\n");
  373.         fwrite(file, "\t{\r\n\tif (dini_Int(str1, \"Houseid\")!=-255) return SendClientMessage(playerid, c_r, \"You can only buy one house!\");\r\n\t}\r\n\tformat(str1, sizeof(str1), \"Houses/houseid\%d\", playericonhouse[playerid]);\r\n\tif (strcmp(hInfo[playericonhouse[playerid]][Name],\"ForSale\",true)) return SendClientMessage(playerid, c_r, \"This house isn't for sale!\");\r\n");
  374.         fwrite(file, "\tif(GetPlayerMoney(playerid)<hInfo[playericonhouse[playerid]][Cost]) return SendClientMessage(playerid, c_r, \"Not enough money!\");\r\n\tSendClientMessage(playerid, c_y, \"You have bought the house!\");\r\n\tformat(str, sizeof(str), \"\%s has bought houseid 0\",pname);\r\n");
  375.         fwrite(file, "\tprint(str);\r\n\tGivePlayerMoney(playerid, -hInfo[playericonhouse[playerid]][Cost]);\r\n\tdini_Set(str1, \"Name\", pname);\r\n\thInfo[playericonhouse[playerid]][Name]=pname;\r\n\thInfo[playericonhouse[playerid]][Locked] = dini_IntSet(str1,\"Locked\",0);\r\n\tformat(str1, sizeof(str1), \"Houses/Users/\%s\", udb_encode(pname));\r\n\tif (!dini_Exists(str1)) dini_Create(str1);\r\n\tnew Float:sy, Float:sx, Float:sz;\r\n");
  376.         fwrite(file, "\tdini_IntSet(str1, \"Houseid\", playericonhouse[playerid]);\r\n\tif(!dini_Isset(str1,\"Rentid\"))\r\n\t{\r\n\t\tdini_IntSet(str1, \"Rentid\", -255);\r\n\t}\r\n\tGetPlayerPos(playerid, sx,sy,sz);\r\n\tdini_FloatSet(str1, \"SpawnX\", sx);\r\n\tdini_FloatSet(str1, \"SpawnY\", sy);\r\n\tdini_FloatSet(str1, \"SpawnZ\", sz);\r\n");
  377.         fwrite(file, "\tdini_IntSet(str1, \"SpawnInt\", GetPlayerInterior(playerid));\r\n\tDestroyPickup(HousePickup[playericonhouse[playerid]]);\r\n\tHousePickup[playericonhouse[playerid]] = CreatePickup(1272, 23, hInfo[playericonhouse[playerid]][iconx], hInfo[playericonhouse[playerid]][icony], hInfo[playericonhouse[playerid]][iconz]);\r\n\treturn 1;\r\n}\r\n");
  378.        
  379.         fwrite(file, "dcmd_lock(playerid,params[])\r\n{\r\n\t#pragma unused params\r\n\tnew timestamp = GetTickCount();\r\n\tif(timestamp - inhousepickup[playerid] > 5000)\r\n\t{\r\n\t\tSendClientMessage(playerid, c_r, \"You are not in a house icon!\");\r\n\t\treturn 1;\r\n");
  380.         fwrite(file, "\t}\r\n\tnew str1[256],pname[24];\r\n\tGetPlayerName(playerid, pname, 24);\r\n\tformat(str1, sizeof(str1), \"Houses/houseid\%d\", playericonhouse[playerid]);\r\n");
  381.         fwrite(file, "\tif(strcmp(hInfo[playericonhouse[playerid]][Name],pname,true)==0)\r\n\t{\r\n\t\tSendClientMessage(playerid, c_y, \"You have locked your house!\");\r\n\t\tdini_IntSet(str1,\"Locked\",1);\r\n\t\thInfo[playericonhouse[playerid]][Locked] = 1;\r\n\t}\r\n");
  382.         fwrite(file, "\telse if(strcmp(hInfo[playericonhouse[playerid]][Renter],pname,true)==0)\r\n\t{\r\n\t\tSendClientMessage(playerid, c_y, \"You have locked your house!\");\r\n\t\tdini_IntSet(str1,\"Locked\",1);\r\n");
  383.         fwrite(file, "\t\thInfo[playericonhouse[playerid]][Locked] = 1;\r\n\t}\r\n\telse\r\n\t{\r\n\t\tSendClientMessage(playerid, c_r, \"This house isn't yours!\");\r\n\t}\r\n\treturn 1;\r\n}\r\n");
  384.        
  385.         fwrite(file, "dcmd_unlock(playerid,params[])\r\n{\r\n\t#pragma unused params\r\n\tnew timestamp = GetTickCount();\r\n\tif(timestamp - inhousepickup[playerid] > 5000) { SendClientMessage(playerid, c_r, \"You are not in a house icon!\");return 1;}\r\n");
  386.         fwrite(file, "\tnew str1[256],pname[24];\r\n\tGetPlayerName(playerid, pname, 24);\r\n\tformat(str1, sizeof(str1), \"Houses/houseid\%d\", playericonhouse[playerid]);\r\n");
  387.         fwrite(file, "\tif(strcmp(hInfo[playericonhouse[playerid]][Name],pname,true)==0){SendClientMessage(playerid, c_y, \"You have unlocked your house!\");dini_IntSet(str1,\"Locked\",0);hInfo[playericonhouse[playerid]][Locked] = 0;}\r\n\telse if(strcmp(hInfo[playericonhouse[playerid]][Renter],pname,true)==0){SendClientMessage(playerid, c_y, \"You have unlocked your house!\");dini_IntSet(str1,\"Locked\",0);hInfo[playericonhouse[playerid]][Locked] = 0;}\r\n");
  388.         fwrite(file, "\telse{SendClientMessage(playerid, c_r, \"This house isn't yours!\");}\r\n\treturn 1;\r\n}\r\n");
  389.        
  390.         fwrite(file, "dcmd_enter(playerid,params[])\r\n{\r\n\t#pragma unused params\r\n\tnew timestamp = GetTickCount();\r\n\tif(timestamp - inhousepickup[playerid] > 5000) {SendClientMessage(playerid, c_r, \"You are not in a house icon!\");return 1;}\r\n\tnew str1[255],pname[24];\r\n\tGetPlayerPos(playerid, housex, housey, housez);\r\n\tformat(str1, sizeof(str1), \"Houses/houseid\%d\", playericonhouse[playerid]);\r\n");
  391.         fwrite(file, "\tGetPlayerName(playerid, pname, 24);\r\n\tif(hInfo[playericonhouse[playerid]][Locked]==1) return SendClientMessage(playerid, c_r, \"This house is locked!\");\r\n\tplayerworld[playerid] = GetPlayerVirtualWorld(playerid);\r\n\tSendClientMessage(playerid, c_y, \"You entered the house!\");\r\n\tSetPlayerVirtualWorld(playerid, hInfo[playericonhouse[playerid]][Virtualworld]);\r\n\tSetPlayerInterior(playerid, hInfo[playericonhouse[playerid]][Interior]);\r\n");
  392.         fwrite(file, "\tSetPlayerPos(playerid, hInfo[playericonhouse[playerid]][InteriorX], hInfo[playericonhouse[playerid]][InteriorY], hInfo[playericonhouse[playerid]][InteriorZ]);\r\n\tplayerinterior[playerid] = hInfo[playericonhouse[playerid]][Interior];\r\n\treturn 1;\r\n}\r\n");
  393.        
  394.         fwrite(file, "dcmd_exit(playerid,params[])\r\n{\r\n\t#pragma unused params\r\n\tif(GetPlayerInterior(playerid)==playerinterior[playerid]){SetPlayerPos(playerid, housex, housey, housez);SetPlayerVirtualWorld(playerid, 0);SetPlayerInterior(playerid, playerworld[playerid]);}\r\n\telse{SendClientMessage(playerid, c_r, \"You have not entered a house!\");}\r\n\treturn 1;\r\n}\r\n");
  395.        
  396.         fwrite(file, "dcmd_home(playerid,params[])\r\n{\r\n\t#pragma unused params\r\n\tnew str1[256],pname[24];\r\n\tGetPlayerName(playerid, pname, 24);\r\n\tformat(str1, sizeof(str1), \"Houses/Users/\%s\", udb_encode(pname));\r\n\tif(!dini_Exists(str1)) return SendClientMessage(playerid, c_r, \"You don't own a house!\");\r\n");
  397.         fwrite(file, "\tif(dini_Int(str1, \"Houseid\")!=-255)\r\n\t{\r\n\t    housemapicon[playerid] = SetPlayerMapIcon(playerid,31,hInfo[dini_Int(str1, \"Houseid\")][iconx], hInfo[dini_Int(str1, \"Houseid\")][icony], hInfo[dini_Int(str1, \"Houseid\")][iconz],31,c_y);\r\n");
  398.         fwrite(file, "\t}\r\n\telse if (dini_Int(str1, \"Rentid\")!=-255)\r\n\t{\r\n\t    housemapicon[playerid] = SetPlayerMapIcon(playerid,31,hInfo[dini_Int(str1, \"Rentid\")][iconx], hInfo[dini_Int(str1, \"Rentid\")][icony], hInfo[dini_Int(str1, \"Rentid\")][iconz],31,c_y);\r\n\t}\r\n\telse\r\n\t{\r\n\tSendClientMessage(playerid, c_r, \"You don't own a house!\");\r\n\t}\r\n\treturn 1;\r\n}\r\n");
  399.        
  400.         fwrite(file, "dcmd_setrent(playerid,params[])\r\n{\r\n\tnew timestamp = GetTickCount();\r\n\tif(timestamp - inhousepickup[playerid] > 5000){SendClientMessage(playerid, c_r, \"You are not in a house icon!\");return 1;}\r\n\tnew str[256],str1[256],pname[24];\r\n");
  401.         fwrite(file, "\tGetPlayerName(playerid, pname, 24);\r\n\tformat(str1, sizeof(str1), \"Houses/houseid\%d\", playericonhouse[playerid]);\r\n\tstr = dini_Get(str1,\"Name\");\r\n\tif (strcmp(str,pname,true)) return SendClientMessage(playerid, c_r, \"This house isn't yours!\");\r\n");
  402.         fwrite(file, "\tnew rentcost, rentable;\r\n\tif (sscanf(params, \"dd\", rentable, rentcost)) return SendClientMessage(playerid, c_r, \"USAGE: /setrent [0/1] [Rentcost]\");\r\n\telse if (rentcost<MIN_RENTCOST){format(str, sizeof(str), \"The minimum rentcost is $\%d.\", MIN_RENTCOST);SendClientMessage(playerid, c_r, str);return 1;}\r\n");
  403.         fwrite(file, "\telse if (rentcost>MAX_RENTCOST){format(str, sizeof(str), \"The maximum rentcost is $\%d.\", MAX_RENTCOST);SendClientMessage(playerid, c_r, str);return 1;}\r\n\telse if(rentable==1){SendClientMessage(playerid, c_y, \"Your house is now rentable!\");hInfo[playericonhouse[playerid]][Rentable] = 1;dini_IntSet(str1, \"Rentable\", 1);hInfo[playericonhouse[playerid]][Rentcost] = rentcost;dini_IntSet(str1, \"Rentcost\", rentcost);return 1;}\r\n");
  404.         fwrite(file, "\telse if(rentable==0){SendClientMessage(playerid, c_y, \"Your house is now not rentable!\");hInfo[playericonhouse[playerid]][Rentable] = 0;dini_IntSet(str1, \"Rentable\", 0);hInfo[playericonhouse[playerid]][Rentcost] = rentcost;dini_IntSet(str1, \"Rentcost\", rentcost);return 1;}\r\n\treturn 1;\r\n}\r\n");
  405.        
  406.         fwrite(file, "dcmd_rent(playerid,params[])\r\n{\r\n\t#pragma unused params\r\n\tnew timestamp = GetTickCount();\r\n\tif(timestamp - inhousepickup[playerid] > 5000){SendClientMessage(playerid, c_r, \"You are not in a house icon!\");return 1;}\r\n");
  407.         fwrite(file, "\tnew str[255],str1[256],str5[255],pname[24];\r\n\tGetPlayerName(playerid, pname, 24);\r\n\tformat(str1, sizeof(str1), \"Houses/houseid\%d\", playericonhouse[playerid]);\r\n");
  408.         fwrite(file, "\tformat(str5, sizeof(str5), \"Houses/Users/\%s\", udb_encode(pname));\r\n\tif(dini_Isset(str5, \"Rentid\")){if (dini_Int(str5, \"Rentid\")!=-255) return SendClientMessage(playerid, c_r, \"You can only rent one house at a time!\");}\r\n\tformat(str, sizeof(str), dini_Get(str1,\"Name\"));\r\n\tif (strcmp(str,\"ForSale\",true)==0) return SendClientMessage(playerid, c_r, \"This house has no owner!\");\r\n");
  409.         fwrite(file, "\tif(hInfo[playericonhouse[playerid]][Rentable]==0 || strcmp(hInfo[playericonhouse[playerid]][Renter], \"ForRent\", true)==0) return SendClientMessage(playerid, c_r, \"This house is not rentable!\");\r\n");
  410.         fwrite(file, "\tif(GetPlayerMoney(playerid)<hInfo[playericonhouse[playerid]][Rentcost]) return SendClientMessage(playerid, c_r, \"Not enough money!\");\r\n\tdini_Set(str1, \"Renter\", udb_encode(pname));\r\n\tformat(hInfo[playericonhouse[playerid]][Renter], 24, udb_encode(pname));\r\n");
  411.         fwrite(file, "\tdini_IntSet(str5, \"Rentid\", playericonhouse[playerid]);\r\n\tformat(str1, sizeof(str1), \"You have rented this house, it will cost you $\%d an hour!\", hInfo[playericonhouse[playerid]][Rentcost]);\r\n\tSendClientMessage(playerid, c_y, str1);\r\n\treturn 1;\r\n}\r\n");
  412.        
  413.         fwrite(file, "dcmd_unrent(playerid,params[])\r\n{\r\n\t#pragma unused params\r\n\tnew timestamp = GetTickCount();\r\n\tif(timestamp - inhousepickup[playerid] > 5000){SendClientMessage(playerid, c_r, \"You are not in a house icon!\");return 1;}\r\n");
  414.         fwrite(file, "\tnew str1[256],pname[24];\r\n\tGetPlayerName(playerid, pname, 24);\r\n\tformat(str1, sizeof(str1), \"Houses/houseid\%d\", playericonhouse[playerid]);\r\n\tif(strcmp(hInfo[playericonhouse[playerid]][Renter], pname, true)) return SendClientMessage(playerid, c_r, \"You aren't renting this house!\");\r\n\tdini_Set(str1, \"Renter\", \"ForRent\");\r\n");
  415.         fwrite(file, "\tformat(hInfo[playericonhouse[playerid]][Renter], 24, \"ForRent\");\r\n\tformat(str1, sizeof(str1), \"Houses/Users/\%s\", udb_encode(pname));\r\n\tdini_IntSet(str1, \"Rentid\", -255);\r\n\tSendClientMessage(playerid, c_y, \"You have unrented this house!\");\r\n\treturn 1;\r\n}\r\n");
  416.        
  417.         fwrite(file, "dcmd_house(playerid,params[])\r\n{\r\n\t#pragma unused params\r\n\tSendClientMessage(playerid, c_y, \"-------------\");\r\n\tSendClientMessage(playerid, c_y, \"House options\");\r\n\tSendClientMessage(playerid, c_y, \"-------------\");\r\n\tSendClientMessage(playerid, c_y, \"/setrent [0/1] [Cost] - House owner\");\r\n");
  418.         fwrite(file, "\tSendClientMessage(playerid, c_y, \"/ordercar [CarName]   - House owner\");\r\n\tSendClientMessage(playerid, c_y, \"/getrent              - House owner\");\r\n\tSendClientMessage(playerid, c_y, \"/lock                 - Renter/Owner\");\r\n\tSendClientMessage(playerid, c_y, \"/unlock               - Renter/Owner\");\r\n");
  419.         fwrite(file, "\tSendClientMessage(playerid, c_y, \"/payrent              - Renter\");\r\n\tSendClientMessage(playerid, c_y, \"/unrent               - Renter\");\r\n\tSendClientMessage(playerid, c_y, \"/rent                 - Guest\");\r\n\tSendClientMessage(playerid, c_y, \"-------------\");\r\n\treturn 1;\r\n}\r\n");
  420.        
  421.         fwrite(file, "dcmd_housestats(playerid,params[])\r\n{\r\n\t#pragma unused params\r\n\tnew timestamp = GetTickCount();\r\n\tif(timestamp - inhousepickup[playerid] > 5000){SendClientMessage(playerid, c_r, \"You are not in a house icon!\");return 1;}\r\n\tnew str[256];\r\n");
  422.         fwrite(file, "\tformat(str, sizeof(str), \"Owner: \%s\", hInfo[playericonhouse[playerid]][Name]);\r\n\tSendClientMessage(playerid, c_y, str);\r\n\tformat(str, sizeof(str), \"Cost: $\%d\", hInfo[playericonhouse[playerid]][Cost]);\r\n\tSendClientMessage(playerid, c_y, str);\r\n");
  423.         fwrite(file, "\tformat(str, sizeof(str), \"Renter: \%s\", hInfo[playericonhouse[playerid]][Renter]);\r\n\tSendClientMessage(playerid, c_y, str);\r\n\tformat(str, sizeof(str), \"Rentcost: $\%d / hour\", hInfo[playericonhouse[playerid]][Rentcost]);\r\n\tSendClientMessage(playerid, c_y, str);\r\n\treturn 1;\r\n}\r\n");
  424.        
  425.         fwrite(file, "dcmd_getrent(playerid,params[])\r\n{\r\n\t#pragma unused params\r\n\tnew timestamp = GetTickCount();\r\n\tif(timestamp - inhousepickup[playerid] > 5000){SendClientMessage(playerid, c_r, \"You are not in a house icon!\");return 1;}\r\n");
  426.         fwrite(file, "\tnew pname[24];\r\n\tGetPlayerName(playerid, pname, 24);\r\n\tif(strcmp(hInfo[playericonhouse[playerid]][Name],pname,true)==0){new str[255];SendClientMessage(playerid, c_y, \"You collected the money of the renter!\");format(str, sizeof(str), \"Houses/houseid\%d\", playericonhouse[playerid]);GivePlayerMoney(playerid, dini_Int(str, \"RentGet\"));dini_IntSet(str, \"RentGet\", 0);}\r\n\telse{SendClientMessage(playerid, c_r, \"This house isn't yours!\");}\r\n");
  427.         fwrite(file, "\treturn 1;\r\n}\r\n");
  428.        
  429.         fwrite(file, "dcmd_payrent(playerid,params[])\r\n{\r\n\t#pragma unused params\r\n\tnew timestamp = GetTickCount();\r\n\tif(timestamp - inhousepickup[playerid] > 5000){SendClientMessage(playerid, c_r, \"You are not in a house icon!\");return 1;}\r\n");
  430.         fwrite(file, "\tnew pname[24];\r\n\tGetPlayerName(playerid, pname, 24);\r\n\tif(strcmp(hInfo[playericonhouse[playerid]][Renter],pname,true)==0)\r\n\t{\r\n\t\tnew str[255];\r\n\t\tformat(str, sizeof(str), \"Houses/houseid%d\", playericonhouse[playerid]);\r\n");
  431.         fwrite(file, "\t\tif(GetPlayerMoney(playerid)<dini_Int(str, \"RentPay\")) return SendClientMessage(playerid, c_r, \"You don't have enough money to pay the house owner!\");\r\n\t\tSendClientMessage(playerid, c_y, \"You have payed the money to the owner!\");\r\n\t\tGivePlayerMoney(playerid, -dini_Int(str, \"RentPay\"));\r\n\t\tdini_IntSet(str, \"RentPay\", 0);\r\n\t}\r\n");
  432.         fwrite(file, "\telse{SendClientMessage(playerid, c_r, \"You aren't renting this house!\");}\r\n\treturn 1;\r\n}\r\n");
  433.        
  434.         fwrite(file, "dcmd_ordercar(playerid,params[])\r\n{\r\n\t#pragma unused params\r\n\tnew timestamp = GetTickCount();\r\n\tif(timestamp - inhousepickup[playerid] > 5000)\r\n\t{\r\n\t\tSendClientMessage(playerid, c_r, \"You are not in a house icon!\");\r\n\t\treturn 1;\r\n");
  435.         fwrite(file, "\t}\r\n\tnew pname[24];\r\n\tGetPlayerName(playerid, pname, 24);\r\n\tif(cInfo[playericonhouse[playerid]][GotCar]==0) return SendClientMessage(playerid, c_r, \"This house can't order a car!\");\r\n\tif(strcmp(hInfo[playericonhouse[playerid]][Name],pname,true)==0)\r\n\t{\r\n\t\tnew carname[40];\r\n");
  436.         fwrite(file, "\t\tif (sscanf(params, \"s\", carname))\r\n\t\t{\r\n\t\t\tSendClientMessage(playerid, c_r, \"USAGE: /ordercar [CarName]\");\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tnew str[256], abc;\r\n\t\t\tfor(new i=0;i<MAX_BUY_CARS;i++)\r\n\t\t\t{\r\n");
  437.         fwrite(file, "\t\t\t\tif(strcmp(carname,Buyable_Cars[i][CarName],true)==0)\r\n\t\t\t\t{\r\n\t\t\t\t\tif(GetPlayerMoney(playerid)<Buyable_Cars[i][CarCost]) return SendClientMessage(playerid, c_r, \"Not enough money!\");\r\n\t\t\t\t\tGivePlayerMoney(playerid, -Buyable_Cars[i][CarCost]);\r\n");
  438.         fwrite(file, "\t\t\t\t\tcInfo[playericonhouse[playerid]][CarModel] = Buyable_Cars[i][CarModel];\r\n\t\t\t\t\tformat(str, sizeof(str), \"Houses/houseid\%d\", playericonhouse[playerid]);\r\n\t\t\t\t\tdini_IntSet(str, \"CarModel\", Buyable_Cars[i][CarModel]);\r\n\t\t\t\t\tformat(str, sizeof(str), \"You have ordered the \%s for $\%d!\", carname, Buyable_Cars[i][CarCost]);\r\n");
  439.         fwrite(file, "\t\t\t\t\tSendClientMessage(playerid, c_y, str);\r\n\t\t\t\t\tSendClientMessage(playerid, c_y, \"It will take some time when your car will be delivered.\");\r\n\t\t\t\t\tcInfo[playericonhouse[playerid]][NewCar] = 1;\r\n\t\t\t\t\tabc = 1;\r\n\t\t\t\t}\r\n\t\t\t}\r\n");
  440.         fwrite(file, "\t\t\tif(abc==0)\r\n\t\t\t{\r\n\t\t\t\tSendClientMessage(playerid, c_r, \"Wrong vehicle name!\");\r\n\t\t\t\tabc=0;\r\n\t\t\t}    \r\n\t\t}\r\n\t}\r\n\telse\r\n\t{\r\n");
  441.         fwrite(file, "\t\tSendClientMessage(playerid, c_r, \"This house isn't yours!\");\r\n\t}\r\n\treturn 1;\r\n}\r\n");
  442.        
  443.         fwrite(file, "public newcar()\r\n{\r\n\tfor(new carid=0;carid<MAX_HOUSES;carid++)\r\n\t{\r\n\t\tif(cInfo[carid][NewCar]==1)\r\n\t\t{\r\n\t\t\tcInfo[carid][NewCar]=0;\r\n");
  444.         fwrite(file, "\t\t\tKillVehicle(cInfo[carid][HouseCar]);\r\n\t\t\tcInfo[carid][HouseCar] = CreateVehicle(cInfo[carid][CarModel], cInfo[carid][CarX], cInfo[carid][CarY], cInfo[carid][CarZ], 0.0, cInfo[carid][CarColor1], cInfo[carid][CarColor2], cInfo[carid][Respawn_Delay]);\r\n\t\t}\r\n\t}\r\n}\r\n");
  445.        
  446.         fwrite(file, "public KillVehicle(carid)\r\n{\r\n\tfor (new i=0;i<MAX_PLAYERS;i++)\r\n\t{\r\n\t\tif(IsPlayerInVehicle(i, carid))\r\n\t\t{\r\n\t\t\tRemovePlayerFromVehicle(i);\r\n\t\t\tKillVeh[carid] = true;\r\n\t\t\tSetVehicleToRespawn(carid);\r\n");
  447.         fwrite(file, "\t\t\tSendClientMessage(i, c_r, \"System: Your car has been destroyed.\");\r\n\t\t\tSendClientMessage(i, c_r, \"Reason: House system.\");\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tKillVeh[carid] = true;\r\n\t\t\tSetVehicleToRespawn(carid);\r\n\t\t}\r\n\t}\r\n}\r\n");
  448.        
  449.         fwrite(file, "public OnVehicleSpawn(vehicleid)\r\n{\r\n\tfor(new i=0;i<MAX_HOUSES;i++)\r\n\t{\r\n\t\tif(KillVeh[cInfo[i][HouseCar]]==true) \r\n\t\t{\r\n\t\t\tKillVeh[cInfo[i][HouseCar]] = false;\r\n\t\t\tDestroyVehicle(cInfo[i][HouseCar]);\r\n\t\t}\r\n\t}\r\n}\r\n");
  450.        
  451.         fwrite(file, "public rentfee()\r\n{\r\n\tnew str[255],str2[255],pname[24];\r\n\tfor(new houseid=0;houseid<MAX_HOUSES;houseid++)\r\n\t{\r\n");
  452.         fwrite(file, "\t\tprint(\"f\");\r\n\t\tformat(str, sizeof(str), \"Houses/houseid\%d\", houseid);\r\n\t\tif(strcmp(hInfo[houseid][Renter], \"ForRent\", true))\r\n\t\t{\r\n\t\t\tfor(new ii=0;ii<MAX_PLAYERS;ii++)\r\n\t\t\t{\r\n");
  453.         fwrite(file, "\t\t\t\tif(IsPlayerConnected(ii))\r\n\t\t\t\t{\r\n\t\t\t\t\tGetPlayerName(ii, pname, 24);\r\n\t\t\t\t\tif(strcmp(hInfo[houseid][Renter], pname, true)==0)\r\n");
  454.         fwrite(file, "\t\t\t\t\t{\r\n\t\t\t\t\tformat(str2, sizeof(str2), \"You have to pay $\%d for the hour you have rented the hous!\", hInfo[houseid][Rentcost]);\r\n");
  455.         fwrite(file, "\t\t\t\t\tSendClientMessage(ii, c_y, str2);\r\n\t\t\t\t\tdini_IntSet(str, \"RentGet\", dini_Int(str, \"RentGet\")+hInfo[houseid][Rentcost]);\r\n");
  456.         fwrite(file, "\t\t\t\t\tdini_IntSet(str, \"RentPay\", dini_Int(str, \"RentPay\")+hInfo[houseid][Rentcost]);\r\n\t\t\t\t\thInfo[houseid][Rentfee]=1;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n");
  457.         fwrite(file, "\t\t\tif(hInfo[houseid][Rentfee]==0)\r\n\t\t\t{\r\n\t\t\t\t\tif(strcmp(hInfo[houseid][Renter],\"ForRent\"))\r\n\t\t\t\t\t{\r\n");
  458.         fwrite(file, "\t\t\t\t\t\tdini_IntSet(str, \"RentGet\", dini_Int(str, \"RentGet\")+hInfo[houseid][Rentcost]);\r\n");
  459.         fwrite(file, "\t\t\t\t\t\tdini_IntSet(str, \"RentPay\", dini_Int(str, \"RentPay\")+hInfo[houseid][Rentcost]);\r\n\t\t\t\t\t}\r\n\t\t\t}\r\n\t\t\thInfo[houseid][Rentfee]=0;\r\n\t\t}\r\n\t}\r\n}\r\n");
  460.        
  461.         fwrite(file, "public OnPlayerPickUpPickup(playerid, pickupid) \r\n{\r\n\tGetHouseStats(playerid, pickupid);\r\n\treturn 0;\r\n}\r\n");
  462.        
  463.         fwrite(file, "stock sscanf(string[], format[], {Float,_}:...)\r\n{\r\n\tnew\r\n\t\tformatPos = 0,\r\n\t\tstringPos = 0,\r\n\t\tparamPos = 2,\r\n\t\tparamCount = numargs();\r\n");
  464.         fwrite(file, "\twhile (paramPos < paramCount && string[stringPos])\r\n\t{\r\n\t\tswitch (format[formatPos++])\r\n\t\t{\r\n\t\t\tcase '\\0':\r\n\t\t\t{\r\n\t\t\t\treturn 0;\r\n");
  465.         fwrite(file, "\t\t\t}\r\n\t\t\tcase 'i', 'd':\r\n\t\t\t{\r\n\t\t\t\tnew\r\n\t\t\t\t\tneg = 1,\r\n\t\t\t\t\tnum = 0,\r\n\t\t\t\t\tch = string[stringPos];\r\n\t\t\t\tif (ch == '-')\r\n\t\t\t\t{\r\n\t\t\t\t\tneg = -1;\r\n");
  466.         fwrite(file, "\t\t\t\t\tch = string[++stringPos];\r\n\t\t\t\t}\r\n\t\t\t\tdo\r\n\t\t\t\t{\r\n\t\t\t\t\tstringPos++;\r\n\t\t\t\t\tif (ch >= '0' && ch <= '9')\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tnum = (num * 10) + (ch - '0');\r\n\t\t\t\t\t}\r\n");
  467.         fwrite(file, "\t\t\t\t\telse\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\treturn 1;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\twhile ((ch = string[stringPos]) && ch != ' ');\r\n\t\t\t\tsetarg(paramPos, 0, num * neg);\r\n\t\t\t}\r\n\t\t\tcase 'h', 'x':\r\n\t\t\t{\r\n");
  468.         fwrite(file, "\t\t\t\tnew\r\n\t\t\t\t\tch,\r\n\t\t\t\t\tnum = 0;\r\n\t\t\t\twhile ((ch = string[stringPos++]))\r\n\t\t\t\t{\r\n\t\t\t\t\tswitch (ch)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tcase 'x', 'X':\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tnum = 0;\r\n\t\t\t\t\t\t\tcontinue;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tcase '0' .. '9':\r\n\t\t\t\t\t\t{\r\n");
  469.         fwrite(file, "\t\t\t\t\t\t\tnum = (num << 4) | (ch - '0');\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tcase 'a' .. 'f':\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tnum = (num << 4) | (ch - ('a' - 10));\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tcase 'A' .. 'F':\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tnum = (num << 4) | (ch - ('A' - 10));\r\n\t\t\t\t\t\t}\r\n");
  470.         fwrite(file, "\t\t\t\t\t\tcase ' ':\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tdefault:\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\treturn 1;\r\n\t\t\t\t\t\t}\r\n");
  471.         fwrite(file, "\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tsetarg(paramPos, 0, num);\r\n\t\t\t}\r\n\t\t\tcase 'c':\r\n\t\t\t{\r\n\t\t\t\tsetarg(paramPos, 0, string[stringPos++]);\r\n\t\t\t}\r\n\t\t\tcase 'f':\r\n\t\t\t{\r\n\t\t\t\tnew tmp[25];\r\n\t\t\t\tstrmid(tmp, string, stringPos, stringPos+sizeof(tmp)-2);\r\n");
  472.         fwrite(file, "\t\t\t\tsetarg(paramPos, 0, _:floatstr(tmp));\r\n\t\t\t}\r\n\t\t\tcase 's', 'z':\r\n\t\t\t{\r\n\t\t\t\tnew\r\n\t\t\t\t\ti = 0,\r\n\t\t\t\t\tch;\r\n\t\t\t\tif (format[formatPos])\r\n");
  473.         fwrite(file, "\t\t\t\t{\r\n\t\t\t\t\twhile ((ch = string[stringPos++]) && ch != ' ')\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tsetarg(paramPos, i++, ch);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif (!i) return 1;\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\twhile ((ch = string[stringPos++]))\r\n");
  474.         fwrite(file, "\t\t\t\t\t{\r\n\t\t\t\t\t\tsetarg(paramPos, i++, ch);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tstringPos--;\r\n\t\t\t\tsetarg(paramPos, i, '\\0');\r\n\t\t\t}\r\n\t\t\tdefault:\r\n\t\t\t{\r\n\t\t\t\tcontinue;\r\n\t\t\t}\r\n\t\t}\r\n\t\twhile (string[stringPos] && string[stringPos] != ' ')\r\n\t\t{\r\n\t\t\tstringPos++;\r\n");
  475.         fwrite(file, "\t\t}\r\n\t\twhile (string[stringPos] == ' ')\r\n\t\t{\r\n\t\t\tstringPos++;\r\n\t\t}\r\n\t\tparamPos++;\r\n\t}\r\n\twhile (format[formatPos] == 'z') formatPos++;\r\n\treturn format[formatPos];\r\n}\r\n");
  476.         fclose(file);
  477. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement