#include new SaveFile[50] = "Houses.pwn"; //new CarFile[50] = "HouseCarCoord.pwn"; #define COLOR_BLUE 0x024EFDFF #define COLOR_YELLOW 0xFAD029FF /* new RandomColors[7][1] = { {0}, //Black {2}, //Blue {42}, //Red {6}, //Yellow/Orange {126}, //Pink {33}, //Grey {86} //Green }; //============================{ Cars ) new RandomCarsSmall[4][1] = { {496}, //Blista {410}, //Manana {529}, //Willard {589} //Club }; new RandomCarsMedium[6][1] = { {542},//Clover {445},//Admiral {562},//Elegy {533},//Feltzer {426},//Premier {560}//Sultan }; new RandomCarsModern[7][1] = { {477},//zr350 {551},//Merit {558},//Uranus {559},//Jester {561},//Stratum (Family car) {587},//Euros {522}//NRG }; new RandomCarsMansion[8][1]= { {409},//Stretch {411},//Infernus {415},//Cheetah {429},//Banshee {451},//Turismo {480},//Comet {506},//SuperGT {541}//Bullet }; */ new HouseID; //new HouseCarID; enum nameENUM { name[256] }; new HouseInfo[400][nameENUM]; //max pickup=400 new saved[MAX_OBJECTS]; public OnFilterScriptInit() { print("\n----------------------------------------------------"); print(" Coords-Saver by Rafelder, Heavily modified by Leopard"); print(" LOADED"); print("-------------------------------------------------------\n"); WritePwn(); OnPlayerCommandText(0, "/housesmall"); OnPlayerCommandText(0, "/housesmall"); OnPlayerCommandText(0, "/housemedium"); return 1; } public OnFilterScriptExit() { print("\n----------------------------------------------------"); print(" Coords-Saver by Rafelder, Heavily modified by Leopard"); print(" UNLOADED"); print("-------------------------------------------------------\n"); for(new i; i < GetMaxPlayers(); i++) { if(IsPlayerConnected(i)) { for(new h = 0; h < MAX_OBJECTS; h++) { DestroyPlayerObject(i, saved[h]); } } } WritePwn(); } public OnPlayerConnect(playerid) { SendClientMessage(playerid, COLOR_YELLOW, "SERVER: House mode on. Type /savehousehelp for a list of commands. Type /done when you are done."); return 1; } public OnPlayerCommandText(playerid, cmdtext[]) { if(IsPlayerAdmin(playerid)) { //deactivated until later /* if (strcmp(cmdtext, "/carsmall", true) == 0) { new vID = HouseCarID++; new Float:X, Float:Y, Float:Z, Float:Angle; new str[256]; new File:iCarFile = fopen(CarFile, io_append); new rand = random(sizeof(RandomCarsSmall)); new iColorRandom = random(sizeof(RandomColors)); GetPlayerPos(playerid, X, Y, Z); GetPlayerFacingAngle(playerid, Float:Angle); 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]); print(str); fwrite(iCarFile, str); fclose(iCarFile); SendClientMessage(playerid, COLOR_BLUE, str); CreatePlayerObject(playerid, 1277, X, Y, Z, 0, 0, 0); return 1; } if(strcmp(cmdtext, "/carmedium", true) == 0) { new vID = HouseCarID++; new Float:X, Float:Y, Float:Z, Float:Angle; new str[256]; new File:iCarFile = fopen(CarFile, io_append); new Random = random(sizeof(RandomCarsMedium)); //5 car's to choose new iColorRandom = random(sizeof(RandomColors)); GetPlayerPos(playerid, X, Y, Z); GetPlayerFacingAngle(playerid, Float:Angle); 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]); print(str); fwrite(iCarFile, str); fclose(iCarFile); SendClientMessage(playerid, COLOR_BLUE, str); CreatePlayerObject(playerid, 1277, X, Y, Z, 0, 0, 0); return 1; } if(strcmp(cmdtext, "/carmodern", true) == 0) { new vID = HouseCarID++; new Float:X, Float:Y, Float:Z, Float:Angle; new str[256]; new File:iCarFile = fopen(CarFile, io_append); new Random = random(sizeof(RandomCarsModern)); new iColorRandom = random(sizeof(RandomColors)); GetPlayerPos(playerid, X, Y, Z); GetPlayerFacingAngle(playerid, Float:Angle); 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]); print(str); fwrite(iCarFile, str); fclose(iCarFile); SendClientMessage(playerid, COLOR_BLUE, str); CreatePlayerObject(playerid, 1277, X, Y, Z, 0, 0, 0); return 1; } if(strcmp(cmdtext, "/carmansion", true) == 0) { new vID = HouseCarID++; new Float:X, Float:Y, Float:Z, Float:Angle; new str[256]; new File:iCarFile = fopen(CarFile, io_append); new Random = random(sizeof(RandomCarsMansion)); new iColorRandom = random(sizeof(RandomColors)); GetPlayerPos(playerid, X, Y, Z); GetPlayerFacingAngle(playerid, Float:Angle); 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]); print(str); fwrite(iCarFile, str); fclose(iCarFile); SendClientMessage(playerid, COLOR_BLUE, str); CreatePlayerObject(playerid, 1277, X, Y, Z, 0, 0, 0); return 1; } */ //beginning of house if (strcmp(cmdtext, "/housesmall", true) == 0) { new ID = HouseID++; new Float:X, Float:Y, Float:Z; GetPlayerPos(playerid, X, Y, Z); format(HouseInfo[ID][name], sizeof(HouseInfo), "AddHouse(%d, %f, %f, %f, 2251.85, -1138.16, 1050.63, 50000, 49000, 9); //Small house\r\n", ID, X, Y, Z); print(HouseInfo[ID][name]); SendClientMessage(playerid, COLOR_YELLOW, HouseInfo[ID]); saved[ID] = CreatePlayerObject(playerid, 1273, Float:X, Float:Y, Float:Z, 0, 0, 0); return 1; } if (strcmp(cmdtext, "/housemedium", true) == 0) { new ID = HouseID++; new Float:X, Float:Y, Float:Z; GetPlayerPos(playerid, X, Y, Z); format(HouseInfo[ID][name], sizeof(HouseInfo), "AddHouse(%d, %f, %f, %f, 2496.65, -1696.55, 1014.74, 10000, 90000, 3);//Medium House\r\n", ID, X, Y, Z); print(HouseInfo[ID][name]); SendClientMessage(playerid, COLOR_YELLOW, HouseInfo[ID]); saved[ID] = CreatePlayerObject(playerid, 1273, Float:X, Float:Y, Float:Z, 0, 0, 0); return 1; } if (strcmp(cmdtext, "/housemodern", true) == 0) { new ID = HouseID++; new Float:X, Float:Y, Float:Z; GetPlayerPos(playerid, X, Y, Z); format(HouseInfo[ID][name], sizeof(HouseInfo), "AddHouse(%d, %f, %f, %f, 2324.33, -1144.79, 1050.71, 150000, 140000, 12);//Big house\r\n", ID, X, Y, Z); print(HouseInfo[ID][name]); SendClientMessage(playerid, COLOR_YELLOW, HouseInfo[ID]); saved[ID] = CreatePlayerObject(playerid, 1273, Float:X, Float:Y, Float:Z, 0, 0, 0); return 1; } if (strcmp(cmdtext, "/housemansion", true) == 0) { new ID = HouseID++; new Float:X, Float:Y, Float:Z; GetPlayerPos(playerid, X, Y, Z); format(HouseInfo[ID][name], sizeof(HouseInfo), "AddHouse(%d, %f, %f, %f, 1299.14, -794.77, 1084.00, 30000, 31090, 5); //Mansion\r\n", ID, X, Y, Z); print(HouseInfo[ID][name]); SendClientMessage(playerid, COLOR_YELLOW, HouseInfo[ID]); saved[ID] = CreatePlayerObject(playerid, 1273, Float:X, Float:Y, Float:Z, 0, 0, 0); return 1; } if (strcmp(cmdtext, "/savehousehelp", true) == 0) { SendClientMessage(playerid, COLOR_BLUE, "---===[ HouseSave For House Inc By Antironix ]===---"); SendClientMessage(playerid, COLOR_YELLOW, "-=> Type /housesmall to save pos for a small house"); SendClientMessage(playerid, COLOR_YELLOW, "-=> Type /housemedium to save pos for medium house"); SendClientMessage(playerid, COLOR_YELLOW, "-=> Type /housemodern to save a pos for a modern house"); SendClientMessage(playerid, COLOR_YELLOW, "-=> Type /housemansion to save a house as a mansion"); SendClientMessage(playerid, COLOR_YELLOW, "-=> Type \"/savecarhelp\" for a list of car commands"); SendClientMessage(playerid, COLOR_BLUE, "--===[-------------Have a nice day!-----------]===--"); return 1; } /* if(strcmp(cmdtext, "/savecarhelp", true) == 0) { SendClientMessage(playerid, COLOR_BLUE, "----===[ CarSave For House Inc By Antironix ]===----"); SendClientMessage(playerid, COLOR_YELLOW, "-=> Type /carsmall to save a car for a small house"); SendClientMessage(playerid, COLOR_YELLOW, "-=> Type /carmedium to save a car for a medium house"); SendClientMessage(playerid, COLOR_YELLOW, "-=> Type /carmodern to save a car for a modern house"); SendClientMessage(playerid, COLOR_YELLOW, "-=> Type /carmansion to save a car for a mansion !"); SendClientMessage(playerid, COLOR_BLUE, "--===[-------------Have a nice day!-----------]===--"); return 1; } */ if(strcmp(cmdtext, "/done", true) == 0) { #define scm SendClientMessage scm(playerid, COLOR_YELLOW, "SERVER: You have completed your house building. The houses will be saves as Houses.pwn."); scm(playerid, COLOR_YELLOW, "SERVER: Put it in your \"filterscripts\" folder and write in server.cfg: filterscripts Houses."); scm(playerid, COLOR_YELLOW, "Thanks for using my filterscript! Greetings from Leopard."); WritePwn(); SendRconCommand("unloadfs savehouse"); } } return 0; } // DO NOT CHANGE IF YOU ARE A NOOB! v stock WritePwn() { new str[200]; new File:file = fopen(SaveFile, io_write); fwrite(file, "#include \r\n"); fwrite(file, "#include \r\n"); 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"); fwrite(file, "//script by Leopard, original created by Antironix\r\n"); format(str, 100, "#define MAX_HOUSES %d\r\n", HouseID); fwrite(file, str); fwrite(file, "#define MAX_RENTCOST 1000\n\r#define MIN_RENTCOST 500\n\r#define MAX_BUY_CARS 8\r\n"); fwrite(file, "#define CAR_DELIVER_TIME 1\r\n"); fwrite(file, "new HOUSE_STATS = 0; //0=stats on pickup, reverse if 1.\r\n"); fwrite(file, " \r\n"); fwrite(file, "enum CarInfo {CarModel,CarName[24],CarCost};\r\n"); fwrite(file, "new Buyable_Cars[MAX_BUY_CARS][CarInfo] =\r\n"); fwrite(file, "{ //Modelid, Buy Name, Price\r\n"); 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"); fwrite(file, "};\r\n"); fwrite(file, "#define Cost_Admiral 50000\r\n"); 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"); 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"); fwrite(file, "new hInfo[MAX_HOUSES][HouseInfo];\r\n"); fwrite(file, "enum HouseCarInfo {HouseCar,GotCar,Houseid,CarModel,Float:CarX,Float:CarY,Float:CarZ,CarColor1,CarColor2,Respawn_Delay,NewCar}\r\n"); fwrite(file, "new cInfo[MAX_HOUSES][HouseCarInfo];\r\n"); fwrite(file, "public OnFilterScriptInit()\r\n{\r\n\tprint(\"--------------------------------------\");\r\n\tprint(\" Simple House System by Antironix\");\r\n\tprint(\"--------------------------------------\");\r\n"); for(new i = 0; i < HouseID; i++) { if(HouseInfo[i][name]) { format(str, sizeof(str), "\t%s\r\n", HouseInfo[i][name]); fwrite(file, str); //write the string inside that } } //done with all the house 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"); fwrite(file, "\treturn 0;\r\n}\r\n"); fwrite(file, "public OnFilterScriptExit()\r\n{\r\n\tfor(new i=0;i 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"); 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"); 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"); fwrite(file, "\tformat(str1, sizeof(str1), \"Houses/Users/\%d\", 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"); 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"); 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/\%d\", udb_encode(pname));\r\n\tif(dini_Exists(str1))\r\n"); 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"); fwrite(file, "\tif(GetPlayerMoney(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"); 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"); 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"); 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"); 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"); 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"); 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"); 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"); fwrite(file, "\telse{SendClientMessage(playerid, c_r, \"This house isn't yours!\");}\r\n\treturn 1;\r\n}\r\n"); 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"); 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"); 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"); 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);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"); 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/\%d\", udb_encode(pname));\r\n\tif(!dini_Exists(str1)) return SendClientMessage(playerid, c_r, \"You don't own a house!\");\r\n"); 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"); 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"); 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"); 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"); 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 (rentcostMAX_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"); 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"); 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"); 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"); fwrite(file, "\tformat(str5, sizeof(str5), \"Houses/Users/\%d\", 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"); 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"); fwrite(file, "\tif(GetPlayerMoney(playerid) 5000){SendClientMessage(playerid, c_r, \"You are not in a house icon!\");return 1;}\r\n"); 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"); fwrite(file, "\tformat(hInfo[playericonhouse[playerid]][Renter], 24, \"ForRent\");\r\n\tformat(str1, sizeof(str1), \"Houses/Users/\%d\", 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"); 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"); 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"); 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"); 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"); 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"); 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"); 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"); 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"); fwrite(file, "\treturn 1;\r\n}\r\n"); 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"); 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"); fwrite(file, "\t\tif(GetPlayerMoney(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"); 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"); 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= '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"); 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"); 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"); 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"); 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"); 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"); 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"); 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"); 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"); 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"); fclose(file); }