Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #include <sscanf2>
- #include <mSelection>
- #include <YSI\y_ini>
- #include <zcmd>
- native WP_Hash(buffer[], len, const str[]);
- #define MAX_FACTIONS 10
- #define MAX_HOUSES 100
- #define MAX_BIZZES 100
- #define MAX_LABELS 1000
- #define dialog_Register 1
- #define dialog_Login 2
- #define dialog_DealershipConfirm 3
- #define dialog_Buy 4
- #define mselection_Dealership 10
- main()
- {
- print("\n=-=-=-=-=-=-=-=-=-=-=-=-=");
- print("=-= Loading systems =-=");
- print("=-=-=-=-=-=-=-=-=-=-=-=-=\n");
- LoadFactions();
- LoadVehicles();
- LoadBizzes();
- LoadHouses();
- LoadLabels();
- print("\n=-=-=-=-=-=-=-=-=-=-=-=-=");
- print("=-= Loading finished! =-=");
- print("=-=-=-=-=-=-=-=-=-=-=-=-=\n");
- }
- enum PlayerInfo
- {
- Pass[129],
- Admin,
- Helper,
- Level,
- Exp,
- ExpLeft,
- FactionID,
- FactionTier,
- FactionRank[24],
- HouseOwner,
- CarOwner,
- BizOwner,
- Weapon1,
- Weapon1Ammo,
- Weapon2,
- Weapon2Ammo,
- Weapon3,
- Weapon3Ammo,
- HandMoney,
- BankMoney,
- Phone,
- PhoneNumber,
- Mask,
- MaskNumber,
- SkinID,
- }
- enum VehicleInfo
- {
- ID,
- Type, // 0 = playerowned, 1 = faction, 2 = rent car
- Owner[MAX_PLAYER_NAME],
- Model,
- Float: xPos,
- Float: yPos,
- Float: zPos,
- Float: aPos,
- ColorA,
- ColorB,
- Faction,
- Plate,
- Price,
- Fuel,
- StoredSlot1,
- StoredSlot1Ammo,
- StoredSlot2,
- StoredSlot2Ammo,
- }
- enum HouseInfo
- {
- ID,
- Owner[MAX_PLAYER_NAME],
- Price,
- Bought,
- Float: ExtX,
- Float: ExtY,
- Float: ExtZ,
- Float: IntX,
- Float: IntY,
- Float: IntZ,
- IntInterior,
- IntVirtualW,
- World,
- Interior,
- Locked,
- Initialised,
- Text3D: Label
- }
- enum LabelInfo
- {
- ID,
- Type,
- Text[40],
- Float: xPos,
- Float: yPos,
- Float: zPos,
- Float: Radius,
- VirtualWorld,
- }
- enum BusinessInfo
- {
- ID,
- Name[40],
- Owner[MAX_PLAYER_NAME],
- Price,
- Bought,
- Float: ExtX,
- Float: ExtY,
- Float: ExtZ,
- Float: IntX,
- Float: IntY,
- Float: IntZ,
- IntInterior,
- IntVirtualW,
- World,
- Interior,
- Locked,
- Initialised,
- Text3D: Label
- }
- enum FactionInfo
- {
- ID,
- Name[40],
- Type // 0 = general, 1 = radio access (lspd/lsfd?)
- }
- new VehicleNames[][] =
- {
- "Landstalker", "Bravura", "Buffalo", "Linerunner", "Perrenial", "Sentinel",
- "Dumper", "Firetruck", "Trashmaster", "Stretch", "Manana", "Infernus",
- "Voodoo", "Pony", "Mule", "Cheetah", "Ambulance", "Leviathan", "Moonbeam",
- "Esperanto", "Taxi", "Washington", "Bobcat", "Whoopee", "BF Injection",
- "Hunter", "Premier", "Enforcer", "Securicar", "Banshee", "Predator", "Bus",
- "Rhino", "Barracks", "Hotknife", "Trailer", "Previon", "Coach", "Cabbie",
- "Stallion", "Rumpo", "RC Bandit", "Romero", "Packer", "Monster", "Admiral",
- "Squalo", "Seasparrow", "Pizzaboy", "Tram", "Trailer", "Turismo", "Speeder",
- "Reefer", "Tropic", "Flatbed", "Yankee", "Caddy", "Solair", "Berkley's RC Van",
- "Skimmer", "PCJ-600", "Faggio", "Freeway", "RC Baron", "RC Raider", "Glendale",
- "Oceanic","Sanchez", "Sparrow", "Patriot", "Quad", "Coastguard", "Dinghy",
- "Hermes", "Sabre", "Rustler", "ZR-350", "Walton", "Regina", "Comet", "BMX",
- "Burrito", "Camper", "Marquis", "Baggage", "Dozer", "Maverick", "News Chopper",
- "Rancher", "FBI Rancher", "Virgo", "Greenwood", "Jetmax", "Hotring", "Sandking",
- "Blista Compact", "Police Maverick", "Boxville", "Benson", "Mesa", "RC Goblin",
- "Hotring Racer A", "Hotring Racer B", "Bloodring Banger", "Rancher", "Super GT",
- "Elegant", "Journey", "Bike", "Mountain Bike", "Beagle", "Cropduster", "Stunt",
- "Tanker", "Roadtrain", "Nebula", "Majestic", "Buccaneer", "Shamal", "Hydra",
- "FCR-900", "NRG-500", "HPV1000", "Cement Truck", "Tow Truck", "Fortune",
- "Cadrona", "FBI Truck", "Willard", "Forklift", "Tractor", "Combine", "Feltzer",
- "Remington", "Slamvan", "Blade", "Freight", "Streak", "Vortex", "Vincent",
- "Bullet", "Clover", "Sadler", "Firetruck", "Hustler", "Intruder", "Primo",
- "Cargobob", "Tampa", "Sunrise", "Merit", "Utility", "Nevada", "Yosemite",
- "Windsor", "Monster", "Monster", "Uranus", "Jester", "Sultan", "Stratium",
- "Elegy", "Raindance", "RC Tiger", "Flash", "Tahoma", "Savanna", "Bandito",
- "Freight Flat", "Streak Carriage", "Kart", "Mower", "Dune", "Sweeper",
- "Broadway", "Tornado", "AT-400", "DFT-30", "Huntley", "Stafford", "BF-400",
- "News Van", "Tug", "Trailer", "Emperor", "Wayfarer", "Euros", "Hotdog", "Club",
- "Freight Box", "Trailer", "Andromada", "Dodo", "RC Cam", "Launch", "Police Car",
- "Police Car", "Police Car", "Police Ranger", "Picador", "S.W.A.T", "Alpha",
- "Phoenix", "Glendale", "Sadler", "Luggage", "Luggage", "Stairs", "Boxville",
- "Tiller", "Utility Trailer"
- };
- new PriceArray[][] =
- {
- {475, 30000},
- {542, 30000},
- {575, 30000},
- {518, 30000},
- {535, 45000},
- {536, 45000},
- {540, 45000},
- {507, 45000},
- {546, 45000},
- {547, 45000},
- {551, 45000},
- {585, 45000},
- {405, 45000},
- {412, 45000},
- {496, 45000},
- {458, 45000},
- {404, 45000},
- {589, 45000},
- {421, 50000},
- {426, 50000},
- {580, 50000},
- {533, 50000},
- {567, 50000},
- {576, 50000},
- {566, 50000},
- {517, 50000},
- {600, 50000},
- {489, 60000},
- {579, 60000},
- {400, 60000},
- {579, 60000},
- {402, 75000},
- {562, 75000},
- {565, 75000},
- {560, 75000},
- {559, 75000}
- };
- // Enumerator Variables:
- new pInfo[MAX_PLAYERS][PlayerInfo];
- new fInfo[MAX_FACTIONS][FactionInfo];
- new vInfo[MAX_VEHICLES][VehicleInfo];
- new bInfo[MAX_BIZZES][BusinessInfo];
- new hInfo[MAX_HOUSES][HouseInfo];
- new lInfo[MAX_LABELS][LabelInfo];
- // Multiplication Variables
- new bCount;
- new fCount;
- new vCount = 1;
- new hCount;
- new lCount;
- // Phone Variables
- new bool: pOnCall[MAX_PLAYERS];
- new bool: pIsCalled[MAX_PLAYERS];
- new pCalling[MAX_PLAYERS];
- new pPhoneStatus[MAX_PLAYERS] = true;
- // Alternate Variables
- new bool: fChat[MAX_FACTIONS] = true;
- new bool: Logged[MAX_PLAYERS];
- new bool: pMasked[MAX_PLAYERS];
- new pOldBalance[MAX_PLAYERS];
- new Text3D: Holder[MAX_LABELS];
- new WorldTime; // time handler
- new skinlist = mS_INVALID_LISTID;
- // Deathmode Variables
- new bool: pDeath[MAX_PLAYERS];
- new pDeathTimer[MAX_PLAYERS];
- new pDeathTimerTick[MAX_PLAYERS];
- // Vehicle Variables:
- new bool: vEngine[MAX_VEHICLES];
- new bool: vLocked[MAX_VEHICLES];
- new bool: vHood[MAX_VEHICLES];
- new bool: vTrunk[MAX_VEHICLES];
- // Fuel System:
- new FuelTimer[MAX_VEHICLES];
- new FillingTimer[MAX_PLAYERS];
- // Dealership Variables
- new pBuyingCar[MAX_PLAYERS];
- new pBuyingCarModel[MAX_PLAYERS];
- new Float: pDlOldPos[MAX_PLAYERS][3];
- // Textdraws
- new PlayerText: vSpeedTD[MAX_PLAYERS];
- new PlayerText: vSpeedTDText[MAX_PLAYERS];
- new PlayerText: vFuelTD[MAX_PLAYERS];
- new PlayerText: vFuelTDText[MAX_PLAYERS];
- public OnGameModeInit()
- {
- SetGameModeText("Basic Roleplay");
- SendRconCommand("mapname Los Santos");
- skinlist = LoadModelSelectionMenu("skins.txt");
- SetWeather(3); // inb4 weatherhandler
- SetWorldTime(random(23));
- SetTimer("TimeHandler", 3600000, true); // 1 hour
- DisableInteriorEnterExits();
- ShowPlayerMarkers(PLAYER_MARKERS_MODE_OFF);
- EnableStuntBonusForAll(false);
- DisableNameTagLOS();
- return true;
- }
- public OnGameModeExit()
- {
- SaveFactions();
- SaveVehicles();
- SaveHouses();
- SaveLabels();
- SaveBizzes();
- return true;
- }
- public OnPlayerConnect(playerid)
- {
- new name[MAX_PLAYER_NAME];
- GetPlayerName(playerid, name, sizeof(name));
- LoadVehicleSpeedoTextdraws(playerid);
- TogglePlayerSpectating(playerid, true);
- if(fexist(Path(playerid)))
- {
- INI_ParseFile(Path(playerid), "loadaccount_%s", .bExtra = true, .extra = playerid);
- ShowPlayerDialog(playerid, dialog_Login, DIALOG_STYLE_PASSWORD, "Authenticate", "Please enter a password below in order to log in.", "Login", "Quit");
- }
- else return ShowPlayerDialog(playerid, dialog_Register, DIALOG_STYLE_INPUT, "Authenticate", "Please enter a password below in order to register.", "Register", "Quit");
- return true;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- SetPlayerColor(playerid, 0xA3A3A3FF);
- PlayerTextDrawDestroy(playerid, vSpeedTD[playerid]);
- PlayerTextDrawDestroy(playerid, vSpeedTDText[playerid]);
- PlayerTextDrawDestroy(playerid, vFuelTD[playerid]);
- PlayerTextDrawDestroy(playerid, vFuelTDText[playerid]);
- if(Logged[playerid]) return SavePlayer(playerid);
- return true;
- }
- public OnPlayerRequestClass(playerid, classid) return SpawnPlayer(playerid);
- public OnPlayerRequestSpawn(playerid) return SpawnPlayer(playerid);
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
- {
- new hashpass[129], sHolder[MAX_PLAYER_NAME];
- if(dialogid == dialog_Register)
- {
- if(!response) return Kick(playerid);
- if(response)
- {
- if(!strlen(inputtext)) return ShowPlayerDialog(playerid, dialog_Register, DIALOG_STYLE_INPUT, "Authenticate", "Please enter a password below in order to register.", "Register", "Quit");
- WP_Hash(hashpass, sizeof(hashpass), inputtext);
- pInfo[playerid][Pass] = hashpass;
- pInfo[playerid][HouseOwner] = 999;
- pInfo[playerid][BizOwner] = 999;
- pInfo[playerid][CarOwner] = 999;
- pInfo[playerid][MaskNumber] = random(1000 + 2500);
- pInfo[playerid][PhoneNumber] = random(1000 + 2500);
- pInfo[playerid][ExpLeft] = 8;
- pInfo[playerid][Level] = 1;
- format(sHolder, sizeof(sHolder), "None");
- pInfo[playerid][FactionRank] = sHolder;
- SavePlayer(playerid);
- TogglePlayerSpectating(playerid, false);
- SetSpawnInfo(playerid, 0, 299, 1740.6188, -1949.9669, 14.1172, 176.0951, 0, 0, 0, 0, 0, 0);
- SetTimerEx("LevelTimer", 1800000, true, "i", playerid);
- SpawnPlayer(playerid);
- Logged[playerid] = true;
- ShowModelSelectionMenu(playerid, skinlist, "Select Skin");
- return true;
- }
- }
- if(dialogid == dialog_Login)
- {
- if(!response) return Kick(playerid);
- if(response)
- {
- WP_Hash(hashpass, sizeof(hashpass), inputtext);
- if(!strcmp(hashpass, pInfo[playerid][Pass], false))
- {
- INI_ParseFile(Path(playerid), "loadaccount_%s", .bExtra = true, .extra = playerid);
- SendClientMessage(playerid, -1, "Welcome back! You have successfully logged in!");
- TogglePlayerSpectating(playerid, false);
- SetSpawnInfo(playerid, 0, 299, 1740.6188, -1949.9669, 14.1172, 176.0951, 0, 0, 0, 0, 0, 0);
- SetTimerEx("LevelTimer", 1800000, true, "i", playerid);
- SpawnPlayer(playerid);
- Logged[playerid] = true;
- }
- else // if statement is anything BUT the above
- {
- TogglePlayerSpectating(playerid, true);
- ShowPlayerDialog(playerid, dialog_Login, DIALOG_STYLE_PASSWORD, "Authenticate", "Please enter a password below in order to log in\n\nThe password you entered is incorrect.", "Login", "Quit");
- }
- }
- }
- if(dialogid == dialog_DealershipConfirm)
- {
- if(!response)
- {
- SetPlayerPos(playerid, pDlOldPos[playerid][0], pDlOldPos[playerid][1], pDlOldPos[playerid][2]);
- DestroyVehicle(pBuyingCar[playerid]);
- pBuyingCar[playerid] = 0, pBuyingCarModel[playerid] = 0;
- TogglePlayerControllable(playerid, true);
- SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: Vehicle purchasement cancelled, taking you back to the vehicle dealership menu..");
- return cmd_vbuy(playerid);
- }
- if(response)
- {
- for (new i; i != sizeof (PriceArray); ++ i)
- {
- if (PriceArray[i][0] == pBuyingCarModel[playerid])
- {
- if(GetPlayerMoney(playerid) >= PriceArray[i][1])
- {
- GivePlayerMoney(playerid, -PriceArray[i][1]);
- AddPlayerVehicle(playerid, pBuyingCarModel[playerid], PriceArray[0][i]);
- }
- else if(GetPlayerMoney(playerid) < PriceArray[i][1])
- {
- SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You don't have enough money!");
- SetPlayerPos(playerid, pDlOldPos[playerid][0], pDlOldPos[playerid][1], pDlOldPos[playerid][2]);
- DestroyVehicle(pBuyingCar[playerid]);
- pBuyingCar[playerid] = 0, pBuyingCarModel[playerid] = 0;
- TogglePlayerControllable(playerid, true);
- return cmd_vbuy(playerid);
- }
- break;
- }
- }
- pInfo[playerid][CarOwner] = pBuyingCar[playerid];
- PutPlayerInVehicle(playerid, pBuyingCar[playerid], 0);
- SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You have successfully bought your vehicle! Make sure to repark it!");
- TogglePlayerControllable(playerid, true);
- }
- return true;
- }
- if(dialogid == dialog_Buy)
- {
- if(response)
- {
- switch(listitem)
- {
- case 0: // mask
- {
- if(GetPlayerMoney(playerid) >= 1000)
- {
- pInfo[playerid][Mask] = 1;
- SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You have bought a mask for $1000!");
- }
- else return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You don't have enough money!");
- }
- case 1: // phone
- {
- if(GetPlayerMoney(playerid) >= 750)
- {
- pInfo[playerid][Phone] = 1;
- SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You have bought a phone for $750!");
- }
- else return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You don't have enough money!");
- }
- }
- }
- return true;
- }
- return true;
- }
- public OnPlayerSpawn(playerid)
- {
- if(pDeath[playerid])
- {
- pDeathTimer[playerid] = SetTimerEx("DeathTimer", 1000, true, "i", playerid);
- pDeathTimerTick[playerid] = 60;
- TogglePlayerControllable(playerid, false);
- SetPlayerPos(playerid, 2003.9069, -1453.6417, 31.2220);
- SetPlayerVirtualWorld(playerid, 666);
- SetPlayerCameraPos(playerid, 2003.9069, -1453.6417, 27.2220);
- SetPlayerCameraLookAt(playerid, 2004.4561, -1452.8013, 27.0119);
- }
- GivePlayerMoney(playerid, pInfo[playerid][HandMoney]);
- SetPlayerSkin(playerid, pInfo[playerid][SkinID]);
- return true;
- }
- public OnPlayerDeath(playerid, killerid, reason)
- {
- pDeath[playerid] = true;
- return true;
- }
- public OnPlayerText(playerid, text[])
- {
- new msg[129];
- if(pOnCall[playerid])
- {
- for(new i; i < MAX_PLAYERS; i ++)
- {
- if(pCalling[i] == playerid)
- {
- new string[126];
- format(string, sizeof(string), "%s says (cellphone): %s", GetPlayerName(playerid), text);
- SendNearbyMessage(playerid, 0xF2F2F2FF, 0xD6D6D6FF, 0xC7C7C7FF, 0xB0B0B0FF, string);
- SendClientMessage(i, 0xFFFB00FF, string);
- break;
- }
- }
- }
- else if(!pOnCall[playerid])
- {
- format(msg, sizeof msg, "%s says: %s", GetPlayerName(playerid), text);
- SplitMessage(playerid, 0xF2F2F2FF, 0xD6D6D6FF, 0xC7C7C7FF, 0xB0B0B0FF, msg);
- }
- return false;
- }
- public OnPlayerModelSelection(playerid, response, listid, modelid)
- {
- if(listid == skinlist)
- {
- if(response)
- {
- SetPlayerSkin(playerid, modelid);
- }
- else if(!response) return ShowModelSelectionMenu(playerid, skinlist, "Select Skin");
- }
- return true;
- }
- public OnPlayerModelSelectionEx(playerid, response, extraid, modelid)
- {
- new Float: x, Float: y, Float: z;
- GetPlayerPos(playerid, x, y, z);
- pDlOldPos[playerid][0] = x;
- pDlOldPos[playerid][1] = y;
- pDlOldPos[playerid][2] = z;
- if(extraid == mselection_Dealership)
- {
- if(response)
- {
- pBuyingCar[playerid] = CreateVehicle(modelid, 1607.9554, -1836.0122, 13.5089, 311.1762, 0, 0, -1);
- PutPlayerInVehicle(playerid, pBuyingCar[playerid], 0);
- pBuyingCarModel[playerid] = modelid;
- ShowDealershipDialog(playerid, pBuyingCarModel[playerid]);
- }
- else SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You have closed the dealership menu.");
- }
- return true;
- }
- public OnPlayerStateChange(playerid, newstate, oldstate)
- {
- new vehicleid = GetPlayerVehicleID(playerid);
- switch(newstate)
- {
- case PLAYER_STATE_DRIVER:
- {
- if(vInfo[vehicleid][Type] == 1 && pInfo[playerid][FactionID] == vInfo[vehicleid][Faction])
- {
- SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: Welcome to your faction's vehicle!");
- }
- else if(vInfo[vehicleid][Type] == 1 && pInfo[playerid][FactionID] != vInfo[vehicleid][Faction])
- {
- RemovePlayerFromVehicle(playerid);
- SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: This vehicle isn't part of your faction!");
- }
- PlayerTextDrawShow(playerid, vSpeedTD[playerid]);
- PlayerTextDrawShow(playerid, vSpeedTDText[playerid]);
- PlayerTextDrawShow(playerid, vFuelTD[playerid]);
- PlayerTextDrawShow(playerid, vFuelTDText[playerid]);
- }
- case PLAYER_STATE_ONFOOT:
- {
- PlayerTextDrawHide(playerid, vSpeedTD[playerid]);
- PlayerTextDrawHide(playerid, vSpeedTDText[playerid]);
- PlayerTextDrawHide(playerid, vFuelTD[playerid]);
- PlayerTextDrawHide(playerid, vFuelTDText[playerid]);
- }
- }
- return true;
- }
- public OnPlayerUpdate(playerid)
- {
- new string[16];
- if(IsPlayerInAnyVehicle(playerid))
- {
- format(string, sizeof(string), "~p~%0.0f", GetVehicleSpeed(GetPlayerVehicleID(playerid)));
- PlayerTextDrawSetString(playerid, vSpeedTD[playerid], string);
- format(string, sizeof(string), "~p~%d", vInfo[GetPlayerVehicleID(playerid)][Fuel]);
- PlayerTextDrawSetString(playerid, vFuelTD[playerid], string);
- }
- return true;
- }
- CMD:stats(playerid, params[])
- {
- new string[110], sHolder[40], sHolder2[40];
- SendClientMessage(playerid, 0x8EB2D6FF, "Your ingame statistics");
- format(string, sizeof(string), "[Name: %s] [Admin: %d] [Helper: %d] [Level: %d] [Exp: %d/%d] [Session ID: %d]", GetPlayerName(playerid), pInfo[playerid][Admin], pInfo[playerid][Helper], pInfo[playerid][Level], pInfo[playerid][Exp], pInfo[playerid][ExpLeft], playerid);
- SendClientMessage(playerid, 0xC4C4C4FF, string);
- if(pInfo[playerid][FactionID] == 0) format(sHolder, sizeof(sHolder), "Civilians");
- else if(pInfo[playerid][FactionID] > 0) format(sHolder, sizeof(sHolder), "%s", fInfo[pInfo[playerid][FactionID]][Name]);
- format(string, sizeof(string), "[Faction: %s (%d)] [Tier: %d] [Rank: %s]", sHolder, pInfo[playerid][FactionID], pInfo[playerid][FactionTier], pInfo[playerid][FactionRank]);
- SendClientMessage(playerid, 0xABABABFF, string);
- format(string, sizeof(string), "[House: %d] [Car: %d] [Biz: %d] [Bank: $%d] [Money: $%d]", pInfo[playerid][HouseOwner], pInfo[playerid][CarOwner], pInfo[playerid][BizOwner], pInfo[playerid][BankMoney], GetPlayerMoney(playerid));
- SendClientMessage(playerid, 0xC4C4C4FF, string);
- if(pInfo[playerid][Phone] == 0) format(sHolder, sizeof(sHolder), "No");
- else if(pInfo[playerid][Phone] == 1) format(sHolder, sizeof(sHolder), "Yes");
- if(pInfo[playerid][Mask] == 0) format(sHolder2, sizeof(sHolder2), "No");
- else if(pInfo[playerid][Mask] == 1) format(sHolder2, sizeof(sHolder2), "Yes");
- format(string, sizeof(string), "[Phone: %s] [Phone Number: %d] [Mask: %s] [Mask Number: %d] ", sHolder, pInfo[playerid][PhoneNumber], sHolder2, pInfo[playerid][MaskNumber], pInfo[playerid][SkinID]);
- SendClientMessage(playerid, 0xABABABFF, string);
- return true;
- }
- CMD:deposit(playerid, params[])
- {
- new string[90], input;
- if(sscanf(params, "i", input)) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF} /deposit [amount]");
- if(GetPlayerMoney(playerid) < input) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF} You don't have that much money!");
- if(IsPlayerInRangeOfPoint(playerid, 3.0, 0.00, 0.00, 0.00))
- {
- pOldBalance[playerid] = pInfo[playerid][BankMoney]; // save old var
- pInfo[playerid][BankMoney] += input, GivePlayerMoney(playerid, -input);
- format(string, sizeof(string), "{8EB2D6}[INFO]{FFFFFF} You have deposited $%d into your bank account.", input);
- SendClientMessage(playerid, -1, string);
- format(string, sizeof(string), "{8EB2D6}[INFO]{FFFFFF} Old balance: $%d | New balance: $%d", pOldBalance[playerid], pInfo[playerid][BankMoney]);
- SendClientMessage(playerid, -1, string);
- }
- else return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You're not in range of the bank! [[Make sure to change this in the script]]");
- return true;
- }
- CMD:withdraw(playerid, params[])
- {
- new string[90], input;
- if(sscanf(params, "i", input)) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF} /withdraw [amount]");
- if(pInfo[playerid][BankMoney] < input) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF} Your bank account doesn't hold that much money!");
- if(IsPlayerInRangeOfPoint(playerid, 3.0, 0.00, 0.00, 0.00))
- {
- pOldBalance[playerid] = pInfo[playerid][BankMoney]; // save old var
- pInfo[playerid][BankMoney] -= input, GivePlayerMoney(playerid, input);
- format(string, sizeof(string), "{8EB2D6}[INFO]{FFFFFF} You have withdrawn $%d from your bank account.", input);
- SendClientMessage(playerid, -1, string);
- format(string, sizeof(string), "{8EB2D6}[INFO]{FFFFFF} Old balance: $%d | New balance: $%d", pOldBalance[playerid], pInfo[playerid][BankMoney]);
- SendClientMessage(playerid, -1, string);
- }
- else return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You're not in range of the bank! [[Make sure to change this in the script]]");
- return true;
- }
- CMD:bankinfo(playerid, params[])
- {
- new string[90];
- if(IsPlayerInRangeOfPoint(playerid, 3.0, 0.00, 0.00, 0.00))
- {
- format(string, sizeof(string), "{8EB2D6}[INFO]{FFFFFF} Bank account balance: $%d", pInfo[playerid][BankMoney]);
- SendClientMessage(playerid, -1, string);
- }
- else return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You're not in range of the bank! [[Make sure to change this in the script]]");
- return true;
- }
- CMD:buy(playerid, params[])
- {
- if(IsPlayerInRangeOfPoint(playerid, 3.0, 0.00, 0.00, 0.00))
- {
- ShowPlayerDialog(playerid, dialog_Buy, DIALOG_STYLE_LIST, "24/7", "Mask $1000\nPhone $750", "Buy", "Cancel");
- }
- else return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You're not in range of the 24/7! [[Make sure to change this in the script]]");
- return true;
- }
- CMD:report(playerid, params[])
- {
- new string[144], text[80];
- if(sscanf(params, "s[80]", text)) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: /report [text]");
- format(string, sizeof(string), "(%d) %s reported: %s", playerid, GetPlayerName(playerid), text);
- SendAdminMsg(string);
- return true;
- }
- CMD:help(playerid, params[])
- {
- SendClientMessage(playerid, 0x8EB2D6FF, "Commands available to you");
- SendClientMessage(playerid, -1, "{8EB2D6}[CHAT]{FFFFFF}: /pm, /me, /do, /o, /b, /low, /s(hout), /mes, /mask");
- SendClientMessage(playerid, -1, "{8EB2D6}[PHONE]{FFFFFF}: /call, /pickup, /hangup, /togphone");
- SendClientMessage(playerid, -1, "{8EB2D6}[GENERAL]{FFFFFF}: /report, /admins, /deposit, /withdraw, /bankinfo, /stats");
- SendClientMessage(playerid, -1, "{8EB2D6}[SYSTEMS]{FFFFFF}: /carhelp, /househelp, /factionhelp, /bizhelp, /ahelp");
- return true;
- }
- CMD:admins(playerid, params[])
- {
- new string[50], sendername[MAX_PLAYER_NAME];
- SendClientMessage(playerid, 0x8EB2D6FF, "Online Administrators");
- for(new i = 0; i < MAX_PLAYERS; i++)
- {
- if(pInfo[playerid][Admin] > 0)
- {
- GetPlayerName(i, sendername, sizeof(sendername));
- format(string, sizeof(string), "(Lvl: %d) %s (%d)", pInfo[playerid][Admin], sendername, i);
- SendClientMessage(playerid, 0xA3A3A3FF, string);
- }
- }
- return true;
- }
- CMD:mask(playerid, params[])
- {
- if(!pMasked[playerid])
- {
- pMasked[playerid] = true;
- SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You have put your mask on!");
- }
- else if(pMasked[playerid])
- {
- pMasked[playerid] = false;
- SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You have taken your mask off!");
- }
- return true;
- }
- CMD:bizhelp(playerid, params[])
- {
- SendClientMessage(playerid, 0x8EB2D6FF, "Business commands available to you");
- SendClientMessage(playerid, -1, "{8EB2D6}[OWNED]{FFFFFF}: /bnear, /bbuy, /bsell, /baccess, /block");
- return true;
- }
- CMD:achat(playerid, params[])
- {
- new string[144], text[80];
- if(pInfo[playerid][Admin] == 0) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You're not an administrator!");
- if(sscanf(params, "s[80]", text)) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: /report [text]");
- format(string, sizeof(string), "(%d) %s: %s", playerid, GetPlayerName(playerid), text);
- SendAdminMsg(string);
- return true;
- }
- CMD:ahelp(playerid, params[])
- {
- if(pInfo[playerid][Admin] == 0) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You're not an administrator!");
- if(pInfo[playerid][Admin] >= 1)
- {
- SendClientMessage(playerid, 0xCC9D76FF, "Trial Admin commands [Lvl. 1]");
- SendClientMessage(playerid, -1, "{96CC76}[PLAYERS]{FFFFFF}: /achat");
- }
- if(pInfo[playerid][Admin] >= 2)
- {
- SendClientMessage(playerid, 0xCC9D76FF, "Basic Admin commands [Lvl. 2]");
- }
- if(pInfo[playerid][Admin] >= 3)
- {
- SendClientMessage(playerid, 0xCC9D76FF, "General Admin commands [Lvl. 3]");
- SendClientMessage(playerid, -1, "{96CC76}[FACTIONS]{FFFFFF}: /fset, /frename, /fsettype");
- SendClientMessage(playerid, -1, "{96CC76}[HOUSES]{FFFFFF}: /hgoto, /hsetint, /hmove");
- SendClientMessage(playerid, -1, "{96CC76}[LABELS]{FFFFFF}: /labelrename, /labelmove");
- SendClientMessage(playerid, -1, "{96CC76}[BIZZES]{FFFFFF}: /bgoto, /bsetint, /bmove");
- }
- if(pInfo[playerid][Admin] >= 4)
- {
- SendClientMessage(playerid, 0xCC9D76FF, "Management commands [Lvl. 4]");
- SendClientMessage(playerid, -1, "{96CC76}[VEHICLES]{FFFFFF}: /vcreate, /vdelete");
- SendClientMessage(playerid, -1, "{96CC76}[HOUSES]{FFFFFF}: /hcreate, hdelete");
- SendClientMessage(playerid, -1, "{96CC76}[FACTIONS]{FFFFFF}: /fcreate, /fdelete");
- SendClientMessage(playerid, -1, "{96CC76}[LABELS]{FFFFFF}: /labelcreate, /labeldelete");
- SendClientMessage(playerid, -1, "{96CC76}[BIZZES]{FFFFFF}: /bdelete, /bcreate");
- }
- return true;
- }
- CMD:pm(playerid, params[])
- {
- new str[128], text[68], targetid;
- if(sscanf(params, "us[128]", targetid, text)) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: /pm [player] [text]");
- if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: Player isn't connected!");
- format(str, sizeof(str), "PM to %s (%d): %s", GetPlayerName(targetid), targetid, text);
- SendClientMessage(playerid, 0xE0E800FF, str);
- format(str, sizeof(str), "PM from %s (%d): %s", GetPlayerName(playerid), playerid, text);
- SendClientMessage(targetid, 0xE8C900FF, str);
- return true;
- }
- CMD:privmsg(playerid, params[]) return cmd_pm(playerid, params);
- CMD:o(playerid, params[])
- {
- new text[128], string[128];
- if(sscanf(params, "s[128]", text)) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: /o [text]");
- format(string, sizeof(string), "(( [%d] %s: %s ))", playerid, GetPlayerName(playerid), text);
- SendClientMessageToAll(0xF2F2F2FF, string);
- return true;
- }
- CMD:ooc(playerid, params[]) return cmd_o(playerid, params);
- CMD:b(playerid, params[])
- {
- new text[128], string[128];
- if(sscanf(params, "s[128]", text)) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: /b [text]");
- format(string, sizeof(string), "(( [%d] %s: %s ))", playerid, GetPlayerName(playerid), text);
- SplitMessage(playerid, 0xA3A3A3FF, 0xA3A3A3FF, 0x8C8C8CFF, 0x8C8C8CFF, string);
- return true;
- }
- CMD:low(playerid, params[])
- {
- new text[128], string[128];
- if(sscanf(params, "s[128]", text)) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: /low [text]");
- format(string, sizeof(string), "%s says [low]: %s", GetPlayerName(playerid), text);
- SplitMessage(playerid, 0xA3A3A3FF, 0xA3A3A3FF, 0x8C8C8CFF, 0x8C8C8CFF, string);
- return true;
- }
- CMD:shout(playerid, params[])
- {
- new text[128], string[128];
- if(sscanf(params, "s[128]", text)) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: /s(hout) [text]");
- format(string, sizeof(string), "%s shouts: %s", GetPlayerName(playerid), text);
- SplitMessage(playerid, 0xF2F2F2FF, 0xF2F2F2FF, 0xC7C7C7FF, 0xB0B0B0FF, string);
- return true;
- }
- CMD:s(playerid, params[]) return cmd_shout(playerid, params);
- CMD:me(playerid, params[])
- {
- new text[128], string[128];
- if(sscanf(params, "s[128]", text)) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: /me [action]");
- format(string, sizeof(string), "%s %s", GetPlayerName(playerid), text);
- SplitMessage(playerid, 0xC2A2DAAA, 0xC2A2DAAA, 0xC2A2DAAA, 0xC2A2DAAA, string);
- return true;
- }
- CMD:mes(playerid, params[])
- {
- new text[128], string[128];
- if(sscanf(params, "s[128]", text)) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: /mes [action]");
- format(string, sizeof(string), "%s's %s", GetPlayerName(playerid), text);
- SplitMessage(playerid, 0xC2A2DAAA, 0xC2A2DAAA, 0xC2A2DAAA, 0xC2A2DAAA, string);
- return true;
- }
- CMD:do(playerid, params[])
- {
- new text[128], string[128];
- if(sscanf(params, "s[128]", text)) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: /do [action]");
- format(string, sizeof(string), "%s (( %s ))", text, GetPlayerName(playerid));
- SplitMessage(playerid, 0xC2A2DAAA, 0xC2A2DAAA, 0xC2A2DAAA, 0xC2A2DAAA, string);
- return true;
- }
- // phone system
- CMD:call(playerid, params[])
- {
- new tnum, string[75], sender = pInfo[playerid][PhoneNumber];
- if(pInfo[playerid][Phone] != 1) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You don't have a phone!");
- if(sscanf(params, "i", tnum)) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: /call [number]");
- for(new i = 0; i < MAX_PLAYERS; i++)
- {
- if(pInfo[i][PhoneNumber] == tnum)
- {
- if(!pPhoneStatus[i]) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: The number you entered may not exist or the device is turned off.");
- if(pOnCall[i]) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: The number you entered is already in a call.");
- if(pIsCalled[i]) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: The number you entered is already being called.");
- pCalling[playerid] = i;
- SetPlayerSpecialAction(playerid, SPECIAL_ACTION_USECELLPHONE);
- format(string, sizeof(string), "Your cellphone is ringing (/pickup). The calling number is %d.", sender);
- SendClientMessage(i, -1, string);
- pIsCalled[i] = true;
- break;
- }
- }
- return true;
- }
- CMD:pickup(playerid, params)
- {
- if(pInfo[playerid][Phone] != 1) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You don't have a phone!");
- if(!pIsCalled[playerid]) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You are currently not connected to a phone call.");
- for(new i; i < MAX_PLAYERS; i ++)
- {
- if(pCalling[i] == playerid)
- {
- pCalling[playerid] = i; //caller connecting
- SendClientMessage(i, -1, "{8EB2D6}[INFO]{FFFFFF}: The call has been connected.");
- SetPlayerSpecialAction(playerid, SPECIAL_ACTION_USECELLPHONE);
- SetPlayerSpecialAction(playerid, SPECIAL_ACTION_STOPUSECELLPHONE);
- ClearAnimations(playerid);
- pOnCall[playerid] = true;
- pOnCall[i] = true;
- }
- }
- return true;
- }
- CMD:hangup(playerid, params[])
- {
- if(pInfo[playerid][Phone] != 1) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You don't have a phone!");
- if(!pIsCalled[playerid]) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You are currently not connected to a phone call.");
- for(new i; i < MAX_PLAYERS; i ++)
- {
- if(pCalling[i] == playerid)
- {
- pCalling[playerid] = i; //caller connecting
- SendClientMessage(i, -1, "{8EB2D6}[INFO]{FFFFFF}: The call has been disconnected.");
- SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You have disconnected the call.");
- SetPlayerSpecialAction(playerid, SPECIAL_ACTION_NONE);
- SetPlayerSpecialAction(playerid, SPECIAL_ACTION_USECELLPHONE);
- SetPlayerSpecialAction(playerid, SPECIAL_ACTION_STOPUSECELLPHONE);
- ClearAnimations(playerid);
- pOnCall[playerid] = false;
- pIsCalled[playerid] = false;
- pOnCall[i] = false;
- pIsCalled[i] = false;
- break;
- }
- }
- return true;
- }
- CMD:togphone(playerid, params[])
- {
- if(pInfo[playerid][Phone] != 1) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You don't have a phone!");
- if(pPhoneStatus[playerid])
- {
- SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You have switched your cellphone off.");
- pPhoneStatus[playerid] = false;
- }
- else if(!pPhoneStatus[playerid])
- {
- SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You have switched your cellphone on.");
- pPhoneStatus[playerid] = true;
- }
- return true;
- }
- // biz system
- CMD:bcreate(playerid, params[])
- {
- new Float: pos[3], string[100], str2[MAX_PLAYER_NAME], price, name[40];
- GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
- if(pInfo[playerid][Admin] < 4) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You need to be an admin in order to do this command!");
- if(sscanf(params, "is[40]", price, name)) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: /bcreate [price] [name]");
- format(str2, sizeof(str2), "None"); // to avoid array error -- size is MAX_PLAYER_NAME, as is "Owner"
- new INI:File = INI_Open(BusinessPath(bCount));
- INI_SetTag(File, "Business Data");
- INI_WriteString(File, "Name", name);
- bInfo[bCount][Name] = name;
- INI_WriteString(File, "Owner", str2);
- bInfo[bCount][Owner] = str2;
- INI_WriteInt(File, "Price", price);
- bInfo[bCount][Price] = price;
- INI_WriteInt(File, "Bought", 0);
- bInfo[bCount][Bought] = 0;
- INI_WriteFloat(File, "ExtX", pos[0]);
- bInfo[bCount][ExtX] = pos[0];
- INI_WriteFloat(File, "ExtY", pos[1]);
- bInfo[bCount][ExtY] = pos[1];
- INI_WriteFloat(File, "ExtZ", pos[2]);
- bInfo[bCount][ExtZ] = pos[2];
- INI_WriteFloat(File, "IntX", 0.0);
- bInfo[bCount][IntX] = 0.0;
- INI_WriteFloat(File, "IntY", 0.0);
- bInfo[bCount][IntX] = 0.0;
- INI_WriteFloat(File, "IntZ", 0.0);
- bInfo[bCount][IntX] = 0.0;
- INI_WriteInt(File, "IntWorld", 2);
- bInfo[bCount][IntInterior] = 2;
- INI_WriteInt(File, "IntVW", 0);
- bInfo[bCount][IntVirtualW] = random(250);
- INI_WriteInt(File, "VW", GetPlayerVirtualWorld(playerid));
- bInfo[bCount][World] = GetPlayerVirtualWorld(playerid);
- INI_WriteInt(File, "World", GetPlayerInterior(playerid));
- bInfo[bCount][Interior] = GetPlayerInterior(playerid);
- INI_WriteInt(File, "Locked", 0);
- bInfo[bCount][Locked] = 0;
- INI_WriteInt(File, "Initialised", 0);
- bInfo[bCount][Initialised] = 0;
- INI_Close(File);
- format(string, sizeof(string), "{8EB2D6}[Business]{FFFFFF}\nName: %s\nOwner: %s\nPrice: %d", bInfo[bCount][Name], bInfo[bCount][Owner], bInfo[bCount][Price]);
- bInfo[bCount][Label] = Create3DTextLabel(string, 0xFFFFFFFF, pos[0], pos[1], pos[2], 10.0, GetPlayerVirtualWorld(playerid), 1);
- bCount ++;
- SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You have created a business at your position! Use /bsetint to set it's interior!");
- return true;
- }
- CMD:bdelete(playerid, params[])
- {
- new bid, loc[30], string[80];
- if(pInfo[playerid][Admin] < 4) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You need to be an admin in order to do this command!");
- if(sscanf(params, "i", bid)) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: /bdelete [bid]");
- format(loc, 30, "Businesses/%d.ini", bid);
- if(!fexist(loc)) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: The business ID you entered doesn't exist.");
- else if(fexist(loc))
- {
- format(string, sizeof(string), "{8EB2D6}[INFO]{FFFFFF}: You have deleted business ID: %d", bid);
- SendClientMessage(playerid, -1, string);
- Delete3DTextLabel(bInfo[bid][Label]);
- fremove(loc);
- }
- return true;
- }
- CMD:bsetint(playerid, params[])
- {
- new interior, bid, string[80];
- if(pInfo[playerid][Admin] < 3) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You need to be an admin in order to do this command!");
- if(sscanf(params, "ii", bid, interior)) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: /bsetint [bid] [interior]");
- if(interior < 1 && interior > 5) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: No more than 25 and no less than 1!");
- if(interior == 1) // 24/7
- {
- bInfo[bid][IntX] = -25.884498;
- bInfo[bid][IntY] = -185.868988;
- bInfo[bid][IntZ] = 1003.546875;
- bInfo[bid][IntInterior] = 17;
- }
- if(interior == 2) // ammunation
- {
- bInfo[bid][IntX] = 286.148986;
- bInfo[bid][IntY] = -40.644397;
- bInfo[bid][IntZ] = 1001.515625;
- bInfo[bid][IntInterior] = 1;
- }
- if(interior == 3) // sex shop
- {
- bInfo[bid][IntX] = -103.559165;
- bInfo[bid][IntY] = -24.225606;
- bInfo[bid][IntZ] = 1000.718750;
- bInfo[bid][IntInterior] = 3;
- }
- if(interior == 4) // zero's
- {
- bInfo[bid][IntX] = -2240.468505;
- bInfo[bid][IntY] = 137.060440;
- bInfo[bid][IntZ] = 1035.414062;
- bInfo[bid][IntInterior] = 6;
- }
- if(interior == 5) // clothing store
- {
- bInfo[bid][IntX] = 207.737991;
- bInfo[bid][IntY] = -109.019996;
- bInfo[bid][IntZ] = 1005.132812;
- bInfo[bid][IntInterior] = 15;
- }
- format(string, sizeof(string), "{8EB2D6}[INFO]{FFFFFF}: Set business ID %d's interior to ID %d.", bid, interior);
- SendClientMessage(playerid, -1, string);
- bInfo[bid][Initialised] = 1;
- SaveBizzes();
- return true;
- }
- CMD:bgoto(playerid, params[])
- {
- new bid, string[50];
- if(pInfo[playerid][Admin] < 3) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You need to be an admin in order to do this command!");
- if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1, "You need to be an admin in order to do this command!");
- if(sscanf(params, "i", bid)) return SendClientMessage(playerid, -1, "/bgoto [bid]");
- format(string, sizeof(string), "You teleported to business ID %d", bid);
- SendClientMessage(playerid, -1, string);
- SetPlayerPos(playerid, bInfo[bid][ExtX], bInfo[bid][ExtY], bInfo[bid][ExtZ]);
- return true;
- }
- CMD:bmove(playerid, params[])
- {
- new bid, string[50], Float: pos[3], hlabel[100];
- GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
- if(pInfo[playerid][Admin] < 3) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You need to be an admin in order to do this command!");
- if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1, "You need to be an admin in order to do this command!");
- if(sscanf(params, "i", bid)) return SendClientMessage(playerid, -1, "/bmove [bid]");
- format(string, sizeof(string), "You teleported to business ID %d", bid);
- SendClientMessage(playerid, -1, string);
- bInfo[bid][ExtX] = pos[0];
- bInfo[bid][ExtY] = pos[1];
- bInfo[bid][ExtZ] = pos[2];
- if(bInfo[bid][Bought] == 0) format(hlabel, sizeof(hlabel), "{8EB2D6}[Business]{FFFFFF}\nName: %s\nOwner: %s\nPrice: %d", bInfo[bid][Name], bInfo[bid][Owner], bInfo[bid][Price]);
- else if(bInfo[bid][Bought] == 1) format(hlabel, sizeof(hlabel), "{8EB2D6}[Business]{FFFFFF}\nName: %s\nOwner: %s", bInfo[bid][Name], bInfo[bid][Owner]);
- Delete3DTextLabel(bInfo[bid][Label]);
- bInfo[bid][Label] = Create3DTextLabel(hlabel, 0xFFFFFF, pos[0], pos[1], pos[2], 15.0, bInfo[bid][World], 1);
- SaveBizzes();
- return true;
- }
- CMD:bnear(playerid, params[])
- {
- new string[30];
- format(string, sizeof(string), "{8EB2D6}[INFO]{FFFFFF}: You're not near a business entrance!");
- for(new i; i < MAX_BIZZES; i ++)
- {
- if(IsPlayerInRangeOfPoint(playerid, 2.0, bInfo[i][ExtX], bInfo[i][ExtY], bInfo[i][ExtZ]))
- {
- format(string, sizeof(string), "{8EB2D6}[INFO]{FFFFFF}: You're near business ID %d", i);
- }
- }
- SendClientMessage(playerid, -1, string);
- return true;
- }
- CMD:bbuy(playerid, params[])
- {
- new string[80], name[MAX_PLAYER_NAME];
- GetPlayerName(playerid, name, sizeof(name));
- format(string, sizeof(string), "{8EB2D6}[INFO]{FFFFFF}: You're not near a business entrance!");
- for(new i; i < MAX_BIZZES; i ++)
- {
- if(IsPlayerInRangeOfPoint(playerid, 2.0, bInfo[i][ExtX], bInfo[i][ExtY], bInfo[i][ExtZ]))
- {
- if(bInfo[i][Bought] == 0)
- {
- if(GetPlayerMoney(playerid) >= bInfo[i][Price])
- {
- GivePlayerMoney(playerid, - bInfo[i][Price]);
- pInfo[playerid][BizOwner] = i;
- bInfo[i][Owner] = name;
- bInfo[i][Bought] = 1;
- format(string, sizeof(string), "{8EB2D6}[Business]{FFFFFF}\nName: %s\nOwner: %s", bInfo[i][Name], bInfo[i][Owner]);
- Update3DTextLabelText(bInfo[i][Label], 0xFFFFFF, string);
- format(string, sizeof(string), "{8EB2D6}[INFO]{FFFFFF}: You have purchased business ID %d for %d!", i, bInfo[i][Price]);
- break;
- }
- else return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You don't have enough money!");
- }
- else return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: This business is not for sale!");
- }
- }
- SendClientMessage(playerid, -1, string);
- return true;
- }
- CMD:bsell(playerid, params[])
- {
- new string[80], name[MAX_PLAYER_NAME];
- GetPlayerName(playerid, name, sizeof(name));
- format(string, sizeof(string), "{8EB2D6}[INFO]{FFFFFF}: You're not near a business entrance!");
- format(name, sizeof(name), "None");
- for(new i; i < MAX_BIZZES; i ++)
- {
- if(IsPlayerInRangeOfPoint(playerid, 2.0, bInfo[i][ExtX], bInfo[i][ExtY], bInfo[i][ExtZ]))
- {
- if(pInfo[playerid][BizOwner] == i)
- {
- if(GetPlayerMoney(playerid) >= bInfo[i][Price])
- {
- GivePlayerMoney(playerid, bInfo[i][Price]);
- pInfo[playerid][BizOwner] = 0;
- bInfo[i][Owner] = name;
- bInfo[i][Bought] = 0;
- format(string, sizeof(string), "{8EB2D6}[Business]{FFFFFF}\nName: %s\nOwner: %s\nPrice: %d", bInfo[i][Name], bInfo[i][Owner], bInfo[i][Price]);
- Update3DTextLabelText(bInfo[i][Label], 0xFFFFFF, string);
- format(string, sizeof(string), "{8EB2D6}[INFO]{FFFFFF}: You have sold business ID %d for %d!", i, bInfo[i][Price]);
- break;
- }
- else return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You don't have enough money!");
- }
- else return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You don't own this business!");
- }
- }
- SendClientMessage(playerid, -1, string);
- return true;
- }
- CMD:block(playerid, params[])
- {
- new string[80];
- format(string, sizeof(string), "{8EB2D6}[INFO]{FFFFFF}: You're not near a business entrance!");
- for(new i; i < MAX_BIZZES; i ++)
- {
- if(IsPlayerInRangeOfPoint(playerid, 2.0, bInfo[i][ExtX], bInfo[i][ExtY], bInfo[i][ExtZ]))
- {
- if(pInfo[playerid][BizOwner] == i)
- {
- if(bInfo[playerid][Locked] == 1)
- {
- bInfo[playerid][Locked] = 0;
- format(string, sizeof(string), "{8EB2D6}[INFO]{FFFFFF}: You have unlocked your business!");
- }
- else if(bInfo[playerid][Locked] == 0)
- {
- bInfo[playerid][Locked] = 1;
- format(string, sizeof(string), "{8EB2D6}[INFO]{FFFFFF}: You have locked your business!");
- }
- SaveBizzes();
- break;
- }
- else return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You don't own this business!");
- }
- }
- SendClientMessage(playerid, -1, string);
- return true;
- }
- CMD:baccess(playerid, params[])
- {
- new string[100];
- format(string, sizeof(string), "{8EB2D6}[INFO]{FFFFFF}: You're not near a business entrance or exit!");
- for(new i; i < MAX_BIZZES; i ++)
- {
- if(bInfo[i][Locked] == 0)
- {
- if(bInfo[i][Initialised] == 1)
- {
- if(IsPlayerInRangeOfPoint(playerid, 2.0, bInfo[i][ExtX], bInfo[i][ExtY], bInfo[i][ExtZ]))
- {
- SetPlayerPos(playerid, bInfo[i][IntX], bInfo[i][IntY], bInfo[i][IntZ]);
- SetPlayerInterior(playerid, bInfo[i][IntInterior]);
- SetPlayerVirtualWorld(playerid, bInfo[i][IntVirtualW]);
- format(string, sizeof(string), "{8EB2D6}[INFO]{FFFFFF}: You entered business ID %d.", i);
- break;
- }
- else if(IsPlayerInRangeOfPoint(playerid, 2.0, bInfo[i][IntX], bInfo[i][IntY], bInfo[i][IntZ]) && GetPlayerVirtualWorld(playerid) == bInfo[i][IntVirtualW])
- {
- SetPlayerPos(playerid, bInfo[i][ExtX], bInfo[i][ExtY], bInfo[i][ExtZ]);
- SetPlayerInterior(playerid, bInfo[i][Interior]);
- SetPlayerVirtualWorld(playerid, bInfo[i][World]);
- format(string, sizeof(string), "{8EB2D6}[INFO]{FFFFFF}: You left business ID %d.", i);
- break;
- }
- }
- }
- else format(string, sizeof(string), "{8EB2D6}[INFO]{FFFFFF}: The business you're trying to enter is locked!");
- }
- SendClientMessage(playerid, -1, string);
- return true;
- }
- // car system
- CMD:carhelp(playerid, params[])
- {
- SendClientMessage(playerid, 0x8EB2D6FF, "Vehicle commands available to you");
- SendClientMessage(playerid, -1, "{8EB2D6}[OWNED CAR]{FFFFFF}: /vbuy, /vscrap, /vpark, /vgive, /vsetcolor, /engine, /lock");
- SendClientMessage(playerid, -1, "{8EB2D6}[EVERY CAR]{FFFFFF}: /vstoregun, /vtakegun, /vcheck, /vhood, /vtrunk");
- return true;
- }
- CMD:vhood(playerid, params[])
- {
- new engine, lights, alarm, doors, bonnet, boot, objective, vehicleid = GetPlayerVehicleID(playerid);
- GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
- if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You need to be in a vehicle when performing this command!");
- if(!vHood[vehicleid])
- {
- SetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, 1, boot, objective);
- SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You have opened the hood!");
- vHood[vehicleid] = true;
- }
- else if(vHood[vehicleid])
- {
- SetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, 0, boot, objective);
- SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You have closed the hood!");
- vHood[vehicleid] = false;
- }
- return true;
- }
- CMD:vtrunk(playerid, parmas[])
- {
- new engine, lights, alarm, doors, bonnet, boot, objective, vehicleid = GetPlayerVehicleID(playerid);
- GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
- if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You need to be in a vehicle when performing this command!");
- if(!vTrunk[vehicleid])
- {
- SetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, 1, objective);
- SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You have opened the trunk!");
- vTrunk[vehicleid] = true;
- }
- else if(vTrunk[vehicleid])
- {
- SetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, 0, objective);
- SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You have closed the trunk!");
- vTrunk[vehicleid] = false;
- }
- return true;
- }
- CMD:vcheck(playerid, params[])
- {
- new string[100], gunname[32], gunname2[32], veh = GetPlayerVehicleID(playerid);
- GetWeaponName(vInfo[veh][StoredSlot1], gunname, sizeof(gunname));
- GetWeaponName(vInfo[veh][StoredSlot2], gunname2, sizeof(gunname2));
- if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You need to be in a vehicle when performing this command!");
- SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: Vehicle's trunk containments:");
- if(vInfo[veh][StoredSlot1] == 0) format(gunname, sizeof(gunname), "None");
- if(vInfo[veh][StoredSlot2] == 0) format(gunname2, sizeof(gunname2), "None");
- format(string, sizeof(string), "{8EB2D6}[Slot 1]{FFFFFF}: %s (%d) with %d ammo.", gunname, vInfo[veh][StoredSlot1], vInfo[veh][StoredSlot1Ammo]);
- SendClientMessage(playerid, -1, string);
- format(string, sizeof(string), "{8EB2D6}[Slot 2]{FFFFFF}: %s (%d) with %d ammo.", gunname2, vInfo[veh][StoredSlot2], vInfo[veh][StoredSlot2Ammo]);
- SendClientMessage(playerid, -1, string);
- return true;
- }
- CMD:vlock(playerid, params[])
- {
- new engine, lights, alarm, doors, bonnet, boot, objective, vehicleid = GetPlayerVehicleID(playerid);
- GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
- if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You need to be in a vehicle when performing this command!");
- if(pInfo[playerid][CarOwner] == GetPlayerVehicleID(playerid))
- {
- if(vLocked[vehicleid])
- {
- SetVehicleParamsEx(vehicleid, engine, lights, alarm, 0, bonnet, boot, objective);
- SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You have unlocked your vehicle!");
- vLocked[vehicleid] = false;
- }
- else if(!vLocked[vehicleid])
- {
- SetVehicleParamsEx(vehicleid, engine, lights, alarm, 1, bonnet, boot, objective);
- SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You have locked your vehicle!");
- vLocked[vehicleid] = true;
- }
- }
- else return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You're not in your personal vehicle!");
- return true;
- }
- CMD:engine(playerid, params[])
- {
- new engine, lights, alarm, doors, bonnet, boot, objective, vehicleid = GetPlayerVehicleID(playerid);
- GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
- if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You need to be in a vehicle when performing this command!");
- if(vInfo[vehicleid][Fuel] < 1) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: Your car has ran out of fuel!");
- if(pInfo[playerid][CarOwner] == GetPlayerVehicleID(playerid))
- {
- if(!vEngine[vehicleid])
- {
- SetVehicleParamsEx(vehicleid, 1, lights, alarm, doors, bonnet, boot, objective);
- SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You have turned your vehicle's engine on!");
- FuelTimer[vehicleid] = SetTimerEx("FuelTimerTick", 1000, true, "i", vehicleid);
- vEngine[vehicleid] = true;
- }
- else if(vEngine[vehicleid])
- {
- SetVehicleParamsEx(vehicleid, 0, lights, alarm, doors, bonnet, boot, objective);
- SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You have turned your vehicle's engine off!");
- KillTimer(FuelTimer[vehicleid]);
- vEngine[vehicleid] = false;
- }
- }
- else return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You're not in your personal vehicle!");
- return true;
- }
- CMD:fuelcar(playerid, params[])
- {
- new veh = GetPlayerVehicleID(playerid);
- if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You must be in a vehicle in order to do this command!");
- if(vEngine[veh]) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: Your engine must be off in order to be able to do this command!");
- if(IsPlayerInRangeOfPoint(playerid, 8.0, 1940.9299, -1772.8094, 13.6406))
- {
- FillingTimer[playerid] = SetTimerEx("FillingTimerEx", 1000, true, "ii", playerid, veh);
- TogglePlayerControllable(playerid, false);
- SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You have started to refill your vehicle.");
- }
- else return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You're not at a fuel station!");
- return true;
- }
- CMD:vsetcolor(playerid, params[])
- {
- new colA, colB;
- if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You need to be in a vehicle when performing this command!");
- if(sscanf(params, "ii", colA, colB)) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: /vsetcolor [color A] [color B]");
- if(IsPlayerInRangeOfPoint(playerid, 6.0, 1634.9066, -1865.3574, 13.5469))
- {
- if(pInfo[playerid][CarOwner] == GetPlayerVehicleID(playerid))
- {
- ChangeVehicleColor(GetPlayerVehicleID(playerid), colA, colB);
- vInfo[pInfo[playerid][CarOwner]][ColorA] = colA;
- vInfo[pInfo[playerid][CarOwner]][ColorB] = colB;
- SaveVehicles();
- SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You have parked your vehicle!");
- }
- else return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You're not in your personal vehicle!");
- }
- else return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You're not near the dealership!");
- return true;
- }
- CMD:vstoregun(playerid, params[])
- {
- new slot, string[100], gunname[32], veh = GetPlayerVehicleID(playerid), Float: pos[3];
- GetWeaponName(GetPlayerWeapon(playerid), gunname, sizeof(gunname));
- GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
- if(GetPlayerWeapon(playerid) == 0) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You're not holding any weapon that can be stored!");
- if(sscanf(params, "i", slot)) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: /vstoregun [slot: 1-2]");
- if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You need to be in a vehicle in order to do this command!");
- if(slot == 1 && vInfo[veh][StoredSlot1] == 0)
- {
- vInfo[veh][StoredSlot1] = GetPlayerWeapon(playerid);
- vInfo[veh][StoredSlot1Ammo] = GetPlayerAmmo(playerid);
- }
- else if(vInfo[veh][StoredSlot1] != 0) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: The slot you are trying to store a weapon in isn't empty.");
- if(slot == 2 && vInfo[veh][StoredSlot2] == 0)
- {
- vInfo[veh][StoredSlot2] = GetPlayerWeapon(playerid);
- vInfo[veh][StoredSlot2Ammo] = GetPlayerAmmo(playerid);
- }
- else if(vInfo[veh][StoredSlot2] != 0 && slot == 2) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: The slot you are trying to store a weapon in isn't empty.");
- format(string, sizeof(string), "{8EB2D6}[INFO]{FFFFFF}: You have stored your %s (%d) in trunk slot %d.", gunname, GetPlayerWeapon(playerid), slot);
- SendClientMessage(playerid, -1, string);
- RemovePlayerWeapon(playerid, GetPlayerWeapon(playerid));
- // START DUPLICATION BUG FIX //
- SetPlayerPos(playerid, pos[0], pos[1], pos[2] +1);
- SetTimerEx("FixDuplicationBug", 100, false, "ii", playerid, veh);
- // END DUPLICATION BUG FIX //
- SaveVehicles();
- return true;
- }
- CMD:vtakegun(playerid, params[])
- {
- new slot, string[100], gunname[32], gunname2[32], veh = GetPlayerVehicleID(playerid), Float: pos[3];
- GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
- GetWeaponName(vInfo[veh][StoredSlot1], gunname, sizeof(gunname));
- GetWeaponName(vInfo[veh][StoredSlot2], gunname2, sizeof(gunname2));
- if(GetPlayerWeapon(playerid) != 0) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You're already holding a weapon!");
- if(sscanf(params, "i", slot)) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: /vtakegun [slot: 1-2]");
- if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You need to be in a vehicle in order to do this command!");
- if(vInfo[veh][StoredSlot1] == 0 && slot == 1) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: The slot you are trying to store a weapon in is empty.");
- else if(vInfo[veh][StoredSlot2] == 0 && slot == 2) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: The slot you are trying to store a weapon in is empty.");
- if(slot == 1)
- {
- GivePlayerWeapon(playerid, vInfo[veh][StoredSlot1], vInfo[veh][StoredSlot1Ammo]);
- format(string, sizeof(string), "{8EB2D6}[INFO]{FFFFFF}: You have taken your %s (%d) from trunk slot %d.", gunname, vInfo[veh][StoredSlot1], slot);
- vInfo[veh][StoredSlot1] = 0;
- vInfo[veh][StoredSlot1Ammo] = 0;
- }
- else if(slot == 2)
- {
- GivePlayerWeapon(playerid, vInfo[veh][StoredSlot2], vInfo[veh][StoredSlot2Ammo]);
- format(string, sizeof(string), "{8EB2D6}[INFO]{FFFFFF}: You have taken your %s (%d) from trunk slot %d.", gunname2, vInfo[veh][StoredSlot2], slot);
- vInfo[veh][StoredSlot2] = 0;
- vInfo[veh][StoredSlot2Ammo] = 0;
- }
- // START DUPLICATION BUG FIX //
- SetPlayerPos(playerid, pos[0], pos[1], pos[2] +1);
- SetTimerEx("FixDuplicationBug", 100, false, "ii", playerid, veh);
- // END DUPLICATION BUG FIX //
- SendClientMessage(playerid, -1, string);
- SaveVehicles();
- return true;
- }
- CMD:vpark(playerid, params[])
- {
- new Float: pos[4];
- if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You need to be in a vehicle in order to do this command!");
- if(pInfo[playerid][CarOwner] == GetPlayerVehicleID(playerid))
- {
- GetVehiclePos(GetPlayerVehicleID(playerid), pos[0], pos[1], pos[2]);
- GetVehicleZAngle(GetPlayerVehicleID(playerid), pos[3]);
- vInfo[pInfo[playerid][CarOwner]][xPos] = pos[0];
- vInfo[pInfo[playerid][CarOwner]][yPos] = pos[1];
- vInfo[pInfo[playerid][CarOwner]][zPos] = pos[2];
- vInfo[pInfo[playerid][CarOwner]][aPos] = pos[3];
- SaveVehicles();
- SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You have parked your vehicle!");
- }
- else return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You're not in your personal vehicle!");
- return true;
- }
- CMD:vbuy(playerid)
- {
- new count, cars[sizeof(PriceArray)];
- if(IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You can't be in a vehicle when performing this command!");
- if(pInfo[playerid][CarOwner] < 999) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You already own a vehicle!");
- if(IsPlayerInRangeOfPoint(playerid, 3.0, 1634.9066, -1865.3574, 13.5469))
- {
- for(new i; i < sizeof(PriceArray); i ++)
- {
- cars[i] = PriceArray[i][0];
- count ++;
- }
- ShowModelSelectionMenuEx(playerid, cars, count, "Dealership", mselection_Dealership, 16.0, 0.0, -55.0, 1.0, 0x333333FF, 0x474747FF, 0xE0E0E0FF);
- }
- else return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You're not near the dealership!");
- return true;
- }
- CMD:vscrap(playerid, params[])
- {
- new loc[30];
- if(IsPlayerInRangeOfPoint(playerid, 3.0, 1616.5725, -1892.7927, 13.5482))
- {
- format(loc, 30, "Vehicles/%d.ini", pInfo[playerid][CarOwner]);
- if(!fexist(loc)) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: The vehicle ID you entered doesn't exist.");
- else if(fexist(loc))
- {
- SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You have scrapped your vehicle and got back 50 percent from the market price.");
- GivePlayerMoney(playerid, vInfo[pInfo[playerid][CarOwner]][Price] / 50);
- DestroyVehicle(pInfo[playerid][CarOwner]);
- fremove(loc);
- vCount --;
- }
- }
- else return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You're not near the scrapping area!");
- return true;
- }
- CMD:vgive(playerid, params[])
- {
- new name[MAX_PLAYER_NAME], name2[MAX_PLAYER_NAME], string[30], Float: pos[3], targetid;
- if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You need to be in a vehicle in order to do this command!");
- if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: /vgive [target]");
- GetPlayerPos(targetid, pos[0], pos[1], pos[2]);
- if(IsPlayerInRangeOfPoint(playerid, 5.0, pos[0], pos[1], pos[2]))
- {
- if(pInfo[playerid][CarOwner] == GetPlayerVehicleID(playerid))
- {
- GetPlayerName(playerid, name, sizeof(name));
- GetPlayerName(targetid, name2, sizeof(name2));
- vInfo[vCount][Owner] = name2;
- format(string, sizeof(string), "8EB2D6}[INFO]{FFFFFF}: You have given your vehicle to %s!", name2);
- SendClientMessage(playerid, -1, string);
- format(string, sizeof(string), "8EB2D6}[INFO]{FFFFFF}: %s has given you their vehicle!", name);
- SendClientMessage(targetid, -1, string);
- pInfo[targetid][CarOwner] = pInfo[playerid][CarOwner];
- pInfo[playerid][CarOwner] = 9999;
- vCount ++;
- }
- else return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You're not in your personal vehicle!");
- }
- else return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You're not near the player you're trying to interact with!");
- return true;
- }
- CMD:vcreate(playerid, params[])
- {
- new Float: pos[4], name[MAX_PLAYER_NAME], model, type, price, plate = random(1000 + 2500), newveh[MAX_PLAYERS], string[30];
- GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
- GetPlayerFacingAngle(playerid, pos[3]);
- if(pInfo[playerid][Admin] < 4) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You need to be an admin in order to do this command!");
- if(sscanf(params, "iii", model, type, price)) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: /vcreate [model] [type] [price]");
- format(name, sizeof(name), "None"); // to avoid array error -- size is MAX_PLAYER_NAME, as is hOwner
- new INI:File = INI_Open(VehiclePath(vCount));
- INI_SetTag(File, "Vehicle Data");
- INI_WriteString(File, "Owner", name);
- vInfo[vCount][Owner] = name;
- INI_WriteInt(File, "Model", model);
- vInfo[vCount][Model] = model;
- INI_WriteInt(File, "Type", type);
- vInfo[vCount][Type] = type;
- INI_WriteFloat(File, "xPos", pos[0]);
- vInfo[vCount][xPos] = pos[0];
- INI_WriteFloat(File, "yPos", pos[1]);
- vInfo[vCount][yPos] = pos[1];
- INI_WriteFloat(File, "zPos", pos[2]);
- vInfo[vCount][zPos] = pos[2];
- INI_WriteFloat(File, "aPos", pos[3]);
- vInfo[vCount][aPos] = pos[3];
- INI_WriteInt(File, "Price", price);
- vInfo[vCount][Price] = price;
- INI_WriteInt(File, "Plate", plate);
- vInfo[vCount][Plate] = plate;
- INI_WriteInt(File, "Fuel", 100);
- vInfo[vCount][Fuel] = 100;
- INI_WriteInt(File, "StoredSlot1", 0);
- vInfo[vCount][StoredSlot1] = 0;
- INI_WriteInt(File, "StoredSlot1Ammo", 0);
- vInfo[vCount][StoredSlot1Ammo] = 0;
- INI_WriteInt(File, "StoredSlot2", 0);
- vInfo[vCount][StoredSlot2] = 0;
- INI_WriteInt(File, "StoredSlot2Ammo", 0);
- vInfo[vCount][StoredSlot2Ammo] = 0;
- INI_Close(File);
- format(string, sizeof(string), "SA %d", vInfo[vCount][Plate]);
- newveh[playerid] = CreateVehicle(model, pos[0], pos[1], pos[2], pos[3], 0, 0, -1);
- SetVehicleNumberPlate(newveh[playerid], string);
- SetVehicleToRespawn(newveh[playerid]);
- vCount ++;
- PutPlayerInVehicle(playerid, newveh[playerid], 0);
- SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You have created a vehicle at your position! Use /vsetvar to set it's variables!");
- return true;
- }
- CMD:vdelete(playerid, params[])
- {
- new vid, loc[30], string[80];
- if(pInfo[playerid][Admin] < 4) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You need to be an admin in order to do this command!");
- if(sscanf(params, "i", vid)) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: /vdelete [id]");
- format(loc, 30, "Vehicles/%d.ini", vid);
- if(!fexist(loc)) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: The vehicle ID you entered doesn't exist.");
- else if(fexist(loc))
- {
- format(string, sizeof(string), "{8EB2D6}[INFO]{FFFFFF}: You have deleted vehicle ID: %d.", vid);
- SendClientMessage(playerid, -1, string);
- KillTimer(FuelTimer[vid]);
- DestroyVehicle(vid);
- fremove(loc);
- }
- vCount --;
- return true;
- }
- // Faction commands
- CMD:fchat(playerid, params[])
- {
- new string[144], text[80];
- if(pInfo[playerid][FactionID] == 999) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You're not in a faction!");
- if(sscanf(params, "s[80]", text)) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: /fchat [text]");
- if(strlen(text) > 80 || strlen(text) < 1) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: Text can't be more than 80 or less than 1 character(s).");
- if(!fChat[pInfo[playerid][FactionID]]) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: Your faction has it's chat turned off!");
- format(string, sizeof(string), "{ [CHAT]: (%d) %s %s: %s }", playerid, pInfo[playerid][FactionRank], GetPlayerName(playerid), text);
- SendFactionMessage(pInfo[playerid][FactionID], string);
- print(string);
- return true;
- }
- CMD:fradio(playerid, params[])
- {
- new string[144], text[80];
- if(pInfo[playerid][FactionID] == 999) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You're not in a faction!");
- if(sscanf(params, "s[80]", text)) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: /fradio [text]");
- if(fInfo[pInfo[playerid][FactionID]][Type] == 1)
- {
- if(strlen(text) > 80 || strlen(text) < 1) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: Text can't be more than 80 or less than 1 character(s).");
- format(string, sizeof(string), "{ [RADIO]: (%d) %s %s: %s }", playerid, pInfo[playerid][FactionRank], GetPlayerName(playerid), text);
- SendFactionRadioMessage(pInfo[playerid][FactionID], string);
- print(string);
- }
- else return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: Your faction doesn't have access to this command!");
- return true;
- }
- CMD:listfactions(playerid, params[])
- {
- new string[80];
- SendClientMessage(playerid, 0x8EB2D6FF, "All factions in the server are listed below.");
- for(new i; i < MAX_FACTIONS; i ++)
- {
- format(string, sizeof(string), "[ID: %d] [%s] [Type: %d]", i, fInfo[i][Name], fInfo[i][Type]);
- SendClientMessage(playerid, 0xDEDEDEFF, string);
- }
- return true;
- }
- CMD:fset(playerid, params[])
- {
- new string[144], targetid, factionid;
- if(pInfo[playerid][Admin] < 3) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You need to be an admin in order to do this command!");
- if(sscanf(params, "ui", targetid, factionid)) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: /fset [id/name] [faction]");
- pInfo[targetid][FactionID] = factionid;
- pInfo[targetid][FactionTier] = 1;
- format(string, sizeof(string), "[FACTION] (%d) %s has just set your faction to ID (%d) %s with tier 1.", playerid, GetPlayerName(playerid), factionid, fInfo[factionid][Name]);
- SendClientMessage(playerid, 0x00E1FFFF, string);
- format(string, sizeof(string), "[FACTION] You have set (%d) %s's faction to ID (%d) %s with tier 1.", targetid, GetPlayerName(targetid), factionid, fInfo[factionid][Name]);
- SendClientMessage(playerid, 0x00E1FFFF, string);
- return true;
- }
- CMD:fsettier(playerid, params[])
- {
- new string[144], targetid, tier;
- if(pInfo[playerid][FactionID] == 999) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You're not in a faction!");
- if(pInfo[playerid][FactionTier] == 3) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You don't have the correct priviledges to do this command!");
- if(sscanf(params, "ui", targetid, tier)) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: /fsettier [id/name] [tier]");
- pInfo[targetid][FactionTier] = tier;
- format(string, sizeof(string), "[FACTION]: (%d) %s has just set (%d) %s's tier to %d.", playerid, GetPlayerName(playerid), targetid, GetPlayerName(targetid), tier);
- SendFactionMessage(pInfo[playerid][FactionID], string);
- print(string);
- return true;
- }
- CMD:fsetrank(playerid, params[])
- {
- new string[144], targetid, rank[MAX_PLAYER_NAME];
- if(pInfo[playerid][FactionID] == 999) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You're not in a faction!");
- if(pInfo[playerid][FactionTier] == 3) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You don't have the correct priviledges to do this command!");
- if(sscanf(params, "us[24]", targetid, rank)) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: /fsetrank [id/name] [rank]");
- if(strlen(rank) > 40 || strlen(rank) < 1) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: Rank can't be more than 40 or less than 1 character(s).");
- pInfo[targetid][FactionRank] = rank;
- format(string, sizeof(string), "[FACTION]: (%d) %s has just set (%d) %s's rank to %s.", playerid, GetPlayerName(playerid), targetid, GetPlayerName(targetid), rank);
- SendFactionMessage(pInfo[playerid][FactionID], string);
- print(string);
- return true;
- }
- CMD:factionhelp(playerid, params[])
- {
- SendClientMessage(playerid, 0x8EB2D6FF, "Faction commands available to you");
- SendClientMessage(playerid, -1, "{8EB2D6}[PLAYERS]{FFFFFF}: /listfactions");
- SendClientMessage(playerid, -1, "{8EB2D6}[MEMBER]{FFFFFF}: /fchat, /fradio, /fsetrank, /fsettier, /finvite, /funinvite");
- return true;
- }
- CMD:finvite(playerid, params[])
- {
- new string[144], targetid;
- if(pInfo[playerid][FactionID] == 999) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You're not in a faction!");
- if(pInfo[playerid][FactionTier] == 3) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You don't have the correct priviledges to do this command!");
- if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: /finvite [id/name]");
- pInfo[targetid][FactionID] = pInfo[playerid][FactionID];
- pInfo[targetid][FactionTier] = 3;
- format(string, sizeof(string), "[FACTION]: (%d) %s has just invited (%d) %s.", playerid, GetPlayerName(playerid), targetid, GetPlayerName(targetid));
- SendFactionMessage(pInfo[playerid][FactionID], string);
- print(string);
- return true;
- }
- CMD:funinvite(playerid, params[])
- {
- new string[144], targetid;
- if(pInfo[playerid][FactionID] == 999) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You're not in a faction!");
- if(pInfo[playerid][FactionTier] == 3) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You don't have the correct priviledges to do this command!");
- if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: /funinvite [id/name]");
- format(string, sizeof(string), "[FACTION]: (%d) %s has just uninvited (%d) %s.", playerid, GetPlayerName(playerid), targetid, GetPlayerName(targetid));
- SendFactionMessage(pInfo[playerid][FactionID], string);
- pInfo[targetid][FactionID] = 0;
- pInfo[targetid][FactionTier] = 0;
- print(string);
- return true;
- }
- CMD:fcreate(playerid, params[])
- {
- new string[110], type, name[40];
- if(pInfo[playerid][Admin] < 4) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You need to be an admin in order to do this command!");
- if(sscanf(params, "is[40]", type, name)) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: /fcreate [type] [text]");
- if(strlen(name) > 40 || strlen(name) < 1) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: Your text can't have more than 40, or less than 1 character(s)!");
- new INI:File = INI_Open(FactionPath(fCount));
- INI_SetTag(File, "Faction Data");
- INI_WriteString(File, "Name", name);
- fInfo[fCount][Name] = name;
- INI_WriteInt(File, "Type", type);
- fInfo[fCount][Type] = type;
- INI_Close(File);
- format(string, sizeof(string), "{8EB2D6}[INFO]{FFFFFF}: You added faction (ID: %d) %s with type %d.", fCount, name, type);
- SendClientMessage(playerid, -1, string);
- fCount ++;
- return true;
- }
- CMD:frename(playerid, params[])
- {
- new name[40], string[110], factionid;
- if(pInfo[playerid][Admin] < 3) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You need to be an admin in order to do this command!");
- if(sscanf(params, "is[40]", factionid, name)) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: /frename [factionid] [name]");
- if(strlen(name) > 40 || strlen(name) < 1) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: Your text can't have more than 40, or less than 1 character(s)!");
- fInfo[factionid][Name] = name;
- format(string, sizeof(string), "{8EB2D6}[INFO]{FFFFFF}: You added changed a faction ID %d's name to: %s", factionid, name);
- SendClientMessage(playerid, -1, string);
- SaveFactions();
- return true;
- }
- CMD:fsettype(playerid, params[])
- {
- new type, string[110], factionid;
- if(pInfo[playerid][Admin] < 3) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You need to be an admin in order to do this command!");
- if(sscanf(params, "is[40]", factionid, type)) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: /fsettype [factionid] [type]");
- if(type < 1 || type > 3) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: Type can't be less than one or more than four!");
- fInfo[factionid][Type] = type;
- format(string, sizeof(string), "{8EB2D6}[INFO]{FFFFFF}: You added changed a faction ID %d's type to %d.", factionid, type);
- SendClientMessage(playerid, -1, string);
- SaveFactions();
- return true;
- }
- CMD:fdelete(playerid, params[])
- {
- new id, loc[30], string[80];
- if(pInfo[playerid][Admin] < 4) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You need to be an admin in order to do this command!");
- if(sscanf(params, "i", id)) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: /fdelete [id]");
- format(loc, 30, "Factions/%d.ini", id);
- if(!fexist(loc)) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: The faction ID you entered doesn't exist.");
- else if(fexist(loc))
- {
- format(string, sizeof(string), "{8EB2D6}[INFO]{FFFFFF}: You have deleted faction ID: %d.", id);
- SendClientMessage(playerid, -1, string);
- fremove(loc);
- }
- fCount --;
- return true;
- }
- // house commands
- CMD:househelp(playerid, params[])
- {
- SendClientMessage(playerid, 0x8EB2D6FF, "House commands available to you");
- SendClientMessage(playerid, -1, "{8EB2D6}[OWNED]{FFFFFF}: /hnear, /hbuy, /hsell, /haccess, /hlock");
- return true;
- }
- CMD:hcreate(playerid, params[])
- {
- new Float: pos[3], string[100], str2[MAX_PLAYER_NAME], price;
- GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
- if(pInfo[playerid][Admin] < 4) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You need to be an admin in order to do this command!");
- if(sscanf(params, "i", price)) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: /hcreate [price]");
- format(str2, sizeof(str2), "None"); // to avoid array error -- size is MAX_PLAYER_NAME, as is "Owner"
- new INI:File = INI_Open(HousePath(hCount));
- INI_SetTag(File, "House Data");
- INI_WriteString(File, "Owner", str2);
- hInfo[hCount][Owner] = str2;
- INI_WriteInt(File, "Price", price);
- hInfo[hCount][Price] = price;
- INI_WriteInt(File, "Bought", 0);
- hInfo[hCount][Bought] = 0;
- INI_WriteFloat(File, "ExtX", pos[0]);
- hInfo[hCount][ExtX] = pos[0];
- INI_WriteFloat(File, "ExtY", pos[1]);
- hInfo[hCount][ExtY] = pos[1];
- INI_WriteFloat(File, "ExtZ", pos[2]);
- hInfo[hCount][ExtZ] = pos[2];
- INI_WriteFloat(File, "IntX", 0.0);
- hInfo[hCount][IntX] = 0.0;
- INI_WriteFloat(File, "IntY", 0.0);
- hInfo[hCount][IntX] = 0.0;
- INI_WriteFloat(File, "IntZ", 0.0);
- hInfo[hCount][IntX] = 0.0;
- INI_WriteInt(File, "IntWorld", 2);
- hInfo[hCount][IntInterior] = 2;
- INI_WriteInt(File, "IntVW", 0);
- hInfo[hCount][IntVirtualW] = random(250);
- INI_WriteInt(File, "VW", GetPlayerVirtualWorld(playerid));
- hInfo[hCount][World] = GetPlayerVirtualWorld(playerid);
- INI_WriteInt(File, "World", GetPlayerInterior(playerid));
- hInfo[hCount][Interior] = GetPlayerInterior(playerid);
- INI_WriteInt(File, "Locked", 0);
- hInfo[hCount][Locked] = 0;
- INI_WriteInt(File, "Initialised", 0);
- hInfo[hCount][Initialised] = 0;
- INI_Close(File);
- format(string, sizeof(string), "{8EB2D6}[HOUSE]{FFFFFF}\nOwner: %s\nPrice: %d", hInfo[hCount][Owner], hInfo[hCount][Price]);
- hInfo[hCount][Label] = Create3DTextLabel(string, 0xFFFFFFFF, pos[0], pos[1], pos[2], 10.0, GetPlayerVirtualWorld(playerid), 1);
- hCount ++;
- SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You have created a house at your position! Use /hsetint to set it's interior!");
- return true;
- }
- CMD:hdelete(playerid, params[])
- {
- new hid, loc[30], string[80];
- if(pInfo[playerid][Admin] < 4) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You need to be an admin in order to do this command!");
- if(sscanf(params, "i", hid)) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: /hdelete [hid]");
- format(loc, 30, "Houses/%d.ini", hid);
- if(!fexist(loc)) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: The house ID you entered doesn't exist.");
- else if(fexist(loc))
- {
- format(string, sizeof(string), "{8EB2D6}[INFO]{FFFFFF}: You have deleted house ID: %d", hid);
- SendClientMessage(playerid, -1, string);
- Delete3DTextLabel(hInfo[hid][Label]);
- fremove(loc);
- }
- return true;
- }
- CMD:hsetint(playerid, params[])
- {
- new interior, hid, string[80];
- if(sscanf(params, "ii", hid, interior)) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: /hsetint [house] [interior]");
- if(interior < 1 && interior > 25) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: No more than 25 and no less than 1!");
- if(interior == 1)
- {
- hInfo[hid][IntX] = 2269.7295;
- hInfo[hid][IntY] = -1210.5497;
- hInfo[hid][IntZ] = 1047.5625;
- hInfo[hid][IntInterior] = 10;
- }
- if(interior == 2)
- {
- hInfo[hid][IntX] = 225.756989;
- hInfo[hid][IntY] = 1240.00;
- hInfo[hid][IntZ] = 1082.149902;
- hInfo[hid][IntInterior] = 2;
- }
- if(interior == 3)
- {
- hInfo[hid][IntX] = 223.1570;
- hInfo[hid][IntY] = 1287.4241;
- hInfo[hid][IntZ] = 1082.1406;
- hInfo[hid][IntInterior] = 1;
- }
- if(interior == 4)
- {
- hInfo[hid][IntX] = 225.630997;
- hInfo[hid][IntY] = 1022.479980;
- hInfo[hid][IntZ] = 1084.069946;
- hInfo[hid][IntInterior] = 7;
- }
- if(interior == 5)
- {
- hInfo[hid][IntX] = 295.1188;
- hInfo[hid][IntY] = 1472.8026;
- hInfo[hid][IntZ] = 1080.2578;
- hInfo[hid][IntInterior] = 15;
- }
- if(interior == 6)
- {
- hInfo[hid][IntX] = 327.9907;
- hInfo[hid][IntY] = 1477.7258;
- hInfo[hid][IntZ] = 1084.4375;
- hInfo[hid][IntInterior] = 15;
- }
- if(interior == 7)
- {
- hInfo[hid][IntX] = 386.9067;
- hInfo[hid][IntY] = 1471.7839;
- hInfo[hid][IntZ] = 1080.1875;
- hInfo[hid][IntInterior] = 15;
- }
- format(string, sizeof(string), "{8EB2D6}[INFO]{FFFFFF}: Set house ID %d's interior to ID %d.", hid, interior);
- SendClientMessage(playerid, -1, string);
- hInfo[hid][Initialised] = 1;
- SaveHouses();
- return true;
- }
- CMD:hgoto(playerid, params[])
- {
- new hid, string[50];
- if(pInfo[playerid][Admin] < 3) return SendClientMessage(playerid, -1, "You need to be an admin in order to do this command!");
- if(sscanf(params, "i", hid)) return SendClientMessage(playerid, -1, "/hgoto [hid]");
- format(string, sizeof(string), "You teleported to house ID %d", hid);
- SendClientMessage(playerid, -1, string);
- SetPlayerPos(playerid, hInfo[hid][ExtX], hInfo[hid][ExtY], hInfo[hid][ExtZ]);
- return true;
- }
- CMD:hmove(playerid, params[])
- {
- new hid, string[50], Float: pos[3], hlabel[100];
- GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
- if(pInfo[playerid][Admin] < 3) return SendClientMessage(playerid, -1, "You need to be an admin in order to do this command!");
- if(sscanf(params, "i", hid)) return SendClientMessage(playerid, -1, "/hmove [hid]");
- format(string, sizeof(string), "You teleported to house ID %d", hid);
- SendClientMessage(playerid, -1, string);
- hInfo[hid][ExtX] = pos[0];
- hInfo[hid][ExtY] = pos[1];
- hInfo[hid][ExtZ] = pos[2];
- if(hInfo[hid][Bought] == 0) format(hlabel, sizeof(hlabel), "{8EB2D6}[HOUSE]{FFFFFF}\nOwner: %s\nPrice: %d", hInfo[hid][Owner], hInfo[hid][Price]);
- else if(hInfo[hid][Bought] == 1) format(hlabel, sizeof(hlabel), "{8EB2D6}[HOUSE]{FFFFFF}\nOwner: %s", hInfo[hid][Owner]);
- Delete3DTextLabel(hInfo[hid][Label]);
- hInfo[hid][Label] = Create3DTextLabel(hlabel, 0xFFFFFF, pos[0], pos[1], pos[2], 15.0, hInfo[hid][World], 1);
- SaveHouses();
- return true;
- }
- CMD:hnear(playerid, params[])
- {
- new string[30];
- format(string, sizeof(string), "{8EB2D6}[INFO]{FFFFFF}: You're not near a house entrance!");
- for(new i; i < MAX_HOUSES; i ++)
- {
- if(IsPlayerInRangeOfPoint(playerid, 2.0, hInfo[i][ExtX], hInfo[i][ExtY], hInfo[i][ExtZ]))
- {
- format(string, sizeof(string), "{8EB2D6}[INFO]{FFFFFF}: You're near house ID %d", i);
- }
- }
- SendClientMessage(playerid, -1, string);
- return true;
- }
- CMD:hbuy(playerid, params[])
- {
- new string[80], name[MAX_PLAYER_NAME];
- GetPlayerName(playerid, name, sizeof(name));
- format(string, sizeof(string), "{8EB2D6}[INFO]{FFFFFF}: You're not near a house entrance!");
- for(new i; i < MAX_HOUSES; i ++)
- {
- if(IsPlayerInRangeOfPoint(playerid, 2.0, hInfo[i][ExtX], hInfo[i][ExtY], hInfo[i][ExtZ]))
- {
- if(hInfo[i][Bought] == 0)
- {
- if(GetPlayerMoney(playerid) >= hInfo[i][Price])
- {
- GivePlayerMoney(playerid, - hInfo[i][Price]);
- pInfo[playerid][HouseOwner] = i;
- hInfo[i][Owner] = name;
- hInfo[i][Bought] = 1;
- format(string, sizeof(string), "{8EB2D6}[HOUSE]{FFFFFF}\nOwner: %s", hInfo[i][Owner]);
- Update3DTextLabelText(hInfo[i][Label], 0xFFFFFF, string);
- format(string, sizeof(string), "{8EB2D6}[INFO]{FFFFFF}: You have purchased house ID %d for %d!", i, hInfo[i][Price]);
- break;
- }
- else return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You don't have enough money!");
- }
- else return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: This house is not for sale!");
- }
- }
- SendClientMessage(playerid, -1, string);
- return true;
- }
- CMD:hsell(playerid, params[])
- {
- new string[80], name[MAX_PLAYER_NAME];
- GetPlayerName(playerid, name, sizeof(name));
- format(string, sizeof(string), "{8EB2D6}[INFO]{FFFFFF}: You're not near a house entrance!");
- format(name, sizeof(name), "None");
- for(new i; i < MAX_HOUSES; i ++)
- {
- if(IsPlayerInRangeOfPoint(playerid, 2.0, hInfo[i][ExtX], hInfo[i][ExtY], hInfo[i][ExtZ]))
- {
- if(pInfo[playerid][HouseOwner] == i)
- {
- if(GetPlayerMoney(playerid) >= hInfo[i][Price])
- {
- GivePlayerMoney(playerid, hInfo[i][Price]);
- pInfo[playerid][HouseOwner] = 0;
- hInfo[i][Owner] = name;
- hInfo[i][Bought] = 0;
- format(string, sizeof(string), "{8EB2D6}[HOUSE]{FFFFFF}\nOwner: %s\nPrice: %d", hInfo[i][Owner], hInfo[i][Price]);
- Update3DTextLabelText(hInfo[i][Label], 0xFFFFFF, string);
- format(string, sizeof(string), "{8EB2D6}[INFO]{FFFFFF}: You have sold house ID %d for %d!", i, hInfo[i][Price]);
- break;
- }
- else return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You don't have enough money!");
- }
- else return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You don't own this house!");
- }
- }
- SendClientMessage(playerid, -1, string);
- return true;
- }
- CMD:hlock(playerid, params[])
- {
- new string[80];
- format(string, sizeof(string), "{8EB2D6}[INFO]{FFFFFF}: You're not near a house entrance!");
- for(new i; i < MAX_HOUSES; i ++)
- {
- if(IsPlayerInRangeOfPoint(playerid, 2.0, hInfo[i][ExtX], hInfo[i][ExtY], hInfo[i][ExtZ]))
- {
- if(pInfo[playerid][HouseOwner] == i)
- {
- if(hInfo[playerid][Locked] == 1)
- {
- hInfo[playerid][Locked] = 0;
- format(string, sizeof(string), "{8EB2D6}[INFO]{FFFFFF}: You have unlocked your house!");
- }
- else if(hInfo[playerid][Locked] == 0)
- {
- hInfo[playerid][Locked] = 1;
- format(string, sizeof(string), "{8EB2D6}[INFO]{FFFFFF}: You have locked your house!");
- }
- SaveHouses();
- break;
- }
- else return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You don't own this house!");
- }
- }
- SendClientMessage(playerid, -1, string);
- return true;
- }
- CMD:haccess(playerid, params[])
- {
- new string[100];
- format(string, sizeof(string), "{8EB2D6}[INFO]{FFFFFF}: You're not near a house entrance or exit!");
- for(new i; i < MAX_HOUSES; i ++)
- {
- if(hInfo[i][Locked] == 0)
- {
- if(hInfo[i][Initialised] == 1)
- {
- if(IsPlayerInRangeOfPoint(playerid, 2.0, hInfo[i][ExtX], hInfo[i][ExtY], hInfo[i][ExtZ]))
- {
- SetPlayerPos(playerid, hInfo[i][IntX], hInfo[i][IntY], hInfo[i][IntZ]);
- SetPlayerInterior(playerid, hInfo[i][IntInterior]);
- SetPlayerVirtualWorld(playerid, hInfo[i][IntVirtualW]);
- format(string, sizeof(string), "{8EB2D6}[INFO]{FFFFFF}: You entered house ID %d.", i);
- break;
- }
- else if(IsPlayerInRangeOfPoint(playerid, 2.0, hInfo[i][IntX], hInfo[i][IntY], hInfo[i][IntZ]) && GetPlayerVirtualWorld(playerid) == hInfo[i][IntVirtualW])
- {
- SetPlayerPos(playerid, hInfo[i][ExtX], hInfo[i][ExtY], hInfo[i][ExtZ]);
- SetPlayerInterior(playerid, hInfo[i][Interior]);
- SetPlayerVirtualWorld(playerid, hInfo[i][World]);
- format(string, sizeof(string), "{8EB2D6}[INFO]{FFFFFF}: You left house ID %d.", i);
- break;
- }
- }
- }
- else format(string, sizeof(string), "{8EB2D6}[INFO]{FFFFFF}: The house you're trying to enter is locked!");
- }
- SendClientMessage(playerid, -1, string);
- return true;
- }
- // Label Commands
- CMD:labelcreate(playerid, params[])
- {
- new Float: pos[3], string[110], type, text[40], Float: rad;
- GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
- if(pInfo[playerid][Admin] < 4) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You need to be an admin in order to do this command!");
- if(sscanf(params, "is[40]f", type, text, rad)) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: /labelcreate [type] [text] [radius]");
- if(strlen(text) > 40 || strlen(text) < 1) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: Your text can't have more than 40, or less than 1 character(s)!");
- new INI:File = INI_Open(LabelPath(lCount));
- INI_SetTag(File, "Label Data");
- INI_WriteString(File, "Text", text);
- lInfo[lCount][Text] = text;
- INI_WriteInt(File, "Type", type);
- lInfo[lCount][Type] = type;
- INI_WriteFloat(File, "xPos", pos[0]);
- lInfo[lCount][xPos] = pos[0];
- INI_WriteFloat(File, "yPos", pos[1]);
- lInfo[lCount][yPos] = pos[1];
- INI_WriteFloat(File, "zPos", pos[2]);
- lInfo[lCount][zPos] = pos[2];
- INI_WriteFloat(File, "Radius", rad);
- lInfo[lCount][Radius] = rad;
- INI_WriteInt(File, "VirtualWorld", GetPlayerVirtualWorld(playerid));
- lInfo[lCount][VirtualWorld] = GetPlayerVirtualWorld(playerid);
- INI_Close(File);
- format(string, sizeof(string), "{8EB2D6}[INFO]{FFFFFF}: You added label %d with the following text: %s", lCount, text);
- SendClientMessage(playerid, -1, string);
- Holder[lCount] = Create3DTextLabel(text, 0xFFFFFFFF, pos[0], pos[1], pos[2], rad, GetPlayerVirtualWorld(playerid), 0);
- lCount ++;
- return true;
- }
- CMD:labelrename(playerid, params[])
- {
- new text[40], string[110], labelid;
- if(pInfo[playerid][Admin] < 3) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You need to be an admin in order to do this command!");
- if(sscanf(params, "is[40]", labelid, text)) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: /labelrename [labelid] [text]");
- if(strlen(text) > 40 || strlen(text) < 1) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: Your text can't have more than 40, or less than 1 character(s)!");
- lInfo[labelid][Text] = text;
- Update3DTextLabelText(Holder[labelid], 0xFFFFFFFF, text);
- format(string, sizeof(string), "{8EB2D6}[INFO]{FFFFFF}: You added changed a label ID %d's text to: %s", labelid, text);
- SendClientMessage(playerid, -1, string);
- SaveLabels();
- return true;
- }
- CMD:labelmove(playerid, params[])
- {
- new labelid, Float: pos[3];
- GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
- if(pInfo[playerid][Admin] < 3) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You need to be an admin in order to do this command!");
- if(sscanf(params, "i", labelid)) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: /labelmove [labelid]");
- Delete3DTextLabel(Holder[labelid]);
- Holder[labelid] = Create3DTextLabel(lInfo[labelid][Text], 0xFFFFFFFF, pos[0], pos[1], pos[2], lInfo[labelid][Radius], lInfo[labelid][VirtualWorld], 0);
- lInfo[labelid][xPos] = pos[0];
- lInfo[labelid][yPos] = pos[1];
- lInfo[labelid][zPos] = pos[2];
- SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You have just moved a label to your position..");
- SaveLabels();
- return true;
- }
- CMD:labeldelete(playerid, params[])
- {
- new id, loc[30], string[80];
- if(pInfo[playerid][Admin] < 4) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You need to be an admin in order to do this command!");
- if(sscanf(params, "i", id)) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: /labeldelete [id]");
- format(loc, 30, "Labels/%d.ini", id);
- if(!fexist(loc)) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: The label ID you entered doesn't exist.");
- else if(fexist(loc))
- {
- format(string, sizeof(string), "{8EB2D6}[INFO]{FFFFFF}: You have deleted label ID: %d", id);
- SendClientMessage(playerid, -1, string);
- Delete3DTextLabel(Holder[id]);
- fremove(loc);
- }
- lCount --;
- return true;
- }
- stock LoadVehicleSpeedoTextdraws(playerid)
- {
- vSpeedTD[playerid] = CreatePlayerTextDraw(playerid, 548.999694, 417.303710, "100");
- PlayerTextDrawLetterSize(playerid, vSpeedTD[playerid], 0.449999, 1.600000);
- PlayerTextDrawColor(playerid, vSpeedTD[playerid], -1);
- PlayerTextDrawFont(playerid, vSpeedTD[playerid], 2);
- PlayerTextDrawSetShadow(playerid, vSpeedTD[playerid], 0);
- PlayerTextDrawSetOutline(playerid, vSpeedTD[playerid], 0);
- vSpeedTDText[playerid] = CreatePlayerTextDraw(playerid, 582.000061, 420.622009, "KM/H");
- PlayerTextDrawLetterSize(playerid, vSpeedTDText[playerid], 0.269333, 1.040000);
- PlayerTextDrawColor(playerid, vSpeedTDText[playerid], -1);
- PlayerTextDrawFont(playerid, vSpeedTDText[playerid], 1);
- PlayerTextDrawSetShadow(playerid, vSpeedTDText[playerid], 0);
- PlayerTextDrawSetOutline(playerid, vSpeedTDText[playerid], 0);
- vFuelTD[playerid] = CreatePlayerTextDraw(playerid, 548.333251, 405.688964, "100");
- PlayerTextDrawLetterSize(playerid, vFuelTD[playerid], 0.449999, 1.600000);
- PlayerTextDrawColor(playerid, vFuelTD[playerid], -1);
- PlayerTextDrawFont(playerid, vFuelTD[playerid], 2);
- PlayerTextDrawSetShadow(playerid, vFuelTD[playerid], 0);
- PlayerTextDrawSetOutline(playerid, vFuelTD[playerid], 0);
- vFuelTDText[playerid] = CreatePlayerTextDraw(playerid, 580.333190, 407.763122, "FUEL");
- PlayerTextDrawLetterSize(playerid, vFuelTDText[playerid], 0.333666, 1.197629);
- PlayerTextDrawColor(playerid, vFuelTDText[playerid], -1);
- PlayerTextDrawFont(playerid, vFuelTDText[playerid], 1);
- PlayerTextDrawSetShadow(playerid, vFuelTDText[playerid], 0);
- PlayerTextDrawSetOutline(playerid, vFuelTDText[playerid], 0);
- return true;
- }
- forward LoadLabelData(l, name[], value[]);
- public LoadLabelData(l, name[], value[])
- {
- INI_String("Text", lInfo[l][Text], MAX_PLAYER_NAME);
- INI_Int("Type", lInfo[l][Type]);
- INI_Float("xPos", lInfo[l][xPos]);
- INI_Float("yPos", lInfo[l][yPos]);
- INI_Float("zPos", lInfo[l][zPos]);
- INI_Float("Radius", lInfo[l][Radius]);
- INI_Int("VirtualWorld", lInfo[l][VirtualWorld]);
- return true;
- }
- stock LabelPath(labelid)
- {
- new label[64];
- format(label, 30, "Labels/%d.ini", labelid);
- lInfo[labelid][ID] ++; // multiplying
- return label;
- }
- stock SaveLabels()
- {
- new file[64];
- for(new l; l < MAX_LABELS; l ++)
- {
- format(file, sizeof(file), "Labels/%d.ini", l);
- if(fexist(file))
- {
- new INI:File = INI_Open(file);
- INI_SetTag(File, "Label Data");
- INI_WriteString(File, "Text", lInfo[l][Text]);
- INI_WriteInt(File, "Type", lInfo[l][Type]);
- INI_WriteFloat(File, "xPos", lInfo[l][xPos]);
- INI_WriteFloat(File, "yPos", lInfo[l][yPos]);
- INI_WriteFloat(File, "zPos", lInfo[l][zPos]);
- INI_WriteFloat(File, "Radius", lInfo[l][Radius]);
- INI_WriteInt(File, "VirtualWorld", lInfo[l][VirtualWorld]);
- INI_Close(File);
- }
- }
- return true;
- }
- stock LoadLabels()
- {
- new string[80], file[64];
- print("=-=-=-=-=-=-=-=-=-=-=-=-=");
- print(" Loading 3D Text Labels: \n");
- for(new l; l < MAX_LABELS; l ++)
- {
- format(file, sizeof(file), "Labels/%d.ini", l);
- if(fexist(file))
- {
- INI_ParseFile(LabelPath(l), "LoadLabelData", false, true, l, true, false);
- format(string, sizeof(string), "[ID: %d] %s", l, lInfo[l][Text]);
- Holder[lCount] = Create3DTextLabel(string, 0xFFFFFFFF, lInfo[l][xPos], lInfo[l][yPos], lInfo[l][zPos], lInfo[l][Radius], lInfo[l][VirtualWorld], 0);
- format(string, sizeof(string), " Loaded label ID: %d at %f %f %f", l, lInfo[l][xPos], lInfo[l][yPos], lInfo[l][zPos]);
- print(string);
- lCount ++;
- }
- }
- printf("\n %d labels loaded!", lCount);
- print("=-=-=-=-=-=-=-=-=-=-=-=-=");
- return true;
- }
- stock HousePath(houseid)
- {
- new house[64];
- format(house, 30, "Houses/%d.ini", houseid);
- hInfo[houseid][ID] ++; // multiplying
- return house;
- }
- forward LoadHouseData(h, name[], value[]);
- public LoadHouseData(h, name[], value[])
- {
- INI_String("Owner", hInfo[h][Owner], MAX_PLAYER_NAME);
- INI_Int("Price", hInfo[h][Price]);
- INI_Int("Bought", hInfo[h][Bought]);
- INI_Float("ExtX", hInfo[h][ExtX]);
- INI_Float("ExtY", hInfo[h][ExtY]);
- INI_Float("ExtZ", hInfo[h][ExtZ]);
- INI_Float("IntX", hInfo[h][IntX]);
- INI_Float("IntY", hInfo[h][IntY]);
- INI_Float("IntZ", hInfo[h][IntZ]);
- INI_Int("IntWorld", hInfo[h][IntInterior]);
- INI_Int("IntVW", hInfo[h][IntVirtualW]);
- INI_Int("VW", hInfo[h][World]);
- INI_Int("World", hInfo[h][Interior]);
- INI_Int("Locked", hInfo[h][Locked]);
- INI_Int("Initialised", hInfo[h][Initialised]);
- return true;
- }
- stock SaveHouses()
- {
- new file[64];
- for(new h; h < MAX_HOUSES; h++)
- {
- format(file, sizeof(file), "Houses/%d.ini", h);
- if(fexist(file))
- {
- new INI:File = INI_Open(file);
- INI_SetTag(File, "House Data");
- INI_WriteString(File, "Owner", hInfo[h][Owner]);
- INI_WriteInt(File, "Price", hInfo[h][Price]);
- INI_WriteInt(File, "Bought", hInfo[h][Bought]);
- INI_WriteFloat(File, "ExtX", hInfo[h][ExtX]);
- INI_WriteFloat(File, "ExtY", hInfo[h][ExtY]);
- INI_WriteFloat(File, "ExtZ", hInfo[h][ExtZ]);
- INI_WriteFloat(File, "IntX", hInfo[h][IntX]);
- INI_WriteFloat(File, "IntY", hInfo[h][IntY]);
- INI_WriteFloat(File, "IntZ", hInfo[h][IntZ]);
- INI_WriteInt(File, "IntVW", hInfo[h][IntVirtualW]);
- INI_WriteInt(File, "IntWorld", hInfo[h][IntInterior]);
- INI_WriteInt(File, "VW", hInfo[h][World]);
- INI_WriteInt(File, "World", hInfo[h][Interior]);
- INI_WriteInt(File, "Locked", hInfo[h][Locked]);
- INI_WriteInt(File, "Initialised", hInfo[h][Initialised]);
- INI_Close(File);
- }
- }
- return true;
- }
- stock LoadHouses()
- {
- new hlabel[128], file[64];
- print("=-=-=-=-=-=-=-=-=-=-=-=-=");
- print("\n Loading Houses: \n");
- for(new h; h < MAX_HOUSES; h++)
- {
- format(file, sizeof(file), "Houses/%d.ini", h);
- if(fexist(file))
- {
- INI_ParseFile(HousePath(h), "LoadHouseData", false, true, h, true, false);
- if(hInfo[h][Bought] == 0) format(hlabel, sizeof(hlabel), "{8EB2D6}[HOUSE]{FFFFFF}\nOwner: %s\nPrice: %d", hInfo[h][Owner], hInfo[h][Price]);
- else if(hInfo[h][Bought] == 1) format(hlabel, sizeof(hlabel), "{8EB2D6}[HOUSE]{FFFFFF}\nOwner: %s", hInfo[h][Owner]);
- hInfo[h][Label] = Create3DTextLabel(hlabel, 0xFFFFFF, hInfo[h][ExtX], hInfo[h][ExtY], hInfo[h][ExtZ], 15.0, hInfo[h][World], 1);
- format(hlabel, sizeof(hlabel), " Loaded house ID: %d at %f %f %f", h, hInfo[h][ExtX], hInfo[h][ExtY], hInfo[h][ExtZ]);
- print(hlabel);
- hCount ++;
- }
- }
- printf("\n %d houses loaded!", hCount);
- print("=-=-=-=-=-=-=-=-=-=-=-=-=");
- return true;
- }
- forward LoadFactionData(f, name[], value[]);
- public LoadFactionData(f, name[], value[])
- {
- INI_String("Name", fInfo[f][Name], 40);
- INI_Int("Type", fInfo[f][Type]);
- return true;
- }
- stock SendFactionMessage(factionid, text[])
- {
- for(new i; i < GetMaxPlayers(); i ++)
- {
- if(pInfo[i][FactionID] == factionid)
- {
- SendClientMessage(i, 0x52BAE3FF, text);
- }
- }
- return true;
- }
- stock SendFactionRadioMessage(factionid, text[])
- {
- for(new i; i < GetMaxPlayers(); i ++)
- {
- if(pInfo[i][FactionID] == factionid)
- {
- SendClientMessage(i, 0xE37B52FF, text);
- }
- }
- return true;
- }
- stock FactionPath(factionid)
- {
- new faction[64];
- format(faction, 30, "Factions/%d.ini", factionid);
- fInfo[factionid][ID] ++; // multiplying
- return faction;
- }
- stock SaveFactions()
- {
- new file[64];
- for(new f; f < MAX_FACTIONS; f ++)
- {
- format(file, sizeof(file), "Factions/%d.ini", f);
- if(fexist(file))
- {
- new INI:File = INI_Open(file);
- INI_SetTag(File, "Faction Data");
- INI_WriteString(File, "Name", fInfo[f][Name]);
- INI_WriteInt(File, "Type", fInfo[f][Type]);
- INI_Close(File);
- }
- }
- return true;
- }
- stock LoadFactions()
- {
- new string[80], file[64];
- print("=-=-=-=-=-=-=-=-=-=-=-=-=");
- print("\n Loading Factions: \n");
- for(new f; f < MAX_FACTIONS; f ++)
- {
- format(file, sizeof(file), "Factions/%d.ini", f);
- if(fexist(file))
- {
- INI_ParseFile(FactionPath(f), "LoadFactionData", false, true, f, true, false);
- format(string, sizeof(string), " Loaded faction: (%d) %s with type: %d", f, fInfo[f][Name], fInfo[f][Type]);
- print(string);
- fCount ++;
- }
- }
- printf("\n %d factions loaded!", fCount);
- print("=-=-=-=-=-=-=-=-=-=-=-=-=");
- return true;
- }
- forward LoadVehicleData(v, name[], value[]);
- public LoadVehicleData(v, name[], value[])
- {
- INI_String("Owner", vInfo[v][Owner], MAX_PLAYER_NAME);
- INI_Int("Type", vInfo[v][Type]);
- INI_Int("Model", vInfo[v][Model]);
- INI_Float("xPos", vInfo[v][xPos]);
- INI_Float("yPos", vInfo[v][yPos]);
- INI_Float("zPos", vInfo[v][zPos]);
- INI_Float("aPos", vInfo[v][aPos]);
- INI_Int("Faction", vInfo[v][Faction]);
- INI_Int("Price", vInfo[v][Price]);
- INI_Int("Plate", vInfo[v][Plate]);
- INI_Int("Fuel", vInfo[v][Fuel]);
- INI_Int("StoredSlot1", vInfo[v][StoredSlot1]);
- INI_Int("StoredSlot1Ammo", vInfo[v][StoredSlot1Ammo]);
- INI_Int("StoredSlot2", vInfo[v][StoredSlot2]);
- INI_Int("StoredSlot2Ammo", vInfo[v][StoredSlot2Ammo]);
- return true;
- }
- stock AddPlayerVehicle(playerid, modelid, price)
- {
- new name[MAX_PLAYER_NAME], plate = random(1000 + 2500), string[30], engine, lights, alarm, doors, bonnet, boot, objective;
- GetVehicleParamsEx(pBuyingCar[playerid], engine, lights, alarm, doors, bonnet, boot, objective);
- GetPlayerName(playerid, name, sizeof(name));
- new INI:File = INI_Open(VehiclePath(vCount));
- INI_SetTag(File, "Vehicle Data");
- INI_WriteString(File, "Owner", name);
- vInfo[vCount][Owner] = name;
- INI_WriteInt(File, "Model", modelid);
- vInfo[vCount][Model] = modelid;
- INI_WriteInt(File, "Type", 0);
- vInfo[vCount][Type] = 0;
- INI_WriteFloat(File, "xPos", 1645.6632);
- vInfo[vCount][xPos] = 1645.6632;
- INI_WriteFloat(File, "yPos", -1834.9017);
- vInfo[vCount][yPos] = -1834.9017;
- INI_WriteFloat(File, "zPos", 13.5477);
- vInfo[vCount][zPos] = 13.5477;
- INI_WriteFloat(File, "aPos", 77.1374);
- vInfo[vCount][aPos] = 77.1374;
- INI_WriteInt(File, "Price", price);
- vInfo[vCount][Price] = price;
- INI_WriteInt(File, "Faction", 0);
- vInfo[vCount][Faction] = 0;
- INI_WriteInt(File, "Plate", plate);
- vInfo[vCount][Plate] = plate;
- INI_WriteInt(File, "Fuel", 100);
- vInfo[vCount][Fuel] = 100;
- INI_WriteInt(File, "StoredSlot1", 0);
- vInfo[vCount][StoredSlot1] = 0;
- INI_WriteInt(File, "StoredSlot1Ammo", 0);
- vInfo[vCount][StoredSlot1] = 0;
- INI_WriteInt(File, "StoredSlot2", 0);
- vInfo[vCount][StoredSlot2] = 0;
- INI_WriteInt(File, "StoredSlot2Ammo", 0);
- vInfo[vCount][StoredSlot2] = 0;
- INI_Close(File);
- format(string, sizeof(string), "SA %d", vInfo[vCount][Plate]);
- SetVehicleNumberPlate(pBuyingCar[playerid], string);
- SetVehicleToRespawn(pBuyingCar[playerid]);
- SetVehiclePos(pBuyingCar[playerid], 1645.6632, -1834.9017, 13.5477);
- SetVehicleZAngle(pBuyingCar[playerid], 77.1374);
- pInfo[playerid][CarOwner] = vCount;
- vEngine[vCount] = false;
- SetVehicleParamsEx(vCount, 0, lights, alarm, 1, bonnet, boot, objective);
- vCount ++;
- return true;
- }
- stock VehiclePath(vehicleid)
- {
- new vehicle[64];
- format(vehicle, 30, "Vehicles/%d.ini", vehicleid);
- vInfo[vehicleid][ID] ++; // multiplying
- return vehicle;
- }
- stock SaveVehicles()
- {
- new file[64];
- for(new v; v < MAX_VEHICLES; v ++)
- {
- format(file, sizeof(file), "Vehicles/%d.ini", v);
- if(fexist(file))
- {
- new INI:File = INI_Open(file);
- INI_SetTag(File, "Vehicle Data");
- INI_WriteString(File, "Owner", vInfo[v][Owner]);
- INI_WriteInt(File, "Type", vInfo[v][Type]);
- INI_WriteInt(File, "Model", vInfo[v][Model]);
- INI_WriteFloat(File, "xPos", vInfo[v][xPos]);
- INI_WriteFloat(File, "yPos", vInfo[v][yPos]);
- INI_WriteFloat(File, "zPos", vInfo[v][zPos]);
- INI_WriteFloat(File, "aPos", vInfo[v][aPos]);
- INI_WriteInt(File, "Faction", vInfo[v][Faction]);
- INI_WriteInt(File, "Price", vInfo[v][Price]);
- INI_WriteInt(File, "Plate", vInfo[v][Plate]);
- INI_WriteInt(File, "Fuel", vInfo[v][Fuel]);
- INI_WriteInt(File, "StoredSlot1", vInfo[v][StoredSlot1]);
- INI_WriteInt(File, "StoredSlot1Ammo", vInfo[v][StoredSlot1Ammo]);
- INI_WriteInt(File, "StoredSlot2", vInfo[v][StoredSlot2]);
- INI_WriteInt(File, "StoredSlot2Ammo", vInfo[v][StoredSlot2Ammo]);
- INI_Close(File);
- }
- }
- return true;
- }
- stock LoadVehicles()
- {
- new string[80], file[64], engine, lights, alarm, doors, bonnet, boot, objective, corrCount;
- print("=-=-=-=-=-=-=-=-=-=-=-=-=");
- print("\n Loading Vehicles: \n");
- for(new v; v < MAX_VEHICLES; v ++)
- {
- GetVehicleParamsEx(v, engine, lights, alarm, doors, bonnet, boot, objective);
- format(file, sizeof(file), "Vehicles/%d.ini", v);
- if(fexist(file))
- {
- INI_ParseFile(VehiclePath(v), "LoadVehicleData", false, true, v, true, false);
- format(string, sizeof(string), "SA %d", vInfo[v][Plate]);
- SetVehicleNumberPlate(v, string);
- SetVehicleToRespawn(v); // respawning so the license plate shows
- SetVehicleParamsEx(v, 0, lights, alarm, 1, bonnet, boot, objective);
- vEngine[v] = false;
- vLocked[v] = true;
- format(string, sizeof(string), " Loaded vehicle ID: %d at %f %f %f", v, vInfo[v][xPos], vInfo[v][yPos], vInfo[v][zPos]);
- CreateVehicle(vInfo[v][Model], vInfo[v][xPos], vInfo[v][yPos], vInfo[v][zPos], vInfo[v][aPos], vInfo[v][ColorA], vInfo[v][ColorB], -1);
- print(string);
- vCount ++;
- }
- }
- // Since vCount requires ID 1 to function properly, we don't actually load "1" vehicle.
- corrCount = vCount - 1; // This fixes the +1 bug and shouldn't be removed.
- printf("\n %d vehicles loaded!", corrCount);
- print("=-=-=-=-=-=-=-=-=-=-=-=-=");
- return true;
- }
- stock ShowDealershipDialog(playerid, modelid)
- {
- new string[200];
- for (new i; i != sizeof (PriceArray); ++ i)
- {
- if (PriceArray[i][0] == modelid)
- {
- format(string, sizeof(string),
- "{FFFFFF}Note, you are purchasing the following:\n\n{8EB2D6}Model{FFFFFF}: %s (%d)\n{8EB2D6}Price{FFFFFF}: $%d\n\nPress ''buy'' to buy the vehicle, or ''cancel'' to go back.",
- GetVehicleName(pBuyingCar[playerid]), modelid, PriceArray[i][1]);
- TogglePlayerControllable(playerid, false);
- ShowPlayerDialog(playerid, dialog_DealershipConfirm, DIALOG_STYLE_MSGBOX, "Notice", string, "Buy", "Cancel");
- break;
- }
- }
- return true;
- }
- stock GetVehicleName(vehicleid)
- { // Credits to Tee
- new string[20];
- format(string, sizeof(string), "%s", VehicleNames[GetVehicleModel(vehicleid) - 400]);
- return string;
- }
- stock RemovePlayerWeapon(playerid, weaponid)
- {
- new plyWeapons[12], plyAmmo[12], wep, ammo;
- for(new slot = 0; slot != 12; slot++)
- {
- GetPlayerWeaponData(playerid, slot, wep, ammo);
- if(wep != weaponid)
- {
- GetPlayerWeaponData(playerid, slot, plyWeapons[slot], plyAmmo[slot]);
- }
- }
- ResetPlayerWeapons(playerid);
- for(new slot = 0; slot != 12; slot++)
- {
- GivePlayerWeapon(playerid, plyWeapons[slot], plyAmmo[slot]);
- }
- return true;
- }
- forward FixDuplicationBug(playerid, vehicleid);
- public FixDuplicationBug(playerid, vehicleid) return PutPlayerInVehicle(playerid, vehicleid, 0);
- forward FuelTimerTick(vehicleid);
- public FuelTimerTick(vehicleid)
- {
- new engine, lights, alarm, doors, bonnet, boot, objective;
- GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
- if(vInfo[vehicleid][Fuel] > 1)
- {
- vInfo[vehicleid][Fuel] --;
- }
- else if(vInfo[vehicleid][Fuel] <= 1)
- {
- SetVehicleParamsEx(vehicleid, 0, lights, alarm, doors, bonnet, boot, objective);
- for(new i; i < MAX_PLAYERS; i ++)
- {
- if(IsPlayerInVehicle(i, vehicleid) && GetPlayerVehicleSeat(i) == 0)
- {
- SendClientMessage(i, -1, "{8EB2D6}[INFO]{FFFFFF}: Your car has just ran out of fuel.");
- break;
- }
- }
- KillTimer(FuelTimer[vehicleid]);
- vEngine[vehicleid] = false;
- }
- return true;
- }
- forward FillingTimerEx(playerid, vehicleid);
- public FillingTimerEx(playerid, vehicleid)
- {
- new string[35];
- if(vInfo[vehicleid][Fuel] < 99)
- {
- format(string, sizeof(string), "~w~Refilling: ~r~ %d~w~/~g~100", vInfo[vehicleid][Fuel]);
- vInfo[vehicleid][Fuel] ++;
- }
- else if(vInfo[vehicleid][Fuel] == 100)
- {
- SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You have refilled your vehicle for $100!");
- GivePlayerMoney(playerid, -100);
- format(string, sizeof(string), "~w~Refilling: ~g~ %d~w~/~g~100", vInfo[vehicleid][Fuel]);
- TogglePlayerControllable(playerid, true);
- KillTimer(FillingTimer[playerid]);
- }
- GameTextForPlayer(playerid, string, 1000, 4);
- return true;
- }
- forward Float: GetVehicleSpeed(vehicleid);
- public Float: GetVehicleSpeed(vehicleid)
- {
- new Float:Vel[3];
- GetVehicleVelocity(vehicleid, Vel[0], Vel[1], Vel[2]);
- Vel[0] *= 175;
- Vel[1] *= 175;
- Vel[2] *= 175;
- return Float: VectorSize(Vel[0], Vel[1], Vel[2]);
- }
- stock SplitMessage(playerid, colorA, colorB, colorC, colorD, text[])
- {
- if(strlen(text) <= 118) return SendClientMessage(playerid, colorA, text);
- if(strlen(text) >= 100 && strlen(text) <= 125)
- {
- new texts[61]; // second part of text
- strmid(texts, text, 119, 132), strins(text, " ..", 118, 3), strdel(text, 121, 129);
- SendNearbyMessage(playerid, colorA, colorB, colorC, colorD, text);
- SendNearbyMessage(playerid, colorA, colorB, colorC, colorD, texts);
- }
- else if(strlen(text) >= 125) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: Your message is too long! (1-125)");
- return true;
- }
- stock SendNearbyMessage(playerid, colorA, colorB, colorC, colorD, text[])
- {
- new Float: tsPos[3];
- GetPlayerPos(playerid, tsPos[0], tsPos[1], tsPos[2]);
- for(new i; i < MAX_PLAYERS; i ++)
- {
- if(IsPlayerInRangeOfPoint(i, 1.0, tsPos[0], tsPos[1], tsPos[2])) SendClientMessage(i, colorA, text);
- else if(IsPlayerInRangeOfPoint(i, 2.0, tsPos[0], tsPos[1], tsPos[2])) SendClientMessage(i, colorB, text);
- else if(IsPlayerInRangeOfPoint(i, 4.0, tsPos[0], tsPos[1], tsPos[2])) SendClientMessage(i, colorC, text);
- else if(IsPlayerInRangeOfPoint(i, 6.0, tsPos[0], tsPos[1], tsPos[2])) SendClientMessage(i, colorD, text);
- }
- return true;
- }
- stock Path(playerid)
- {
- new str[35], name[MAX_PLAYER_NAME];
- GetPlayerName(playerid, name, sizeof(name));
- format(str, sizeof(str), "Users/%s.ini", name);
- return str;
- }
- stock SavePlayer(playerid)
- {
- new INI:file = INI_Open(Path(playerid));
- INI_SetTag(file, "Account Data");
- INI_WriteString(file, "Password", pInfo[playerid][Pass]);
- INI_WriteInt(file, "Admin", pInfo[playerid][Admin]);
- INI_WriteInt(file, "Helper", pInfo[playerid][Helper]);
- INI_WriteInt(file, "Level", pInfo[playerid][Level]);
- INI_WriteInt(file, "Exp", pInfo[playerid][Exp]);
- INI_WriteInt(file, "ExpLeft", pInfo[playerid][ExpLeft]);
- INI_WriteInt(file, "FactionID", pInfo[playerid][FactionID]);
- INI_WriteInt(file, "FactionTier", pInfo[playerid][FactionTier]);
- INI_WriteString(file, "FactionRank", pInfo[playerid][FactionRank]);
- INI_WriteInt(file, "HouseOwner", pInfo[playerid][HouseOwner]);
- INI_WriteInt(file, "CarOwner", pInfo[playerid][CarOwner]);
- INI_WriteInt(file, "BizOwner", pInfo[playerid][BizOwner]);
- INI_WriteInt(file, "Weapon1", pInfo[playerid][Weapon1]);
- INI_WriteInt(file, "Weapon1Ammo", pInfo[playerid][Weapon1Ammo]);
- INI_WriteInt(file, "Weapon2", pInfo[playerid][Weapon2]);
- INI_WriteInt(file, "Weapon2Ammo", pInfo[playerid][Weapon2Ammo]);
- INI_WriteInt(file, "Weapon3", pInfo[playerid][Weapon3]);
- INI_WriteInt(file, "Weapon3Ammo", pInfo[playerid][Weapon3Ammo]);
- INI_WriteInt(file, "HandMoney", GetPlayerMoney(playerid));
- INI_WriteInt(file, "BankMoney", pInfo[playerid][BankMoney]);
- INI_WriteInt(file, "Phone", pInfo[playerid][Phone]);
- INI_WriteInt(file, "PhoneNumber", pInfo[playerid][Phone]);
- INI_WriteInt(file, "Mask", pInfo[playerid][Mask]);
- INI_WriteInt(file, "MaskNumber", pInfo[playerid][Mask]);
- INI_WriteInt(file, "SkinID", GetPlayerSkin(playerid));
- INI_Close(file);
- return true;
- }
- forward loadaccount_user(playerid, name[], value[]);
- public loadaccount_user(playerid, name[], value[])
- {
- INI_String("Password", pInfo[playerid][Pass], 129);
- INI_Int("Admin", pInfo[playerid][Admin]);
- INI_Int("Helper", pInfo[playerid][Helper]);
- INI_Int("Level", pInfo[playerid][Level]);
- INI_Int("Exp", pInfo[playerid][Exp]);
- INI_Int("ExpLeft", pInfo[playerid][ExpLeft]);
- INI_Int("FactionID", pInfo[playerid][FactionID]);
- INI_Int("FactionTier", pInfo[playerid][FactionTier]);
- INI_String("FactionRank", pInfo[playerid][FactionRank], 24);
- INI_Int("HouseOwner", pInfo[playerid][HouseOwner]);
- INI_Int("CarOwner", pInfo[playerid][CarOwner]);
- INI_Int("BizOwner", pInfo[playerid][BizOwner]);
- INI_Int("Weapon1", pInfo[playerid][Weapon1]);
- INI_Int("Weapon1Ammo", pInfo[playerid][Weapon1Ammo]);
- INI_Int("Weapon2", pInfo[playerid][Weapon2]);
- INI_Int("Weapon2Ammo", pInfo[playerid][Weapon2Ammo]);
- INI_Int("Weapon3", pInfo[playerid][Weapon3]);
- INI_Int("Weapon3Ammo", pInfo[playerid][Weapon3Ammo]);
- INI_Int("HandMoney", pInfo[playerid][HandMoney]);
- INI_Int("BankMoney", pInfo[playerid][BankMoney]);
- INI_Int("Phone", pInfo[playerid][Phone]);
- INI_Int("PhoneNumber", pInfo[playerid][Phone]);
- INI_Int("Mask", pInfo[playerid][Mask]);
- INI_Int("MaskNumber", pInfo[playerid][Mask]);
- INI_Int("SkinID", pInfo[playerid][SkinID]);
- return true;
- }
- stock GetPlayerFirstName(playerid)
- {
- new szName[MAX_PLAYER_NAME], iPos;
- GetPlayerName(playerid, szName, sizeof(szName));
- iPos = strfind(szName, "_"); // underline is found
- if(iPos != -1) szName[iPos] = EOS; // EOS defines END OF STRING
- return szName; // returns new name
- }
- stock IsRPName(const name[], max_underscores = 1)
- {
- new underscores = 0;
- if (name[0] < 'A' || name[0] > 'Z') return false; // first letter != capital
- for(new i = 1; i < strlen(name); i++)
- {
- if(name[i] != '_' && (name[i] < 'A' || name[i] > 'Z') && (name[i] < 'a' || name[i] > 'z')) return false; // a-zA-Z_
- if( (name[i] >= 'A' && name[i] <= 'Z') && (name[i - 1] != '_') ) return false; // unneeded capital letter
- if(name[i] == '_')
- {
- underscores++;
- if(underscores > max_underscores || i == strlen(name)) return false; // more than defined underline
- if(name[i + 1] < 'A' || name[i + 1] > 'Z') return false; // no capital letter after underline
- }
- }
- if (underscores == 0) return false; // no underline
- return true;
- }
- stock DelayedKick(playerid) SetTimerEx("DelayedKicker", 250, false, "i", playerid);
- forward DelayedKicker(playerid);
- public DelayedKicker(playerid)
- {
- new name[MAX_PLAYER_NAME];
- GetPlayerName(playerid, name, sizeof(name));
- printf("[kick] %s (%d) has been (automated) kick(ed) by the system.", name, playerid);
- Kick(playerid);
- return true;
- }
- forward TimeHandler();
- public TimeHandler()
- {
- if(WorldTime < 23) WorldTime ++;
- else if(WorldTime >= 24) WorldTime = 0;
- SetWorldTime(WorldTime);
- return true;
- }
- forward LevelTimer(playerid);
- public LevelTimer(playerid)
- {
- new string[144], oldmoney = pInfo[playerid][BankMoney];
- if(pInfo[playerid][Exp] != pInfo[playerid][ExpLeft])
- {
- pInfo[playerid][Exp] += 1;
- pInfo[playerid][BankMoney] += 450;
- SendClientMessage(playerid, -1, "Bank Balance Receipt: $450 added to bank account!");
- format(string, sizeof(string), "{8EB2D6}[INFO]{FFFFFF}: [Old Amount: %d] [New Amount: %d]", oldmoney, pInfo[playerid][BankMoney]);
- SendClientMessage(playerid, -1, string);
- format(string, sizeof(string), "{8EB2D6}[INFO]{FFFFFF}: Level progression: %d/%d. Next payday in 30 minutes.", pInfo[playerid][Exp], pInfo[playerid][ExpLeft]);
- SendClientMessage(playerid, -1, string);
- }
- else if(pInfo[playerid][Exp] == pInfo[playerid][ExpLeft])
- {
- pInfo[playerid][Exp] = 0;
- pInfo[playerid][ExpLeft] += 8;
- pInfo[playerid][Level] += 1;
- format(string, sizeof(string), "{8EB2D6}[INFO]{FFFFFF}: You have leveled up! New level: %d!", pInfo[playerid][Level]);
- SendClientMessage(playerid, -1, string);
- format(string, sizeof(string), "{8EB2D6}[INFO]{FFFFFF}: Experience necessities upgraded: %d/%d.", pInfo[playerid][Exp], pInfo[playerid][ExpLeft]);
- SendClientMessage(playerid, -1, string);
- }
- return true;
- }
- stock BusinessPath(Businessid)
- {
- new Business[64];
- format(Business, 30, "Businesses/%d.ini", Businessid);
- bInfo[Businessid][ID] ++; // multiplying
- return Business;
- }
- forward LoadBusinessData(b, name[], value[]);
- public LoadBusinessData(b, name[], value[])
- {
- INI_String("Owner", bInfo[b][Owner], MAX_PLAYER_NAME);
- INI_String("Name", bInfo[b][Name], 40);
- INI_Int("Price", bInfo[b][Price]);
- INI_Int("Bought", bInfo[b][Bought]);
- INI_Float("ExtX", bInfo[b][ExtX]);
- INI_Float("ExtY", bInfo[b][ExtY]);
- INI_Float("ExtZ", bInfo[b][ExtZ]);
- INI_Float("IntX", bInfo[b][IntX]);
- INI_Float("IntY", bInfo[b][IntY]);
- INI_Float("IntZ", bInfo[b][IntZ]);
- INI_Int("IntWorld", bInfo[b][IntInterior]);
- INI_Int("IntVW", bInfo[b][IntVirtualW]);
- INI_Int("VW", bInfo[b][World]);
- INI_Int("World", bInfo[b][Interior]);
- INI_Int("Locked", bInfo[b][Locked]);
- INI_Int("Initialised", bInfo[b][Initialised]);
- return true;
- }
- stock SaveBizzes()
- {
- new file[64];
- for(new b; b < MAX_BIZZES; b ++)
- {
- format(file, sizeof(file), "Businesses/%d.ini", b);
- if(fexist(file))
- {
- new INI:File = INI_Open(file);
- INI_SetTag(File, "Business Data");
- INI_WriteString(File, "Owner", bInfo[b][Owner]);
- INI_WriteString(File, "Name", bInfo[b][Name]);
- INI_WriteInt(File, "Price", bInfo[b][Price]);
- INI_WriteInt(File, "Bought", bInfo[b][Bought]);
- INI_WriteFloat(File, "ExtX", bInfo[b][ExtX]);
- INI_WriteFloat(File, "ExtY", bInfo[b][ExtY]);
- INI_WriteFloat(File, "ExtZ", bInfo[b][ExtZ]);
- INI_WriteFloat(File, "IntX", bInfo[b][IntX]);
- INI_WriteFloat(File, "IntY", bInfo[b][IntY]);
- INI_WriteFloat(File, "IntZ", bInfo[b][IntZ]);
- INI_WriteInt(File, "IntVW", bInfo[b][IntVirtualW]);
- INI_WriteInt(File, "IntWorld", bInfo[b][IntInterior]);
- INI_WriteInt(File, "VW", bInfo[b][World]);
- INI_WriteInt(File, "World", bInfo[b][Interior]);
- INI_WriteInt(File, "Locked", bInfo[b][Locked]);
- INI_WriteInt(File, "Initialised", bInfo[b][Initialised]);
- INI_Close(File);
- }
- }
- return true;
- }
- stock LoadBizzes()
- {
- new hlabel[128], file[64];
- print("\n Loading Businesses: \n");
- for(new b; b < MAX_BIZZES; b ++)
- {
- format(file, sizeof(file), "Businesses/%d.ini", b);
- if(fexist(file))
- {
- INI_ParseFile(BusinessPath(b), "LoadBusinessData", false, true, b, true, false);
- if(bInfo[b][Bought] == 0) format(hlabel, sizeof(hlabel), "{8EB2D6}[Business]{FFFFFF}\nName: %s\nOwner: %s\nPrice: %d", bInfo[b][Name], bInfo[b][Owner], bInfo[b][Price]);
- else if(bInfo[b][Bought] == 1) format(hlabel, sizeof(hlabel), "{8EB2D6}[Business]{FFFFFF}\nName: %s\nOwner: %s", bInfo[b][Name], bInfo[b][Owner]);
- bInfo[b][Label] = Create3DTextLabel(hlabel, 0xFFFFFF, bInfo[b][ExtX], bInfo[b][ExtY], bInfo[b][ExtZ], 15.0, bInfo[b][World], 1);
- format(hlabel, sizeof(hlabel), " Loaded business ID: %d at %f %f %f", b, bInfo[b][ExtX], bInfo[b][ExtY], bInfo[b][ExtZ]);
- print(hlabel);
- bCount ++;
- }
- }
- printf("\n %d Businesses loaded!", bCount);
- return true;
- }
- stock SendAdminMsg(text[])
- {
- for(new i; i < MAX_PLAYERS; i ++)
- {
- if(pInfo[i][Admin] != 0)
- {
- SendClientMessage(i, 0x96CC76FF, text);
- }
- }
- return true;
- }
- forward DeathTimer(playerid);
- public DeathTimer(playerid)
- {
- new string[50];
- if(pDeathTimerTick[playerid] > 0)
- {
- pDeathTimerTick[playerid] --;
- format(string, sizeof(string), "~w~Time left: ~r~%d", pDeathTimerTick[playerid]);
- GameTextForPlayer(playerid, string, 1000, 4);
- }
- else if(pDeathTimerTick[playerid] <= 0)
- {
- TogglePlayerControllable(playerid, true);
- TogglePlayerSpectating(playerid, false);
- SetCameraBehindPlayer(playerid);
- SetPlayerVirtualWorld(playerid, 0);
- SetPlayerPos(playerid, 2028.5094, -1415.9738, 16.6084);
- pDeath[playerid] = false;
- KillTimer(pDeathTimer[playerid]);
- SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You have respawned!");
- }
- return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement