Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Commands:
- RCON Commands:
- /Createhouse [You Can Create a House]
- /Deletehouse [You Can Delete a House]
- /Gotohouse [You Can Teleport yourself to a House]
- /hedit [You Can Edit House Options]
- /savehouses [you should do this after creating houses for more Confidence]
- Player Commands:
- /Buyhouse [You Can Buy House]
- /Sellhousetomarket [You Can Sell House To Server]
- /Houseupgrade [You Can Upgrade Your House To Next Level]
- /Enter [You Can enter To Your House]
- /Exit [You Can Exit From Your House]
- /Heal [You Can Heal Yourself]
- /Hwithdraw [You Can Withdraw Money from your House]
- /Hdeposit [You Can Deposit Your Money To Your House]
- /Hlock [You Can Lock Your House Door]
- /HouseHelp [You Can See All The Commands For AirHouse]
- Features:
- 1.Very Easy to Use
- 2.Very Strong Save System dini
- 3.Dynamic Creating House
- 4.Dynamic Editing House
- 5.Easy RCON CMDs
- 6. Upgrade System
- In Next Version:
- 1.Withdraw / Deposit Gun,Drug,Material & etc.
- 2.Rentable Houses.
- 3.More Levels For House
- 4.Create Some Interior
- 5.If Have Suggestion Say
- Installation:
- Download file and extract it.Put Houses file into your Script file then put all includes into your pawno/includes file and put AirHouseV0.1 into filterscripts files. Now Put AirHouseV0.1 into server.cfg front filterscripts
- like:filterscripts AirHouseV0.1
- Note: It is Very important to put houses.cfg into your scriptfiles else will crash server.
- Note: If You don't update your plugins or includes CMDs won't Work.
- Note:And Plz Don't remove Credits.
- //////////////////////////////////////////////////////////////////////////////////////////////////////
- // This Is Air-House System
- // Plz Dont Remove Credits
- #define FILTERSCRIPT
- #include <a_samp>
- #include <zcmd>
- #include <streamer>
- #include <foreach>
- #include <sscanf2>
- #include <dini>
- #if defined FILTERSCRIPT
- #pragma tabsize 0
- #define MAX_HOUSES 501
- #define CGE "{2A8A07}"
- #define COE "{E600FF}"
- #define CWE "{FFFFFF}"
- #define COLOR_GREY 0xAFAFAFFF
- #define COLOR_DARKRED 0xAA3333FF
- #define COLOR_WHITE 0xFFFFFFFF
- #define COLOR_GREEN 0x33AA33FF
- #define COLOR_YELLOW 0xFFFF00FF
- #define COLOR_PURPLE 0xC2A2DAFF
- #define COLOR_ORANGE 0xFF9900FF
- #define COLOR_RED 0xFF0606FF
- #define COLOR_LIGHTBLUE 0x33CCFFFF
- #define COLOR_LIGHTRED 0xFF6347FF
- public OnFilterScriptInit()
- {
- print("\n--------------------------------------");
- print(" ------------AirHouse V0.1--------------");
- print("--------------------------------------\n");
- CheckFiles();
- LoadHouses();
- return 1;
- }
- public OnFilterScriptExit()
- {
- return 1;
- }
- #else
- main()
- {
- print("\n----------------------------------");
- print(" ----------Credit:AirBloG-----------");
- print("----------------------------------\n");
- CheckFiles();
- LoadHouses();
- }
- #endif
- ////////////////////////////////////////////////////////////////////////////////
- enum pInfo
- {
- // Temp Values
- pLoggedIn,
- pSpawn,
- // Permanent Values
- pOwner,
- pLevel,
- pRented,
- pHours,
- pLocal,
- pMoney,
- pModel,
- pHouse,
- pVHouse,
- pMaskOn,
- pInt,
- pPhousekey,
- }
- new PlayerInfo[MAX_PLAYERS][pInfo];
- ////////////////////////////////////////////////////////////////////////////////
- enum houseInfo
- {
- hLevel,
- hPrice,
- hStatus,
- hOwner[32],
- Float:hX,
- Float:hY,
- Float:hZ,
- hOwned,
- hMoney,
- hTakings,
- hRentabil,
- hRent,
- hInt,
- hPickup,
- Text3D:hText,
- hSpawn
- }
- new HouseInfo[MAX_HOUSES][houseInfo];
- stock CheckFiles()
- {
- if(!dini_Exists("houses.cfg")) dini_Create("houses.cfg");
- return 1;
- }
- stock LoadHouses()
- {
- new binfo[21][32];
- new string[256];
- new File:file = fopen("Houses/houses.cfg", io_read);
- if(file)
- {
- new idx = 1;
- while(idx < MAX_HOUSES)
- {
- fread(file, string);
- split(string, binfo, '|');
- HouseInfo[idx][hLevel] = strval(binfo[0]);
- HouseInfo[idx][hPrice] = strval(binfo[1]);
- HouseInfo[idx][hStatus] = strval(binfo[2]);
- format(HouseInfo[idx][hOwner], 32, "%s", binfo[3]);
- HouseInfo[idx][hX] = floatstr(binfo[4]);
- HouseInfo[idx][hY] = floatstr(binfo[5]);
- HouseInfo[idx][hZ] = floatstr(binfo[6]);
- HouseInfo[idx][hMoney] = strval(binfo[7]);
- if(HouseInfo[idx][hLevel])
- {
- HouseInfo[idx][hPickup] = CreateDynamicPickup(1273, 1, HouseInfo[idx][hX], HouseInfo[idx][hY], HouseInfo[idx][hZ], 0);
- if(!strcmp("The State", HouseInfo[idx][hOwner])) format(string, sizeof(string), ""COE"["CWE"%d, House (Lvl: %d)"COE"]\n"COE"Owner"CWE" %s\n"COE"Status"CWE" For Sale\n"CWE"$%d", idx, HouseInfo[idx][hLevel], HouseInfo[idx][hOwner], HouseInfo[idx][hPrice]);
- else format(string, sizeof(string), ""COE"["CWE"ID:%d, House (Lvl: %d)"COE"]\n"COE"Owner"CWE" %s\n"COE"Status"CWE" %s", idx, HouseInfo[idx][hLevel], HouseInfo[idx][hOwner], RHS(idx));
- HouseInfo[idx][hText] = CreateDynamic3DTextLabel(string, COLOR_WHITE, HouseInfo[idx][hX], HouseInfo[idx][hY], HouseInfo[idx][hZ]+0.3, 15);
- }
- idx++;
- }
- }
- print("Houses loaded successfully.");
- return 1;
- }
- stock SaveHouses()
- {
- new idx = 1, File:file;
- new string[256];
- while(idx < MAX_HOUSES)
- {
- format(string, sizeof(string), "%d|%d|%d|%s|%f|%f|%f|%d\r\n",
- HouseInfo[idx][hLevel],
- HouseInfo[idx][hPrice],
- HouseInfo[idx][hStatus],
- HouseInfo[idx][hOwner],
- HouseInfo[idx][hX],
- HouseInfo[idx][hY],
- HouseInfo[idx][hZ],
- HouseInfo[idx][hMoney]
- );
- if(idx == 1)
- {
- file = fopen("Houses/houses.cfg", io_write);
- }
- else
- {
- file = fopen("Houses/houses.cfg", io_append);
- }
- fwrite(file, string);
- fclose(file);
- idx++;
- }
- print("Houses saved successfully.");
- }
- ////////////////////////////////////////////////////////////////////////////////
- public OnGameModeInit()
- {
- // Don't use these lines if it's a filterscript
- SetGameModeText("Blank Script");
- CheckFiles();
- LoadHouses();
- AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
- return 1;
- }
- public OnGameModeExit()
- {
- return 1;
- }
- public OnPlayerRequestClass(playerid, classid)
- {
- SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
- SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
- SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- return 1;
- }
- public OnPlayerSpawn(playerid)
- {
- return 1;
- }
- public OnPlayerDeath(playerid, killerid, reason)
- {
- return 1;
- }
- public OnVehicleSpawn(vehicleid)
- {
- return 1;
- }
- public OnVehicleDeath(vehicleid, killerid)
- {
- return 1;
- }
- public OnPlayerText(playerid, text[])
- {
- return 1;
- }
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- if (strcmp("/mycommand", cmdtext, true, 10) == 0)
- {
- // Do something here
- return 1;
- }
- return 0;
- }
- public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
- {
- return 1;
- }
- public OnPlayerExitVehicle(playerid, vehicleid)
- {
- return 1;
- }
- public OnPlayerStateChange(playerid, newstate, oldstate)
- {
- return 1;
- }
- public OnPlayerEnterCheckpoint(playerid)
- {
- return 1;
- }
- public OnPlayerLeaveCheckpoint(playerid)
- {
- return 1;
- }
- public OnPlayerEnterRaceCheckpoint(playerid)
- {
- return 1;
- }
- public OnPlayerLeaveRaceCheckpoint(playerid)
- {
- return 1;
- }
- public OnRconCommand(cmd[])
- {
- return 1;
- }
- public OnPlayerRequestSpawn(playerid)
- {
- return 1;
- }
- public OnObjectMoved(objectid)
- {
- return 1;
- }
- new ScriptMoneyUpdated[MAX_PLAYERS];
- new ScriptMoney[MAX_PLAYERS];
- forward SafeGivePlayerMoney(plyid, amounttogive);
- public SafeGivePlayerMoney(plyid, amounttogive)
- {
- new curHour, curMinute, curSecond;
- gettime(curHour, curMinute, curSecond);
- ScriptMoneyUpdated[plyid] = curSecond;
- if (amounttogive < 0)
- {
- GivePlayerMoney(plyid, amounttogive);
- ScriptMoney[plyid] = (ScriptMoney[plyid] + amounttogive);
- }
- else
- {
- ScriptMoney[plyid] = (ScriptMoney[plyid] + amounttogive);
- GivePlayerMoney(plyid, amounttogive);
- }
- return 1;
- }
- public OnPlayerObjectMoved(playerid, objectid)
- {
- return 1;
- }
- public OnPlayerPickUpPickup(playerid, pickupid)
- {
- return 1;
- }
- public OnVehicleMod(playerid, vehicleid, componentid)
- {
- return 1;
- }
- public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
- {
- return 1;
- }
- public OnVehicleRespray(playerid, vehicleid, color1, color2)
- {
- return 1;
- }
- public OnPlayerSelectedMenuRow(playerid, row)
- {
- return 1;
- }
- public OnPlayerExitedMenu(playerid)
- {
- return 1;
- }
- public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
- {
- return 1;
- }
- public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
- {
- return 1;
- }
- public OnRconLoginAttempt(ip[], password[], success)
- {
- return 1;
- }
- public OnPlayerUpdate(playerid)
- {
- return 1;
- }
- public OnPlayerStreamIn(playerid, forplayerid)
- {
- return 1;
- }
- public OnPlayerStreamOut(playerid, forplayerid)
- {
- return 1;
- }
- public OnVehicleStreamIn(vehicleid, forplayerid)
- {
- return 1;
- }
- public OnVehicleStreamOut(vehicleid, forplayerid)
- {
- return 1;
- }
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
- {
- return 1;
- }
- public OnPlayerClickPlayer(playerid, clickedplayerid, source)
- {
- return 1;
- }
- CMD:createhouse(playerid, params[])
- {
- new string[128];
- if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You are not an authorized to use this command.");
- for(new idx=1; idx<MAX_HOUSES; idx++)
- {
- if(!HouseInfo[idx][hLevel])
- {
- // Getting Business Setup
- new Float:X, Float:Y, Float:Z;
- GetPlayerPos(playerid, X, Y, Z);
- // Making Business
- HouseInfo[idx][hLevel] = 1;
- HouseInfo[idx][hPrice] = 955000;
- HouseInfo[idx][hStatus] = 0;
- format(HouseInfo[idx][hOwner], 32, "The State");
- HouseInfo[idx][hX] = X;
- HouseInfo[idx][hY] = Y;
- HouseInfo[idx][hZ] = Z;
- HouseInfo[idx][hMoney] = 0;
- HouseInfo[idx][hPickup] = CreateDynamicPickup(1273, 1, HouseInfo[idx][hX], HouseInfo[idx][hY], HouseInfo[idx][hZ], 0);
- format(string, sizeof(string), ""COE"["CWE"ID:%d, House (Lvl: %d)"COE"]\n"COE"Owner"CWE" %s\n"COE"Status"CWE" For Sale\n"CWE"$%d", idx, HouseInfo[idx][hLevel], HouseInfo[idx][hOwner], HouseInfo[idx][hPrice]);
- HouseInfo[idx][hText] = CreateDynamic3DTextLabel(string, COLOR_WHITE, HouseInfo[idx][hX], HouseInfo[idx][hY], HouseInfo[idx][hZ]+0.3, 15);
- Log("logs/house.log", string);
- idx = MAX_HOUSES;
- }
- }
- return 1;
- }
- CMD:deletehouse(playerid, params[])
- {
- new id, string[128];
- if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You are not an authorized to use this command.");
- // if(!aDuty[playerid]) return SendClientMessage(playerid, COLOR_GREY, "You are not on admin duty.");
- if(sscanf(params, "i", id)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /deletehouse [houseid]");
- if(!HouseInfo[id][hLevel]) return SendClientMessage(playerid, COLOR_GREY, "Invalid business id.");
- foreach(Player, i)
- {
- if(IsPlayerLoggedIn(i) && PlayerInfo[i][pHouse] == id)
- {
- PlayerInfo[i][pHouse] = 0;
- format(string, sizeof(string), " Administrator %s has deleted your house.", RPN(playerid));
- SendClientMessage(i, COLOR_WHITE, string);
- }
- }
- if(!strcmp("The State", HouseInfo[id][hOwner]))
- {
- format(string, sizeof(string), "{FF0000}Delete:{FF6347} %s has deleted house ID %d.", RPN(playerid), id);
- }
- else
- {
- format(string, sizeof(string), "{FF0000}Delete:{FF6347} %s has deleted %s's house. (ID %d)", RPN(playerid), HouseInfo[id][hOwner], id);
- }
- SendClientMessage(COLOR_DARKRED, 1, string);
- Log("logs/house.log", string);
- HouseInfo[id][hLevel] = 0;
- HouseInfo[id][hPrice] = 0;
- HouseInfo[id][hStatus] = 0;
- format(HouseInfo[id][hOwner], 32, "");
- HouseInfo[id][hX] = 0;
- HouseInfo[id][hY] = 0;
- HouseInfo[id][hZ] = 0;
- HouseInfo[id][hMoney] = 0;
- DestroyDynamicPickup(HouseInfo[id][hPickup]);
- DestroyDynamic3DTextLabel(HouseInfo[id][hText]);
- return 1;
- }
- CMD:hedit(playerid, params[])
- {
- new bizid, string[128], input;
- if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You are not an authorized to use this command.");
- // if(!aDuty[playerid]) return SendClientMessage(playerid, COLOR_GREY, "You are not on admin duty.");
- if(sscanf(params, "s[32]", params))
- {
- SendClientMessage(playerid, COLOR_WHITE, "USAGE: /hedit [option] [houseid]");
- SendClientMessage(playerid, COLOR_GREY, "OPTIONS: location | price | level");
- return 1;
- }
- if(!strcmp(params, "location", true, 8))
- {
- if(sscanf(params, "s[32]i", params, bizid)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /hedit location [house]");
- new idx = bizid;
- if(!HouseInfo[bizid][hLevel]) return SendClientMessage(playerid, COLOR_GREY, "Invalid house id.");
- GetPlayerPos(playerid, HouseInfo[idx][hX], HouseInfo[idx][hY], HouseInfo[idx][hZ]);
- DestroyDynamicPickup(HouseInfo[idx][hPickup]);
- HouseInfo[idx][hPickup] = CreateDynamicPickup(1273, 1, HouseInfo[idx][hX], HouseInfo[idx][hY], HouseInfo[idx][hZ], 0);
- DestroyDynamic3DTextLabel(HouseInfo[idx][hText]);
- if(!strcmp("The State", HouseInfo[idx][hOwner])) format(string, sizeof(string), ""COE"["CWE"%d, House (Lvl: %d)"COE"]\n"COE"Owner"CWE" %s\n"COE"Status"CWE" For Sale\n"CWE"$%d", idx, HouseInfo[idx][hLevel], HouseInfo[idx][hOwner], HouseInfo[idx][hPrice]);
- else format(string, sizeof(string), ""COE"["CWE"%d, House (Lvl: %d)"COE"]\n"COE"Owner"CWE" %s\n"COE"Status"CWE" %s", idx, HouseInfo[idx][hLevel], HouseInfo[idx][hOwner], RHS(idx));
- HouseInfo[idx][hText] = CreateDynamic3DTextLabel(string, COLOR_WHITE, HouseInfo[idx][hX], HouseInfo[idx][hY], HouseInfo[idx][hZ]+0.3, 15);
- }
- else if(!strcmp(params, "price", true, 5))
- {
- if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You are not an authorized to use this command.");
- if(sscanf(params, "s[32]ii", params, bizid, input)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /house price [house] [price]");
- new idx = bizid;
- if(!HouseInfo[idx][hLevel]) return SendClientMessage(playerid, COLOR_GREY, "Invalid house id.");
- if(strcmp("The State", HouseInfo[bizid][hOwner])) return SendClientMessage(playerid, COLOR_GREY, "You can't edit the price of owned businesses.");
- HouseInfo[bizid][hPrice] = input;
- format(string, sizeof(string), ""COE"["CWE"%d, House (Lvl: %d)"COE"]\n"COE"Owner"CWE" %s\n"COE"Status"CWE" For Sale\n"CWE"$%d", idx, HouseInfo[idx][hLevel], HouseInfo[idx][hOwner], HouseInfo[idx][hPrice]);
- UpdateDynamic3DTextLabelText(HouseInfo[bizid][hText], COLOR_WHITE, string);
- }
- else if(!strcmp(params, "level", true, 5))
- {
- if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You are not an authorized to use this command.");
- if(sscanf(params, "s[32]ii", params, bizid, input)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /house level [houseid] [level]");
- new idx = bizid;
- //if(!HouseInfo[bizid][hLevel]) return SendClientMessage(playerid, COLOR_GREY, "Invalid house id.");
- if(input < 1 || input > 11) return SendClientMessage(playerid, COLOR_GREY, "Levels are between 1 and 11.");
- HouseInfo[bizid][hLevel] = input;
- if(!strcmp("The State", HouseInfo[idx][hOwner])) format(string, sizeof(string), ""COE"["CWE"%d, House (Lvl: %d)"COE"]\n"COE"Owner"CWE" %s\n"COE"Status"CWE" For Sale\n"CWE"$%d", idx, HouseInfo[idx][hLevel], HouseInfo[idx][hOwner], HouseInfo[idx][hPrice]);
- else format(string, sizeof(string), ""COE"["CWE"%d, House (Lvl: %d)"COE"]\n"COE"Owner"CWE" %s\n"COE"Status"CWE" %s", idx, HouseInfo[idx][hLevel], HouseInfo[idx][hOwner], RHS(idx));
- UpdateDynamic3DTextLabelText(HouseInfo[bizid][hText], COLOR_WHITE, string);
- }
- return 1;
- }
- CMD:gotohouse(playerid, params[])
- {
- new idx, string[128];
- if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You are not an authorized to use this command.");
- // if(!aDuty[playerid]) return SendClientMessage(playerid, COLOR_GREY, "You are not on admin duty.");
- if(sscanf(params, "i", idx)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /gotohouse [houseid]");
- if(!HouseInfo[idx][hLevel]) return SendClientMessage(playerid, COLOR_GREY, "Invalid house id.");
- SetPlayerVirtualWorld(playerid, 0);
- SetPlayerInterior(playerid, 0);
- SetPlayerPos(playerid, HouseInfo[idx][hX], HouseInfo[idx][hY], HouseInfo[idx][hZ]);
- format(string, sizeof(string), " You have teleported to house ID %d.", idx);
- SendClientMessage(playerid, COLOR_WHITE, string);
- return 1;
- }
- CMD:buyhouse(playerid, params[])
- {
- new string[128], done;
- if(PlayerInfo[playerid][pHouse]) return SendClientMessage(playerid, COLOR_GREY, "You already have a houses.");
- for(new idx=1; idx<MAX_HOUSES; idx++)
- {
- if(IsPlayerInRangeOfPoint(playerid, 2, HouseInfo[idx][hX], HouseInfo[idx][hY], HouseInfo[idx][hZ]))
- {
- if(!strcmp("The State", HouseInfo[idx][hOwner], false))
- {
- if(GetPlayerMoney(playerid) < HouseInfo[idx][hPrice]) return SendClientMessage(playerid, COLOR_GREY, "You don't have enough money to buy this house.");
- GivePlayerMoney(playerid, -HouseInfo[idx][hPrice]);
- if(PlayerInfo[playerid][pHouse]) PlayerInfo[playerid][pVHouse] = idx;
- else PlayerInfo[playerid][pHouse] = idx;
- format(HouseInfo[idx][hOwner], 32, "%s", RPNU(playerid));
- format(string, sizeof(string), ""COE"["CWE"%d, House (Lvl: %d)"COE"]\n"COE"Owner"CWE" %s\n"COE"Status"CWE" %s", idx, HouseInfo[idx][hLevel], HouseInfo[idx][hOwner], RHS(idx));
- UpdateDynamic3DTextLabelText(HouseInfo[idx][hText], COLOR_WHITE, string);
- SendClientMessage(playerid, COLOR_GREEN, " You have successfully bought a house.");
- SendClientMessage(playerid, COLOR_WHITE, " Type /househelp to view your house commands.");
- format(string, sizeof(string), "%s has bought house id %d.", RPN(playerid), idx);
- Log("logs/house.log", string);
- idx = MAX_HOUSES;
- done = 1;
- }
- if(idx == MAX_HOUSES-1 && !done)
- {
- SendClientMessage(playerid, COLOR_GREY, "This house is owned by someone else.");
- }
- }
- if(idx == MAX_HOUSES-1 && !done)
- {
- SendClientMessage(playerid, COLOR_GREY, "You are not near a buyable house.");
- }
- }
- return 1;
- }
- CMD:exit(playerid,params[])
- {
- new done, string[128];
- if(IsPlayerInRangeOfPoint(playerid, 2, 243.9951,304.9418,999.1484) || IsPlayerInRangeOfPoint(playerid, 2, 2259.6702,-1135.8542,1050.6328) || IsPlayerInRangeOfPoint(playerid, 2, 2308.8254,-1212.8070,1049.0234) || IsPlayerInRangeOfPoint(playerid, 2, 260.7436,1237.5563,1084.2578)
- || IsPlayerInRangeOfPoint(playerid, 2, -42.5742,1405.6521,1084.4297) || IsPlayerInRangeOfPoint(playerid, 2, 2468.6787,-1698.2617,1013.5078) || IsPlayerInRangeOfPoint(playerid, 2, 2365.2183,-1135.4014,1050.8750) || IsPlayerInRangeOfPoint(playerid, 2, 2270.1270,-1210.4855,1047.5625)
- || IsPlayerInRangeOfPoint(playerid, 2, 2324.4424,-1149.2057,1050.7101) || IsPlayerInRangeOfPoint(playerid, 2, 83.0863,1322.3020,1083.8662) || IsPlayerInRangeOfPoint(playerid, 2, 225.6631,1022.3559,1084.0150)) // Houses
- {
- new idx;
- idx = GetPlayerVirtualWorld(playerid)-500;
- if(!done && idx < MAX_HOUSES && HouseInfo[idx][hLevel])
- {
- format(string, sizeof(string), "* %s pushes the door and exits the house.", RPN(playerid));
- if(PlayerInfo[playerid][pMaskOn] == 1)
- {
- format(string, sizeof(string), "* Stranger pushes the door and exits the house.");
- }
- else
- {
- format(string, sizeof(string), "* %s pushes the door and exits the house.", RPN(playerid));
- }
- SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
- SetPlayerPos(playerid, HouseInfo[idx][hX], HouseInfo[idx][hY], HouseInfo[idx][hZ]);
- SetPlayerInterior(playerid, 0);
- SetPlayerVirtualWorld(playerid, 0);
- done = 1;
- }
- }
- return 1;
- }
- CMD:hlock(playerid,params[])
- {
- new string[128], idx, done, lockdone;
- if(PlayerInfo[playerid][pHouse])
- {
- idx = PlayerInfo[playerid][pHouse];
- if(IsPlayerInRangeOfPoint(playerid, 2, HouseInfo[idx][hX], HouseInfo[idx][hY], HouseInfo[idx][hZ]))
- {
- if(!HouseInfo[PlayerInfo[playerid][pHouse]][hStatus])
- {
- HouseInfo[PlayerInfo[playerid][pHouse]][hStatus] = 1;
- format(string, sizeof(string), ""COE"["CWE"%d, House (Lvl: %d)"COE"]\n"COE"Owner"CWE" %s\n"COE"Status"CWE" %s", idx, HouseInfo[idx][hLevel], HouseInfo[idx][hOwner], RHS(idx));
- UpdateDynamic3DTextLabelText(HouseInfo[PlayerInfo[playerid][pHouse]][hText], COLOR_WHITE, string);
- format(string, sizeof(string), "* %s takes out their house keys and unlocks it.", RPN(playerid));
- SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
- GameTextForPlayer(playerid, "~g~House Unlocked", 3500, 3);
- }
- else if(HouseInfo[PlayerInfo[playerid][pHouse]][hStatus])
- {
- HouseInfo[PlayerInfo[playerid][pHouse]][hStatus] = 0;
- format(string, sizeof(string), ""COE"["CWE"%d, House (Lvl: %d)"COE"]\n"COE"Owner"CWE" %s\n"COE"Status"CWE" %s", idx, HouseInfo[idx][hLevel], HouseInfo[idx][hOwner], RHS(idx));
- UpdateDynamic3DTextLabelText(HouseInfo[PlayerInfo[playerid][pHouse]][hText], COLOR_WHITE, string);
- format(string, sizeof(string), "* %s takes out their house keys and locks it.", RPN(playerid));
- SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
- GameTextForPlayer(playerid, "~r~House Locked", 3500, 3);
- }
- done = 1;
- lockdone = 1;
- }
- }
- if(PlayerInfo[playerid][pVHouse] && !done)
- {
- idx = PlayerInfo[playerid][pVHouse];
- if(IsPlayerInRangeOfPoint(playerid, 2, HouseInfo[idx][hX], HouseInfo[idx][hY], HouseInfo[idx][hZ]))
- {
- if(!HouseInfo[PlayerInfo[playerid][pVHouse]][hStatus])
- {
- HouseInfo[PlayerInfo[playerid][pVHouse]][hStatus] = 1;
- format(string, sizeof(string), ""COE"["CWE"%d, House (Lvl: %d)"COE"]\n"COE"Owner"CWE" %s\n"COE"Status"CWE" %s", idx, HouseInfo[idx][hLevel], HouseInfo[idx][hOwner], RHS(idx));
- UpdateDynamic3DTextLabelText(HouseInfo[PlayerInfo[playerid][pVHouse]][hText], COLOR_WHITE, string);
- format(string, sizeof(string), "* %s takes out their house keys and unlocks it.", RPN(playerid));
- SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
- GameTextForPlayer(playerid, "~g~House Unlocked", 3500, 3);
- }
- else if(HouseInfo[PlayerInfo[playerid][pVHouse]][hStatus])
- {
- HouseInfo[PlayerInfo[playerid][pVHouse]][hStatus] = 0;
- format(string, sizeof(string), ""COE"["CWE"%d, House (Lvl: %d)"COE"]\n"COE"Owner"CWE" %s\n"COE"Status"CWE" %s", idx, HouseInfo[idx][hLevel], HouseInfo[idx][hOwner], RHS(idx));
- UpdateDynamic3DTextLabelText(HouseInfo[PlayerInfo[playerid][pVHouse]][hText], COLOR_WHITE, string);
- format(string, sizeof(string), "* %s takes out their house keys and locks it.", RPN(playerid));
- SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
- GameTextForPlayer(playerid, "~r~House Locked", 3500, 3);
- }
- lockdone = 1;
- return 1;
- }
- }
- return 1;
- if(!lockdone)
- {
- SendClientMessage(playerid, COLOR_GREY, "You are not near something you can lock/unlock.");
- }
- return 1;
- }
- CMD:sellhousetomarket(playerid, params[])
- {
- new string[128], done;
- if(!PlayerInfo[playerid][pHouse] && !PlayerInfo[playerid][pVHouse]) return SendClientMessage(playerid, COLOR_GREY, "You don't own a house.");
- if(sscanf(params, "s[8]", params)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /sellhousetomarket confirm");
- if(!strcmp(params, "confirm", true))
- {
- new idx = PlayerInfo[playerid][pHouse];
- if(IsPlayerInRangeOfPoint(playerid, 2, HouseInfo[PlayerInfo[playerid][pHouse]][hX], HouseInfo[PlayerInfo[playerid][pHouse]][hY], HouseInfo[PlayerInfo[playerid][pHouse]][hZ]))
- {
- GivePlayerMoney(playerid, (75*HouseInfo[PlayerInfo[playerid][pHouse]][hPrice])/100);
- HouseInfo[PlayerInfo[playerid][pHouse]][hStatus] = 0;
- format(HouseInfo[PlayerInfo[playerid][pHouse]][hOwner], 32, "The State");
- format(string, sizeof(string), ""COE"["CWE"%d, House (Lvl: %d)"COE"]\n"COE"Owner"CWE" %s\n"COE"Status"CWE" For Sale\n"CWE"$%d", idx, HouseInfo[idx][hLevel], HouseInfo[idx][hOwner], HouseInfo[idx][hPrice]);
- UpdateDynamic3DTextLabelText(HouseInfo[PlayerInfo[playerid][pHouse]][hText], COLOR_WHITE, string);
- PlayerInfo[playerid][pHouse] = 0;
- SendClientMessage(playerid, COLOR_GREEN, " You have successfully sold your house to The State. (75 percent of the original price was paid back)");
- format(string, sizeof(string), "%s has sold house id %d to the market.", RPN(playerid), idx);
- Log("logs/house.log", string);
- done = 1;
- }
- if(!done)
- {
- idx = PlayerInfo[playerid][pVHouse];
- if(IsPlayerInRangeOfPoint(playerid, 2, HouseInfo[idx][hX], HouseInfo[idx][hY], HouseInfo[idx][hZ]))
- {
- GivePlayerMoney(playerid, (75*HouseInfo[idx][hPrice])/100);
- HouseInfo[idx][hStatus] = 0;
- format(HouseInfo[idx][hOwner], 32, "The State");
- format(string, sizeof(string), ""COE"["CWE"%d, House (Lvl: %d)"COE"]\n"COE"Owner"CWE" %s\n"COE"Status"CWE" For Sale\n"CWE"$%d", idx, HouseInfo[idx][hLevel], HouseInfo[idx][hOwner], HouseInfo[idx][hPrice]);
- UpdateDynamic3DTextLabelText(HouseInfo[idx][hText], COLOR_WHITE, string);
- PlayerInfo[playerid][pVHouse] = 0;
- SendClientMessage(playerid, COLOR_GREEN, " You have successfully sold your house to The State. (75 percent of the original price was paid back)");
- format(string, sizeof(string), "%s has sold house id %d to the market.", RPN(playerid), idx);
- Log("logs/house.log", string);
- done = 1;
- }
- }
- if(!done)
- {
- SendClientMessage(playerid, COLOR_GREY, "You are not near your house.");
- return 1;
- }
- }
- return 1;
- }
- CMD:hdeposit(playerid, params[])
- {
- new string[128], option[32], amount;
- new idx = PlayerInfo[playerid][pHouse];
- if(!PlayerInfo[playerid][pHouse] && !PlayerInfo[playerid][pVHouse]) return SendClientMessage(playerid, COLOR_GREY, "You don't own a house.");
- if(GetPlayerVirtualWorld(playerid)-500 != idx && !PlayerInfo[playerid][pVHouse]) return SendClientMessage(playerid, COLOR_GREY, "You are not inside your house.");
- if(GetPlayerVirtualWorld(playerid)-500 != idx && PlayerInfo[playerid][pVHouse])
- {
- idx = PlayerInfo[playerid][pVHouse];
- if(GetPlayerVirtualWorld(playerid)-500 != idx) return SendClientMessage(playerid, COLOR_GREY, "You are not inside your house.");
- }
- if(sscanf(params, "s[32]", option))
- {
- SendClientMessage(playerid, COLOR_WHITE, "USAGE: /hdeposit [item]");
- SendClientMessage(playerid, COLOR_GREY, "ITEMS: money ");
- /* format(string, sizeof(string), "SAFE: $%d | %d Weed | %d Crack", HouseInfo[idx][hMoney], HouseInfo[idx][hWeed], HouseInfo[idx][hCrack]);
- SendClientMessage(playerid, COLOR_WHITE, string);
- format(string, sizeof(string), "SAFE: Weapon 1: %s (%d Ammo) | Weapon 2: %s (%d Ammo) | Weapon 3: %s (%d Ammo)", RWN(HouseInfo[idx][hGun][0]), HouseInfo[idx][hGunAmmo][0], RWN(HouseInfo[idx][hGun][1]), HouseInfo[idx][hGunAmmo][1], RWN(HouseInfo[idx][hGun][2]), HouseInfo[idx][hGunAmmo][2]);
- SendClientMessage(playerid, COLOR_WHITE, string);
- format(string, sizeof(string), "SAFE: Weapon 4: %s (%d Ammo) | Weapon 5: %s (%d Ammo)", RWN(HouseInfo[idx][hGun][3]), HouseInfo[idx][hGunAmmo][3], RWN(HouseInfo[idx][hGun][4]), HouseInfo[idx][hGunAmmo][4]);
- SendClientMessage(playerid, COLOR_WHITE, string);*/
- return 1;
- }
- if(sscanf(params, "s[32]", option))
- {
- SendClientMessage(playerid, COLOR_WHITE, "USAGE: /hdeposit [item]");
- SendClientMessage(playerid, COLOR_GREY, "ITEMS: money");
- return 1;
- }
- if(!strcmp(option, "money", true, 5))
- {
- if(sscanf(params, "s[32]i", option, amount)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /hsafe deposit money [amount]");
- if(GetPlayerMoney(playerid) < amount ) return SendClientMessage(playerid, COLOR_GREY, "Shoma in Andaze Pool Nadarid.");
- if(amount < 1) return SendClientMessage(playerid,COLOR_RED,"Money should be more than $1");
- HouseInfo[idx][hMoney] += amount;
- GivePlayerMoney(playerid, -amount);
- format(string, sizeof(string), "* %s opens their vault, puts $%d inside and closes it.", RPN(playerid), amount);
- SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
- }
- return 1;
- }
- CMD:hwithdraw(playerid, params[])
- {
- new string[128], option[32], amount;
- new idx = PlayerInfo[playerid][pHouse];
- if(!PlayerInfo[playerid][pHouse] && !PlayerInfo[playerid][pVHouse]) return SendClientMessage(playerid, COLOR_GREY, "You don't own a house.");
- if(GetPlayerVirtualWorld(playerid)-500 != idx && !PlayerInfo[playerid][pVHouse]) return SendClientMessage(playerid, COLOR_GREY, "You are not inside your house.");
- if(GetPlayerVirtualWorld(playerid)-500 != idx && PlayerInfo[playerid][pVHouse])
- {
- idx = PlayerInfo[playerid][pVHouse];
- if(GetPlayerVirtualWorld(playerid)-500 != idx) return SendClientMessage(playerid, COLOR_GREY, "You are not inside your house.");
- }
- if(sscanf(params, "s[32]", option))
- {
- SendClientMessage(playerid, COLOR_WHITE, "USAGE: /hsafe withdraw [item]");
- SendClientMessage(playerid, COLOR_GREY, "ITEMS: money");
- /*format(string, sizeof(string), "SAFE: $%d | %d Weed | %d Crack", HouseInfo[idx][hMoney], HouseInfo[idx][hWeed], HouseInfo[idx][hCrack]);
- SendClientMessage(playerid, COLOR_WHITE, string);
- format(string, sizeof(string), "SAFE: Weapon 1: %s (%d Ammo) | Weapon 2: %s (%d Ammo) | Weapon 3: %s (%d Ammo)", RWN(HouseInfo[idx][hGun][0]), HouseInfo[idx][hGunAmmo][0], RWN(HouseInfo[idx][hGun][1]), HouseInfo[idx][hGunAmmo][1], RWN(HouseInfo[idx][hGun][2]), HouseInfo[idx][hGunAmmo][2]);
- SendClientMessage(playerid, COLOR_WHITE, string);
- format(string, sizeof(string), "SAFE: Weapon 4: %s (%d Ammo) | Weapon 5: %s (%d Ammo)", RWN(HouseInfo[idx][hGun][3]), HouseInfo[idx][hGunAmmo][3], RWN(HouseInfo[idx][hGun][4]), HouseInfo[idx][hGunAmmo][4]);
- SendClientMessage(playerid, COLOR_WHITE, string);*/
- return 1;
- }
- if(!strcmp(option, "money", true, 5))
- {
- if(sscanf(params, "s[32]i", option, amount)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /hsafe withdraw money [amount]");
- if(HouseInfo[idx][hMoney] < amount) return SendClientMessage(playerid, COLOR_GREY, "You don't have that much money in your house vault.");
- HouseInfo[idx][hMoney] -= amount;
- GivePlayerMoney(playerid, amount);
- format(string, sizeof(string), "* %s opens their vault, takes $%d and closes it.", RPN(playerid), amount);
- SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
- }
- return 1;
- }
- CMD:Househelp(playerid, params[])
- {
- SendClientMessage(playerid, COLOR_ORANGE, ""COE"---------------------["CWE" HouseHelp "COE"]---------------------");
- SendClientMessage(playerid, COLOR_YELLOW, "[HOUSE]: {FFFFFF}/buyhouse /hdeposit /hwithdraw /hlock /houseupgrade /sellhousetomarket /heal");
- return 1;
- }
- CMD:heal(playerid, params[])
- {
- if(!IsAtHouse(playerid)) return SendClientMessage(playerid, COLOR_GREY, " Shoma Nistid Dar House");
- if(GetPlayerMoney(playerid) < 100) return SendClientMessage(playerid, COLOR_GREY, "You Dont Have This Much cash. ($100)");
- ShowPlayerDialog(playerid,829,DIALOG_STYLE_MSGBOX,"Health & Armor","================================\nThis will cost 100$\n\nType: Health & Armour Recovery","Pay","Enseraf");
- return 1;
- }
- CMD:enter(playerid,params[])
- {
- new string[128];
- for(new idx=1; idx<MAX_HOUSES; idx++) // Dynamic Houses
- {
- if(IsPlayerInRangeOfPoint(playerid, 2, HouseInfo[idx][hX], HouseInfo[idx][hY], HouseInfo[idx][hZ]))
- {
- if(!HouseInfo[idx][hStatus] && PlayerInfo[playerid][pHouse] != idx && PlayerInfo[playerid][pVHouse] != idx) return SendClientMessage(playerid, COLOR_GREY, "This house is locked.");
- format(string, sizeof(string), "* %s pushes the door and enters the house.", RPN(playerid));
- if(PlayerInfo[playerid][pMaskOn] == 1)
- {
- format(string, sizeof(string), "* Stranger pushes the door and enters the house.");
- }
- else
- {
- format(string, sizeof(string), "* %s pushes the door and enters the house.", RPN(playerid));
- }
- SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
- SetPlayerVirtualWorld(playerid, idx+500);
- if(HouseInfo[idx][hLevel] == 1)
- {
- SetPlayerPos(playerid, 243.9951,304.9418,999.1484);
- SetPlayerFacingAngle(playerid, 267.0980);
- SetCameraBehindPlayer(playerid);
- SetPlayerInterior(playerid, 1);
- }
- else if(HouseInfo[idx][hLevel] == 2)
- {
- SetPlayerPos(playerid, 2259.6702,-1135.8542,1050.6328);
- SetPlayerFacingAngle(playerid, 267.3974);
- SetCameraBehindPlayer(playerid);
- SetPlayerInterior(playerid, 10);
- }
- else if(HouseInfo[idx][hLevel] == 3)
- {
- SetPlayerPos(playerid, 2308.8254,-1212.8070,1049.0234);
- SetPlayerFacingAngle(playerid, 359.8550);
- SetCameraBehindPlayer(playerid);
- SetPlayerInterior(playerid, 6);
- }
- else if(HouseInfo[idx][hLevel] == 4)
- {
- SetPlayerPos(playerid, 260.7436,1237.5563,1084.2578);
- SetPlayerFacingAngle(playerid, 1.6415);
- SetCameraBehindPlayer(playerid);
- SetPlayerInterior(playerid, 9);
- }
- else if(HouseInfo[idx][hLevel] == 5)
- {
- SetPlayerPos(playerid, -42.5742,1405.6521,1084.4297);
- SetPlayerFacingAngle(playerid, 359.1347);
- SetCameraBehindPlayer(playerid);
- SetPlayerInterior(playerid, 8);
- }
- else if(HouseInfo[idx][hLevel] == 6)
- {
- SetPlayerPos(playerid, 2468.6787,-1698.2617,1013.5078);
- SetPlayerFacingAngle(playerid, 89.1791);
- SetCameraBehindPlayer(playerid);
- SetPlayerInterior(playerid, 2);
- }
- else if(HouseInfo[idx][hLevel] == 7)
- {
- SetPlayerPos(playerid, 2365.2183,-1135.4014,1050.8750);
- SetPlayerFacingAngle(playerid, 359.8550);
- SetCameraBehindPlayer(playerid);
- SetPlayerInterior(playerid, 8);
- }
- else if(HouseInfo[idx][hLevel] == 8)
- {
- SetPlayerPos(playerid, 2270.1270,-1210.4855,1047.5625);
- SetPlayerFacingAngle(playerid, 89.4224);
- SetCameraBehindPlayer(playerid);
- SetPlayerInterior(playerid, 10);
- }
- else if(HouseInfo[idx][hLevel] == 9)
- {
- SetPlayerPos(playerid, 2324.4424,-1149.2057,1050.7101);
- SetPlayerFacingAngle(playerid, 0.7248);
- SetCameraBehindPlayer(playerid);
- SetPlayerInterior(playerid, 12);
- }
- else if(HouseInfo[idx][hLevel] == 10)
- {
- SetPlayerPos(playerid, 83.0863,1322.3020,1083.8662);
- SetPlayerFacingAngle(playerid, 359.5183);
- SetCameraBehindPlayer(playerid);
- SetPlayerInterior(playerid, 9);
- }
- else if(HouseInfo[idx][hLevel] == 11)
- {
- SetPlayerPos(playerid, 225.6631,1022.3559,1084.0150);
- SetPlayerFacingAngle(playerid, 359.5183);
- SetCameraBehindPlayer(playerid);
- SetPlayerInterior(playerid, 7);
- }
- }
- }
- return 1;
- }
- CMD:houseupgrade(playerid, params[])
- {
- new string[128], idx = PlayerInfo[playerid][pHouse], price;
- if(!PlayerInfo[playerid][pHouse]) return SendClientMessage(playerid, COLOR_GREY, "You don't own a house.");
- if(!PlayerInfo[playerid][pVHouse])
- {
- if(!IsPlayerInRangeOfPoint(playerid, 2, HouseInfo[idx][hX], HouseInfo[idx][hY], HouseInfo[idx][hZ])) return SendClientMessage(playerid, COLOR_GREY, "You are not near your house.");
- }
- else
- {
- new done;
- if(!IsPlayerInRangeOfPoint(playerid, 2, HouseInfo[idx][hX], HouseInfo[idx][hY], HouseInfo[idx][hZ]))
- {
- done ++;
- idx = PlayerInfo[playerid][pVHouse];
- if(!IsPlayerInRangeOfPoint(playerid, 2, HouseInfo[idx][hX], HouseInfo[idx][hY], HouseInfo[idx][hZ])) done ++;
- }
- if(done == 2) return SendClientMessage(playerid, COLOR_GREY, "You are not near your house.");
- }
- if(sscanf(params, "s[8]", params)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /houseupgrade confirm");
- if(HouseInfo[idx][hLevel] >= 11) return SendClientMessage(playerid, COLOR_GREY, "Your house already has the maximum level possible.");
- if(!strcmp(params, "confirm", true))
- {
- price = 500000;
- if(GetPlayerMoney(playerid) < price)
- {
- format(string, sizeof(string), "You need $%d to upgrade your house.", price);
- SendClientMessage(playerid, COLOR_GREY, string);
- return 1;
- }
- HouseInfo[idx][hLevel] ++;
- GivePlayerMoney(playerid, -price);
- format(string, sizeof(string), " You have upgraded your house to level %d.", HouseInfo[idx][hLevel]);
- SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
- format(string, sizeof(string), ""COE"["CWE"%d, House (Lvl: %d)"COE"]\n"COE"Owner"CWE" %s\n"COE"Status"CWE" %s", idx, HouseInfo[idx][hLevel], HouseInfo[idx][hOwner], RHS(idx));
- UpdateDynamic3DTextLabelText(HouseInfo[idx][hText], COLOR_WHITE, string);
- }
- return 1;
- }
- CMD:savehouses(playerid, params[])
- {
- if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You are not rcon admin.");
- SaveHouses();
- new string[128];
- format(string, sizeof(string), "{FF0000}[Manual Save]{FF6347} houses are saved");
- SendClientMessageToAll(COLOR_LIGHTRED, string);
- return 1;
- }
- /*new playername[MAX_PLAYER_NAME];
- CMD:makerentable(playerid,params[])
- {
- new tmp[256];
- new string[256];
- new idx;
- if(IsPlayerConnected(playerid))
- {
- new bouse = PlayerInfo[playerid][pPhousekey];
- GetPlayerName(playerid, playername, sizeof(playername));
- if (bouse != 255 && strcmp(playername, HouseInfo[PlayerInfo[playerid][pPhousekey]][hOwner], true) == 0)
- {
- tmp = strtok(params, idx);
- if(!strlen(tmp))
- {
- SendClientMessage(playerid, COLOR_WHITE, "USAGE: /setrentable [0/1]");
- }
- HouseInfo[bouse][hRentabil] = strval(tmp);
- SaveHouses();
- format(string, sizeof(string), "House rentable set to %d.", HouseInfo[bouse][hRentabil]);
- SendClientMessage(playerid, COLOR_WHITE, string);
- return 1;
- }
- else
- {
- SendClientMessage(playerid, COLOR_WHITE, " You don't own a house !");
- return 1;
- }
- }
- return 1;
- }
- CMD:setrent(playerid,params[])
- {
- new tmp[256];
- new string[256];
- new idx;
- if(IsPlayerConnected(playerid))
- {
- new bouse = PlayerInfo[playerid][pPhousekey];
- GetPlayerName(playerid, playername, sizeof(playername));
- if (bouse != 255 && strcmp(playername, HouseInfo[PlayerInfo[playerid][pPhousekey]][hOwner], true) == 0)
- {
- tmp = strtok(params, idx);
- if(!strlen(tmp))
- {
- SendClientMessage(playerid, COLOR_WHITE, "USAGE: /setrent [RentFee]");
- return 1;
- }
- if(strval(tmp) < 1 || strval(tmp) > 9999)
- {
- SendClientMessage(playerid, COLOR_WHITE, "Minimum rent is $1, Maximum rent is $9999.");
- return 1;
- }
- HouseInfo[bouse][hRent] = strval(tmp);
- SaveHouses();
- format(string, sizeof(string), "House rent set to $%s", FormatNumber(HouseInfo[bouse][hRent]));
- SendClientMessage(playerid, COLOR_WHITE, string);
- return 1;
- }
- else
- {
- SendClientMessage(playerid, COLOR_WHITE, " You don't own a house");
- return 1;
- }
- }
- return 1;
- }
- CMD:renthouse(playerid,params[])
- {
- if(IsPlayerConnected(playerid))
- {
- new Float:oldposx, Float:oldposy, Float:oldposz;
- GetPlayerName(playerid, playername, sizeof(playername));
- GetPlayerPos(playerid, oldposx, oldposy, oldposz);
- for(new h = 0; h < sizeof(HouseInfo); h++)
- {
- if(PlayerToPoint(2.0, playerid, HouseInfo[h][hX], HouseInfo[h][hY], HouseInfo[h][hZ]) && HouseInfo[h][hOwned] == 1 && HouseInfo[h][hRentabil] == 1)
- {
- if(HouseInfo[h][hInsurance] == 1)
- {
- SCM(playerid, COLOR_CRS2, "** This house has no insurance and you can not rent a room.");
- return 1;
- }
- if(PlayerInfo[playerid][pPhousekey] != 255 && strcmp(playername, HouseInfo[PlayerInfo[playerid][pPhousekey]][hOwner], true) == 0)
- {
- SendClientMessage(playerid, COLOR_WHITE, "** You already own a house, type /sellhouse if you want to rent this one.");
- return 1;
- }
- if(GetPlayerMoney(playerid) > HouseInfo[h][hRent])
- {
- PlayerInfo[playerid][pPhousekey] = h;
- PlayerInfo[playerid][pRented] = h;
- PlayerInfo[playerid][pRented] = 1;
- SafeGivePlayerMoney(playerid,-HouseInfo[h][hRent]);
- HouseInfo[h][hTakings] = HouseInfo[h][hTakings]+HouseInfo[h][hRent];
- // SetPlayerInterior(playerid,HouseInfo[h][hInt]);
- // SetPlayerVirtualWorld(playerid,HouseInfo[h][hWorld]);
- // PlayerInfo[playerid][pVirWorld] = HouseInfo[h][hWorld];
- // SetPlayerMapIcon(playerid,h + 20,HouseInfo[h][hEntrancex],HouseInfo[h][hEntrancey],HouseInfo[h][hEntrancez],31,COLOR_LIGHTRED);
- SetPlayerPos(playerid,HouseInfo[h][hX],HouseInfo[h][hY],HouseInfo[h][hZ]);
- GameTextForPlayer(playerid, "~w~Welcome Home~n~You can exit at any time by moving to this door and press enter", 5000, 3);
- PlayerInfo[playerid][pInt] = HouseInfo[h][hInt];
- PlayerInfo[playerid][pLocal] = h;
- SendClientMessage(playerid, COLOR_WHITE, "** Congratulations, You can enter and exit here anytime.");
- SendClientMessage(playerid, COLOR_WHITE, "** Type /help to review the new property help section.");
- OnPlayerUpdate(playerid);
- return 1;
- }
- else
- {
- SendClientMessage(playerid, COLOR_WHITE, "You don't have the cash for that");
- return 1;
- }
- }
- }
- }
- return 1;
- }
- */
- /*forward PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z);
- public PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z)
- {
- if(IsPlayerConnected(playerid))
- {
- new Float:oldposx, Float:oldposy, Float:oldposz;
- new Float:tempposx, Float:tempposy, Float:tempposz;
- GetPlayerPos(playerid, oldposx, oldposy, oldposz);
- tempposx = (oldposx -x);
- tempposy = (oldposy -y);
- tempposz = (oldposz -z);
- //printf("DEBUG: X:%f Y:%f Z:%f",posx,posy,posz);
- if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
- {
- return 1;
- }
- }
- return 0;
- }
- FormatNumber(number)
- {
- new Str[15];
- format(Str, 15, "%d", number);
- if (strlen(Str) < sizeof(Str))
- {
- if (number >= 1000 && number < 10000)
- strins( Str, ",", 1, sizeof(Str));
- else if (number >= 10000 && number < 100000)
- strins(Str, ",", 2, sizeof(Str));
- else if (number >= 100000 && number < 1000000)
- strins(Str, ",", 3, sizeof(Str));
- else if (number >= 1000000 && number < 10000000)
- strins(Str, ",", 1, sizeof(Str)),strins(Str, ",", 5, sizeof(Str));
- else if (number >= 10000000 && number < 100000000)
- strins(Str, ",", 2, sizeof(Str)),strins(Str, ",", 6, sizeof(Str));
- else if (number >= 100000000 && number < 1000000000)
- strins(Str, ",", 3, sizeof(Str)),strins(Str, ",", 7, sizeof(Str));
- else if (number >= 1000000000 && number < 10000000000)
- strins(Str, ",", 1, sizeof(Str)),
- strins(Str, ",", 5, sizeof(Str)),
- strins(Str, ",", 9, sizeof(Str));
- else format(Str, 10, "%d", number);
- }
- else format( Str, 15, "<BUG>" );
- return Str;
- }
- strtok(const string[], &index)
- {
- new length = strlen(string);
- while ((index < length) && (string[index] <= ' '))
- {
- index++;
- }
- new offset = index;
- new result[20];
- while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
- {
- result[index - offset] = string[index];
- index++;
- }
- result[index - offset] = EOS;
- return result;
- }*/
- stock split(const strsrc[], strdest[][], delimiter)
- {
- new i, li;
- new aNum;
- new len;
- while(i <= strlen(strsrc))
- {
- if(strsrc[i] == delimiter || i == strlen(strsrc))
- {
- len = strmid(strdest[aNum], strsrc, li, i, 128);
- strdest[aNum][len] = 0;
- li = i+1;
- aNum++;
- }
- i++;
- }
- return 1;
- }
- stock IsPlayerLoggedIn(playerid)
- {
- if(IsPlayerConnected(playerid))
- {
- if(PlayerInfo[playerid][pLoggedIn])
- {
- return 1;
- }
- }
- return 0;
- }
- stock RPN(playerid)
- {
- new string[25];
- if(PlayerInfo[playerid][pMaskOn] == 0)format(string, sizeof(string), "%s");
- // else if(PlayerInfo[playerid][pMaskOn] == 1)format(string, sizeof(string), "Stranger");
- return string;
- }
- stock Log(sz_fileName[], sz_input[]) {
- new sz_logEntry[156], i_dateTime[2][3], File: fileHandle = fopen(sz_fileName, io_append);
- gettime(i_dateTime[0][0], i_dateTime[0][1], i_dateTime[0][2]);
- getdate(i_dateTime[1][0], i_dateTime[1][1], i_dateTime[1][2]);
- format(sz_logEntry, sizeof(sz_logEntry), "[%i/%i/%i - %i:%i:%i] %s\r\n", i_dateTime[1][0], i_dateTime[1][1], i_dateTime[1][2], i_dateTime[0][0], i_dateTime[0][1], i_dateTime[0][2], sz_input);
- fwrite(fileHandle, sz_logEntry);
- return fclose(fileHandle);
- }
- stock RHS(bizid)
- {
- new string[16];
- if(!HouseInfo[bizid][hStatus]) format(string, sizeof(string), "Closed");
- else if(HouseInfo[bizid][hStatus]) format(string, sizeof(string), "Open");
- return string;
- }
- stock RPNU(playerid)
- {
- new name[MAX_PLAYER_NAME];
- GetPlayerName(playerid, name, sizeof(name));
- return name;
- }
- stock SendNearbyMessage(playerid, Float:radius, string[], col1, col2, col3, col4, col5)
- {
- new Float:x, Float:y, Float:z;
- GetPlayerPos(playerid, x, y, z);
- new Float:ix, Float:iy, Float:iz;
- new Float:cx, Float:cy, Float:cz;
- foreach(Player, i)
- {
- if(IsPlayerLoggedIn(i))
- {
- if(GetPlayerInterior(playerid) == GetPlayerInterior(i) && GetPlayerVirtualWorld(playerid) == GetPlayerVirtualWorld(i))
- {
- GetPlayerPos(i, ix, iy, iz);
- cx = (x - ix);
- cy = (y - iy);
- cz = (z - iz);
- if(((cx < radius/16) && (cx > -radius/16)) && ((cy < radius/16) && (cy > -radius/16)) && ((cz < radius/16) && (cz > -radius/16)))
- {
- SendClientMessage(i, col1, string);
- }
- else if(((cx < radius/8) && (cx > -radius/8)) && ((cy < radius/8) && (cy > -radius/8)) && ((cz < radius/8) && (cz > -radius/8)))
- {
- SendClientMessage(i, col2, string);
- }
- else if(((cx < radius/4) && (cx > -radius/4)) && ((cy < radius/4) && (cy > -radius/4)) && ((cz < radius/4) && (cz > -radius/4)))
- {
- SendClientMessage(i, col3, string);
- }
- else if(((cx < radius/2) && (cx > -radius/2)) && ((cy < radius/2) && (cy > -radius/2)) && ((cz < radius/2) && (cz > -radius/2)))
- {
- SendClientMessage(i, col4, string);
- }
- else if(((cx < radius) && (cx > -radius)) && ((cy < radius) && (cy > -radius)) && ((cz < radius) && (cz > -radius)))
- {
- SendClientMessage(i, col5, string);
- }
- }
- }
- }
- return 1;
- }
- IsAtHouse(playerid)
- {
- if(IsPlayerConnected(playerid))
- {
- if(IsPlayerInRangeOfPoint(playerid, 20.0, 243.9951, 304.9418, 999.1484)) // House 1
- {
- return 1;
- }
- else if(IsPlayerInRangeOfPoint(playerid, 20.0, 2259.6702, -1135.8542, 1050.6328)) // House 2
- {
- return 1;
- }
- else if(IsPlayerInRangeOfPoint(playerid, 20.0, 2308.8254, -1212.8070, 1049.0234)) // House 3
- {
- return 1;
- }
- else if(IsPlayerInRangeOfPoint(playerid, 20.0, 260.7436, 1237.5563, 1084.2578)) // House 4
- {
- return 1;
- }
- else if(IsPlayerInRangeOfPoint(playerid, 20.0, -42.5742, 1405.6521, 1084.4297)) // House 5
- {
- return 1;
- }
- else if(IsPlayerInRangeOfPoint(playerid, 20.0, 2468.6787, -1698.2617, 1013.5078)) // House 6
- {
- return 1;
- }
- else if(IsPlayerInRangeOfPoint(playerid, 20.0, 2365.2183, -1135.4014, 1050.8750)) // House 7
- {
- return 1;
- }
- else if(IsPlayerInRangeOfPoint(playerid, 20.0, 2270.1270, -1210.4855, 1047.5625)) // House 8
- {
- return 1;
- }
- else if(IsPlayerInRangeOfPoint(playerid, 20.0, 2324.4424, -1149.2057, 1050.7101)) // House 9
- {
- return 1;
- }
- else if(IsPlayerInRangeOfPoint(playerid, 20.0, 83.0863, 1322.3020, 1083.8662)) // House 10
- {
- return 1;
- }
- else if(IsPlayerInRangeOfPoint(playerid, 30.0, 225.6631,1022.3559,1084.0150)) // House 11
- {
- return 1;
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement