#include #include #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 //---------------------------- //---------------------------- // Full house script by Antironix! // Just don't remove the credits! //---------------------------- //---------------------------- #define MAX_HOUSES 2 #define MAX_RENTCOST 1000 #define MIN_RENTCOST 500 #define MAX_BUY_CARS 8 #define CAR_DELIVER_TIME 1 //The time that it takes that your car will be delivered. In hours. new HOUSE_STATS = 0; //0 Means housestats on pickup pickup, 1 means only housestats on /housestats command. //buyable cars enum CarInfo {CarModel,CarName[24],CarCost}; new Buyable_Cars[MAX_BUY_CARS][CarInfo] = { //Modelid, Buy Name, Price {411,"Infernus",0}, {522,"NRG-500",50000}, {451,"Turismo",50000}, {541,"Bullet",50000}, {415,"Cheetah",50000}, {429,"Banshee",50000}, {494,"Hotring",50000}, {556,"Monster",50000} }; #define Cost_Admiral 50000 //---------------------------- //---------------------------- #define c_y 0xFFFF00AA #define c_r 0xAA3333AA new HousePickup[MAX_HOUSES]; new playerinterior[MAX_PLAYERS]=-1; new inhousepickup; new playericonhouse[MAX_PLAYERS]; new Float:housex, Float:housey, Float:housez; new housemapicon[MAX_PLAYERS]; new playerworld[MAX_PLAYERS]; new bool:KillVeh[MAX_VEHICLES] = false; forward rentfee(); forward newcar(); forward KillVehicle(carid); 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 } new hInfo[MAX_HOUSES][HouseInfo]; enum HouseCarInfo { HouseCar, GotCar, Houseid, CarModel, Float:CarX, Float:CarY, Float:CarZ, CarColor1, CarColor2, Respawn_Delay, NewCar } new cInfo[MAX_HOUSES][HouseCarInfo]; #define FILTERSCRIPT #if defined FILTERSCRIPT public OnFilterScriptInit() { print("\n--------------------------------------"); print(" Simple House System by Antironix"); print("--------------------------------------\n"); AddHouse(0, 1442.9769,-629.5287,95.7186, 2317.8201,-1024.7500,1050.2109, 0, 0, 9, 0); AddHouse(1, 1980.9896,-1719.0171,17.0304, 328.1465, 1478.4457,1084.4375, 0, 0, 15, 0); >Added> AddHouse(2, 300.2290, -1154.6504, 81.3235, 1299.0800, -795.2270, 1084.0078, 1000, 1000, 5, 0) >Added> AddHouseCar(2, 444, 283.4770, -1161.5420, 81.2832, 1, 1, -1) AddHouseCar(0, 429, 1454.3051,-636.2531,95.4855, 0, 0, 5*60*1000);//5 min respawn delay SetTimer("rentfee", 1*60*60*1000, 1);//1 hour SetTimer("newcar", CAR_DELIVER_TIME*60*10*1000,1);//1 hour return 1; } public OnFilterScriptExit() { for(new i=0;i 5000) { SendClientMessage(playerid, c_r, "You are not in a house icon!"); return 1; } new str[255],str1[256],pname[24]; GetPlayerName(playerid, pname, 24); format(str1, sizeof(str1), "Houses/houseid%d", playericonhouse[playerid]); if (strcmp(hInfo[playericonhouse[playerid]][Name],pname,false)) return SendClientMessage(playerid, c_r, "This house isn't yours!"); SendClientMessage(playerid, c_y, "You have sold your house!"); format(str, sizeof(str), "%s has sold houseid 0",pname); print(str); GivePlayerMoney(playerid, hInfo[playericonhouse[playerid]][Sell]); dini_Set(str1, "Name", "ForSale"); hInfo[playericonhouse[playerid]][Locked] = dini_IntSet(str1,"Locked",1); format(hInfo[playericonhouse[playerid]][Name],255,"ForSale"); format(str1, sizeof(str1), "Houses/Users/%s", udb_encode(pname)); if (!dini_Exists(str1)) dini_Create(str1); dini_IntSet(str1, "Houseid", -255); DestroyPickup(HousePickup[playericonhouse[playerid]]); HousePickup[playericonhouse[playerid]] = CreatePickup(1273, 23, hInfo[playericonhouse[playerid]][iconx], hInfo[playericonhouse[playerid]][icony], hInfo[playericonhouse[playerid]][iconz]); RemovePlayerMapIcon(playerid, housemapicon[playerid]); return 1; } dcmd_buy(playerid,params[]) { #pragma unused params new timestamp = GetTickCount(); if(timestamp - inhousepickup > 5000) { SendClientMessage(playerid, c_r, "You are not in a house icon!"); return 1; } new str[255],str1[255],pname[24]; GetPlayerName(playerid, pname, 24); format(str1, sizeof(str1), "Houses/Users/%s", udb_encode(pname)); if(dini_Exists(str1)) { if (dini_Int(str1, "Houseid")!=-255) return SendClientMessage(playerid, c_r, "You can only buy one house!"); } format(str1, sizeof(str1), "Houses/houseid%d", playericonhouse[playerid]); if (strcmp(hInfo[playericonhouse[playerid]][Name],"ForSale",true)) return SendClientMessage(playerid, c_r, "This house isn't for sale!"); if(GetPlayerMoney(playerid) 5000) { SendClientMessage(playerid, c_r, "You are not in a house icon!"); return 1; } new str1[256],pname[24]; GetPlayerName(playerid, pname, 24); format(str1, sizeof(str1), "Houses/houseid%d", playericonhouse[playerid]); if(strcmp(hInfo[playericonhouse[playerid]][Name],pname,true)==0) { SendClientMessage(playerid, c_y, "You have locked your house!"); dini_IntSet(str1,"Locked",1); hInfo[playericonhouse[playerid]][Locked] = 1; } else if(strcmp(hInfo[playericonhouse[playerid]][Renter],pname,true)==0) { SendClientMessage(playerid, c_y, "You have locked your house!"); dini_IntSet(str1,"Locked",1); hInfo[playericonhouse[playerid]][Locked] = 1; } else { SendClientMessage(playerid, c_r, "This house isn't yours!"); } return 1; } dcmd_unlock(playerid,params[]) { #pragma unused params new timestamp = GetTickCount(); if(timestamp - inhousepickup > 5000) { SendClientMessage(playerid, c_r, "You are not in a house icon!"); return 1; } new str1[256],pname[24]; GetPlayerName(playerid, pname, 24); format(str1, sizeof(str1), "Houses/houseid%d", playericonhouse[playerid]); if(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; } else 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; } else { SendClientMessage(playerid, c_r, "This house isn't yours!"); } return 1; } dcmd_enter(playerid,params[]) { #pragma unused params new timestamp = GetTickCount(); if(timestamp - inhousepickup > 5000) { SendClientMessage(playerid, c_r, "You are not in a house icon!"); return 1; } new str1[255],pname[24]; GetPlayerPos(playerid, housex, housey, housez); format(str1, sizeof(str1), "Houses/houseid%d", playericonhouse[playerid]); GetPlayerName(playerid, pname, 24); if(hInfo[playericonhouse[playerid]][Locked]==1) return SendClientMessage(playerid, c_r, "This house is locked!"); playerworld[playerid] = GetPlayerVirtualWorld(playerid); SendClientMessage(playerid, c_y, "You entered the house!"); SetPlayerVirtualWorld(playerid, hInfo[playericonhouse[playerid]][Virtualworld]); SetPlayerInterior(playerid, hInfo[playericonhouse[playerid]][Interior]); SetPlayerPos(playerid, hInfo[playericonhouse[playerid]][InteriorX], hInfo[playericonhouse[playerid]][InteriorY], hInfo[playericonhouse[playerid]][InteriorZ]); playerinterior[playerid] = hInfo[playericonhouse[playerid]][Interior]; return 1; } dcmd_exit(playerid,params[]) { #pragma unused params if(GetPlayerInterior(playerid)==playerinterior[playerid]) { SetPlayerPos(playerid, housex, housey, housez); SetPlayerInterior(playerid, playerworld[playerid]); } else { SendClientMessage(playerid, c_r, "You have not entered a house!"); } return 1; } dcmd_home(playerid,params[]) { #pragma unused params new str1[256],pname[24]; GetPlayerName(playerid, pname, 24); format(str1, sizeof(str1), "Houses/Users/%s", udb_encode(pname)); if(!dini_Exists(str1)) return SendClientMessage(playerid, c_r, "You don't own a house!"); if(dini_Int(str1, "Houseid")!=-255) { 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); } else if (dini_Int(str1, "Rentid")!=-255) { 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); } else { SendClientMessage(playerid, c_r, "You don't own a house!"); } return 1; } dcmd_setrent(playerid,params[]) { new timestamp = GetTickCount(); if(timestamp - inhousepickup > 5000) { SendClientMessage(playerid, c_r, "You are not in a house icon!"); return 1; } new str[256],str1[256],pname[24]; GetPlayerName(playerid, pname, 24); format(str1, sizeof(str1), "Houses/houseid%d", playericonhouse[playerid]); str = dini_Get(str1,"Name"); if (strcmp(str,pname,true)) return SendClientMessage(playerid, c_r, "This house isn't yours!"); new rentcost, rentable; if (sscanf(params, "dd", rentable, rentcost)) return SendClientMessage(playerid, c_r, "USAGE: /setrent [0/1] [Rentcost]"); else if (rentcostMAX_RENTCOST) { format(str, sizeof(str), "The maximum rentcost is $%i.", MAX_RENTCOST); SendClientMessage(playerid, c_r, str); return 1; } else 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; } else 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; } return 1; } dcmd_rent(playerid,params[]) { #pragma unused params new timestamp = GetTickCount(); if(timestamp - inhousepickup > 5000) { SendClientMessage(playerid, c_r, "You are not in a house icon!"); return 1; } new str[255],str1[256],str5[255],pname[24]; GetPlayerName(playerid, pname, 24); format(str1, sizeof(str1), "Houses/houseid%d", playericonhouse[playerid]); format(str5, sizeof(str5), "Houses/Users/%s", udb_encode(pname)); if(dini_Isset(str5, "Rentid")) { if (dini_Int(str5, "Rentid")!=-255) return SendClientMessage(playerid, c_r, "You can only rent one house at a time!"); } format(str, sizeof(str), dini_Get(str1,"Name")); if (strcmp(str,"ForSale",true)==0) return SendClientMessage(playerid, c_r, "This house has no owner!"); if(hInfo[playericonhouse[playerid]][Rentable]==0 || strcmp(hInfo[playericonhouse[playerid]][Renter], "ForRent", true)==0) return SendClientMessage(playerid, c_r, "This house is not rentable!"); if(GetPlayerMoney(playerid) 5000) { SendClientMessage(playerid, c_r, "You are not in a house icon!"); return 1; } new str1[256],pname[24]; GetPlayerName(playerid, pname, 24); format(str1, sizeof(str1), "Houses/houseid%d", playericonhouse[playerid]); if(strcmp(hInfo[playericonhouse[playerid]][Renter], pname, true)) return SendClientMessage(playerid, c_r, "You aren't renting this house!"); dini_Set(str1, "Renter", "ForRent"); format(hInfo[playericonhouse[playerid]][Renter], 24, "ForRent"); format(str1, sizeof(str1), "Houses/Users/%s", udb_encode(pname)); dini_IntSet(str1, "Rentid", -255); SendClientMessage(playerid, c_y, "You have unrented this house!"); return 1; } dcmd_house(playerid,params[]) { #pragma unused params SendClientMessage(playerid, c_y, "-------------"); SendClientMessage(playerid, c_y, "House options"); SendClientMessage(playerid, c_y, "-------------"); SendClientMessage(playerid, c_y, "/setrent [0/1] [Cost] - House owner"); SendClientMessage(playerid, c_y, "/ordercar [CarName] - House owner"); SendClientMessage(playerid, c_y, "/getrent - House owner"); SendClientMessage(playerid, c_y, "/lock - Renter/Owner"); SendClientMessage(playerid, c_y, "/unlock - Renter/Owner"); SendClientMessage(playerid, c_y, "/payrent - Renter"); SendClientMessage(playerid, c_y, "/unrent - Renter"); SendClientMessage(playerid, c_y, "/rent - Guest"); SendClientMessage(playerid, c_y, "-------------"); return 1; } dcmd_housestats(playerid,params[]) { #pragma unused params new timestamp = GetTickCount(); if(timestamp - inhousepickup > 5000) { SendClientMessage(playerid, c_r, "You are not in a house icon!"); return 1; } new str[256]; format(str, sizeof(str), "Owner: %s", hInfo[playericonhouse[playerid]][Name]); SendClientMessage(playerid, c_y, str); format(str, sizeof(str), "Cost: $%d", hInfo[playericonhouse[playerid]][Cost]); SendClientMessage(playerid, c_y, str); format(str, sizeof(str), "Renter: %s", hInfo[playericonhouse[playerid]][Renter]); SendClientMessage(playerid, c_y, str); format(str, sizeof(str), "Rentcost: $%d / hour", hInfo[playericonhouse[playerid]][Rentcost]); SendClientMessage(playerid, c_y, str); return 1; } dcmd_getrent(playerid,params[]) { #pragma unused params new timestamp = GetTickCount(); if(timestamp - inhousepickup > 5000) { SendClientMessage(playerid, c_r, "You are not in a house icon!"); return 1; } new pname[24]; GetPlayerName(playerid, pname, 24); if(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); } else { SendClientMessage(playerid, c_r, "This house isn't yours!"); } return 1; } dcmd_payrent(playerid,params[]) { #pragma unused params new timestamp = GetTickCount(); if(timestamp - inhousepickup > 5000) { SendClientMessage(playerid, c_r, "You are not in a house icon!"); return 1; } new pname[24]; GetPlayerName(playerid, pname, 24); if(strcmp(hInfo[playericonhouse[playerid]][Renter],pname,true)==0) { new str[255]; format(str, sizeof(str), "Houses/houseid%d", playericonhouse[playerid]); if(GetPlayerMoney(playerid) 5000) { SendClientMessage(playerid, c_r, "You are not in a house icon!"); return 1; } new pname[24]; GetPlayerName(playerid, pname, 24); if(strcmp(hInfo[playericonhouse[playerid]][Name],pname,true)==0) { new carname[40]; if (sscanf(params, "s", carname)) { SendClientMessage(playerid, c_r, "USAGE: /ordercar [CarName]"); } else { new str[256], abc; for(new i=0;i= '0' && ch <= '9') { num = (num * 10) + (ch - '0'); } else { return 1; } } while ((ch = string[stringPos]) && ch != ' '); setarg(paramPos, 0, num * neg); } case 'h', 'x': { new ch, num = 0; while ((ch = string[stringPos++])) { switch (ch) { case 'x', 'X': { num = 0; continue; } case '0' .. '9': { num = (num << 4) | (ch - '0'); } case 'a' .. 'f': { num = (num << 4) | (ch - ('a' - 10)); } case 'A' .. 'F': { num = (num << 4) | (ch - ('A' - 10)); } case ' ': { break; } default: { return 1; } } } setarg(paramPos, 0, num); } case 'c': { setarg(paramPos, 0, string[stringPos++]); } case 'f': { new tmp[25]; strmid(tmp, string, stringPos, stringPos+sizeof(tmp)-2); setarg(paramPos, 0, _:floatstr(tmp)); } case 's', 'z': { new i = 0, ch; if (format[formatPos]) { while ((ch = string[stringPos++]) && ch != ' ') { setarg(paramPos, i++, ch); } if (!i) return 1; } else { while ((ch = string[stringPos++])) { setarg(paramPos, i++, ch); } } stringPos--; setarg(paramPos, i, '\0'); } default: { continue; } } while (string[stringPos] && string[stringPos] != ' ') { stringPos++; } while (string[stringPos] == ' ') { stringPos++; } paramPos++; } while (format[formatPos] == 'z') formatPos++; return format[formatPos]; }