Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #include <Dini>
- #define MAX_HOUSES 500
- #define MAX_FACTIONS 50
- #define MAX_BUSINESS 50
- #define MAX_BANKS 20
- #define MAX_VEHICLES_SHOPS 50
- #define MAX_JOBS 50
- #define MAX_24_7_STORES 50
- #define MAX_ATMS 250
- #define MAX_SPEEDCAMS 500
- #define MAX_GASSTATIONS 50
- #define OBJ_HOUSE 1
- #define OBJ_FACTION 2
- #define OBJ_BUSINESS 3
- #define OBJ_STORE 4
- #define OBJ_BANK 5
- #define ResetMoneyBar ResetPlayerMoney
- #define UpdateMoneyBar GivePlayerMoney
- #define COLOR_GREY 0xAFAFAFAA
- #define COLOR_GREEN 0x33AA33AA
- #define COLOR_RED 0xAA3333AA
- #define COLOR_BLUE 0xE0EEEE
- #define COLOR_YELLOW 0xFFFF00AA
- #define COLOR_WHITE 0xFFFFFFAA
- #define COLOR_PURPLE 0xCC99CC
- #define COLOR_FADE1 0xE6E6E6E6
- #define COLOR_FADE2 0xC8C8C8C8
- #define COLOR_FADE3 0xAAAAAAAA
- #define COLOR_FADE4 0x8C8C8C8C
- #define COLOR_FADE5 0x6E6E6E6E
- #define SERVERNAME "AoTv Roleplay"
- native IsValidVehicle(vehicleid);
- forward AddVehicle(model, Float:x, Float:y, Float:z, Float:facing_angle, color_1, color_2, faction, faction_rank);
- forward LoadVehicles(static_vehicle);
- forward RegisterPlayer(playerid, const password[]);
- forward LoginPlayer(const PlayerName[], const PlayerPassword[]);
- forward AddFaction(const Name[], type);
- forward SetFactionRankName(const Faction_Name[], Rank, const Rank_Name[]);
- forward SetFactionRankSkin(const Faction_Name[], Rank, SkinID);
- forward AddFactionHQ(const Faction_HQ_Name[], Float:Inside_X, Float:Inside_Y, Float:Inside_Z, Interior, playerid);
- forward LoadFactions();
- forward AddBank(Float:Inside_X, Float:Inside_Y, Float:Inside_Z, Interior, playerid);
- forward LoadBanks();
- forward CreateHouse(const housename[], const owner[], price, locked, onsale, Float:x, Float:y, Float:z, Float:ix, Float:iy, Float:iz, interior);
- forward LoadHouses();
- forward AddMapIcon(playerid, icon_type);
- forward LoadMapIcons();
- forward TutorialStep1(playerid);
- forward TutorialStep2(playerid);
- forward TutorialStep3(playerid);
- forward TutorialStep4(playerid);
- forward TutorialStep5(playerid);
- forward TutorialFinish(playerid);
- forward AddBusiness(playerid, const Business_Name[], const bOwner_Name[], bEnter_Fee, bOnSale, bPrice, bLocked, Float:Interior_X, Float:Interior_Y, Float:Interior_Z, bInterior);
- forward LoadBusiness();
- forward AddVehicleShop(playerid, const Vehicle_Shop_Name[]);
- forward LoadVehicleShops();
- forward SetVehicleSpawn(shopid, playerid);
- forward LoadVehicleSpawns();
- forward ToggleVehicleEngine(vehicleid, toggle);
- forward SwitchEngineOn(playerid, vehicleid);
- forward Add247(playerid, interior);
- forward Load247();
- forward CreatePickupEx(pickup_model, pickup_type, Float:pickup_X, Float:pickup_Y, Float:pickup_Z, pickup_virtualworld);
- forward GetPickupModel(pickupid);
- forward SaveAccount(const Player_Name[], crashed);
- forward AddJob(const Job_Name[], Job_Type, Float:Job_X, Float:Job_Y, Float:Job_Z);
- forward LoadJobs();
- forward ReloadBusinessFile();
- forward AntiCheatMoney();
- forward AntiCheatWeapon();
- forward Speedo(playerid);
- forward FuelSystem();
- forward Translate(playerid, color, const Message[], const Language[]);
- forward BankSystem(const Option[], Amount, playerid, giveid);
- forward VehiclePlates();
- forward GenerateVehiclePlate();
- forward AddAtm(playerid);
- forward LoadAtms();
- forward AddSpeedCam(playerid, maxspeed);
- forward LoadSpeedCams();
- forward SpeedCamsTimer();
- forward SpeedCamCheck(playerid);
- forward AddGasStation(playerid, rate, name[]);
- forward LoadGasStations();
- forward Fueling(playerid, vehicleid, money);
- forward FixVehicle(playerid, vehicleid);
- forward AddUsableCommand(rank, type, const command[]);
- forward LoadUsableCommands(type);
- forward IsUsableCommand(rank, type, const command[]);
- forward DragPlayer(playerid, id);
- forward TazePlayer(playerid);
- forward StealVehicle(playerid, vehicleid);
- new ShowSpeedo[MAX_PLAYERS];
- new SpeedoTimer[MAX_PLAYERS];
- new VehicleFuel[MAX_VEHICLES];
- new WrongPassword[MAX_PLAYERS] = 0;
- new bool:OOC_Enabled;
- enum _gasstations{
- gssname[24],
- gssrate,
- Float:gssx,
- Float:gssy,
- Float:gssz,
- }
- new GasStations[MAX_GASSTATIONS][_gasstations];
- enum ucommands{
- uctype,
- ucrank,
- ucc[64]
- }
- new UsableCommands[][ucommands];
- enum Plates{
- Number
- }
- new VehiclePlatesSys[MAX_VEHICLES][Plates];
- enum _Job_Informations{
- jName[24],
- jType,
- Float:jPos_X,
- Float:jPos_Y,
- Float:jPos_Z
- }
- new Job_Infos[MAX_JOBS][_Job_Informations];
- new OfferedVehicle[MAX_PLAYERS];
- new OfferVehiclePlayer[MAX_PLAYERS];
- new OfferVehiclePrice[MAX_PLAYERS];
- new OfferVehicleModel[MAX_PLAYERS];
- new OfferedHouse[MAX_PLAYERS];
- new OfferedHousePlayer[MAX_PLAYERS];
- new OfferedHousePrice[MAX_PLAYERS];
- new OfferedBusiness[MAX_PLAYERS];
- new OfferedBusinessPlayer[MAX_PLAYERS];
- new OfferedBusinessPrice[MAX_PLAYERS];
- enum _Pickup{
- puModel,
- puType,
- Float:puX,
- Float:puY,
- Float:puZ,
- puVirtualWorld
- }
- new PickUps[MAX_PICKUPS][_Pickup];
- enum _247{
- Float:sEnter_X,
- Float:sEnter_Y,
- Float:sEnter_Z,
- Float:sInt_X,
- Float:sInt_Y,
- Float:sInt_Z,
- sInt
- }
- new Stores_Infos[MAX_24_7_STORES][_247];
- enum _atms{
- Float:atm_x,
- Float:atm_y,
- Float:atm_z,
- Float:atm_rot,
- atm_objid
- }
- new ATM_Infos[MAX_ATMS][_atms];
- enum _speedcams{
- Float:scx,
- Float:scy,
- Float:scz,
- Float:scfa,
- scmaxspeed,
- scobjid
- }
- new SpeedCams[MAX_SPEEDCAMS][_speedcams];
- new SpeedCamPlayer[MAX_PLAYERS];
- enum VehiclesShops{
- vsName[24],
- Float:vsX,
- Float:vsY,
- Float:vsZ,
- Float:vsvsx,
- Float:vsvsy,
- Float:vsvsz,
- Float:vsvsfa
- }
- new Vehicles_Shops[MAX_VEHICLES_SHOPS][VehiclesShops];
- enum BuyAbleVehicleInfo{
- bvModel,
- bvName[32],
- bvPrice
- }
- //Buyable vehicles
- new buyablevehicles[][BuyAbleVehicleInfo] = {
- {400, "Landstalker", 15000},
- {401, "Bravura", 10000},
- {402, "Buffalo", 70000},
- {404, "Perenniel", 8000},
- {405, "Sentinel", 30000},
- {410, "Manana", 8000},
- {411, "Infernus", 80000},
- {412, "Voodoo", 25000},
- {413, "Pony", 25000},
- {415, "Cheetah", 1000000},
- {418, "Moonbeam", 25000},
- {419, "Esperanto", 30000},
- {421, "Washington", 35000},
- {422, "Bobcat", 20000},
- {424, "BFInjection", 50000},
- {426, "Premier", 55000},
- {429, "Banshee", 500000},
- {436, "Previon", 20000},
- {439, "Stallion", 15000},
- {440, "Rumpo", 25000},
- {445, "Admiral", 30000},
- {451, "Turismo", 2000000},
- {458, "Solair", 30000},
- {461, "PCJ-600", 40000},
- {462, "Faggio", 11000},
- {463, "Freeway", 25000},
- {466, "Glendale", 13000},
- {467, "Oceanic", 10000},
- {468, "Sanchez", 32000},
- {470, "Patriot", 150000},
- {471, "Quad", 20000},
- {474, "Hermes", 40000},
- {475, "Sabre", 45000},
- {477, "ZR-350", 1000000},
- {478, "Walton", 10000},
- {479, "Regina", 38000},
- {480, "Comet", 1500000},
- {482, "Burrito", 30000},
- {489, "Rancher", 50000},
- {491, "Virgo", 50000},
- {492, "Greenwood", 65000},
- {496, "BlistaCompact", 40000},
- {500, "Mesa", 52000},
- {506, "SuperGT", 1000000},
- {507, "Elegant", 65000},
- {516, "Nebula", 25000},
- {517, "Majestic", 30000},
- {518, "Buccaneer", 30000},
- {521, "FCR-900", 60000},
- {522, "NRG-500", 75000},
- {526, "Fortune", 40000},
- {527, "Cadrona", 30000},
- {526, "Willard", 25000},
- {531, "Tractor", 3000},
- {533, "Feltzer", 50000},
- {534, "Remington", 65000},
- {535, "Slamvan", 75000},
- {536, "Blade", 60000},
- {540, "Vincent", 45000},
- {541, "Bullet", 1000000},
- {542, "Clover", 18000},
- {543, "Sadler", 8000},
- {546, "Intruder", 20000},
- {547, "Primo", 25000},
- {549, "Tampa", 18000},
- {550, "Sunrise", 21000},
- {551, "Merit", 20000},
- {554, "Yosemite", 45000},
- {555, "Windsor", 500000},
- {558, "Uranus", 650000},
- {559, "Jester", 250000},
- {560, "Sultan", 150000},
- {561, "Stratum", 70000},
- {562, "Elegy", 500000},
- {565, "Flash", 300000},
- {566, "Tahoma", 42000},
- {567, "Savanna", 65000},
- {603, "Phoenix", 500000},
- {602, "Alpha", 300000},
- {600, "Picador", 15000},
- {589, "Club", 70000},
- {587, "Euros", 80000},
- {586, "Wayfarer", 24560},
- {585, "Emperor", 32000},
- {581, "BF-400", 47000},
- {580, "Stafford", 150000},
- {579, "Huntley", 80000},
- {576, "Tornado", 45000},
- {575, "Broadway", 500000}
- };
- enum Business_Parameters{
- bizName[64],
- bizOwner_Name[64],
- bizEnter_Fee,
- bizOn_Sale,
- bizPrice,
- bizLocked,
- Float:bizEntrance_X,
- Float:bizEntrance_Y,
- Float:bizEntrance_Z,
- Float:bizInterior_X,
- Float:bizInterior_Y,
- Float:bizInterior_Z,
- bizInterior,
- Text3D:labelid
- }
- new Business_Infos[MAX_BUSINESS][Business_Parameters];
- new HouseCreatingName[MAX_PLAYERS];
- new HouseCreatingPrice[MAX_PLAYERS];
- enum BankParams{
- Float:BankEnterX,
- Float:BankEnterY,
- Float:BankEnterZ,
- Float:BankExitX,
- Float:BankExitY,
- Float:BankExitZ,
- BankInteriorID
- }
- new BankInfos[MAX_BANKS][BankParams];
- enum HouseParams{
- Text3D:hTextLabelID,
- hPickup_ID,
- HouseName[64],
- OwnerName[64],
- Price,
- Locked,
- OnSale,
- Float:HouseEnterX,
- Float:HouseEnterY,
- Float:HouseEnterZ,
- Float:HouseInteriorX,
- Float:HouseInteriorY,
- Float:HouseInteriorZ,
- HouseInteriorID
- }
- new HouseInfos[MAX_HOUSES][HouseParams];
- enum Faction_Parameters{
- fFaction_Name[64],
- fFaction_Type,
- fRank_1_Name[64],
- fRank_2_Name[64],
- fRank_3_Name[64],
- fRank_4_Name[64],
- fRank_5_Name[64],
- fRank_1_Skin,
- fRank_2_Skin,
- fRank_3_Skin,
- fRank_4_Skin,
- fRank_5_Skin,
- Float:fFaction_HQ_X,
- Float:fFaction_HQ_Y,
- Float:fFaction_HQ_Z,
- Float:fFaction_HQ_Inside_X,
- Float:fFaction_HQ_Inside_Y,
- Float:fFaction_HQ_Inside_Z,
- fFaction_HQ_Inside_Interior
- }
- new Faction_Infos[MAX_FACTIONS][Faction_Parameters];
- enum Vehicle_Parameters{
- vModel_ID,
- Float:vx,
- Float:vy,
- Float:vz,
- Float:vFacing_Angle,
- vColor_1,
- vColor_2,
- vFaction,
- vFaction_Rank
- }
- new LoadedVehicles[MAX_VEHICLES][Vehicle_Parameters];
- new PlayerLogedIn[MAX_PLAYERS];
- enum _Player{
- pKey,
- pName[128],
- pSkin,
- pLevel,
- pCash,
- pBank,
- pAdministrator,
- pModerator,
- pDonator,
- pFaction,
- pFaction_Rank,
- pCK,
- pKills,
- pDeaths,
- pTutorial,
- pFines,
- pVehicle_1_Key,
- pVehicle_1_Color_1,
- pVehicle_1_Color_2,
- pVehicle_1_Plate,
- pVehicle_1_Panel_Status,
- pVehicle_1_Doors_Status,
- pVehicle_1_Lights_Status,
- pVehicle_1_Tires_Status,
- Float:pVehicle_1_Health,
- pVehicle_1_Fuel,
- pVehicle_2_Key,
- pVehicle_2_Color_1,
- pVehicle_2_Color_2,
- pVehicle_2_Plate,
- pVehicle_2_Panel_Status,
- pVehicle_2_Doors_Status,
- pVehicle_2_Lights_Status,
- pVehicle_2_Tires_Status,
- Float:pVehicle_2_Health,
- pVehicle_2_Fuel,
- pVehicle_3_Key,
- pVehicle_3_Color_1,
- pVehicle_3_Color_2,
- pVehicle_3_Plate,
- pVehicle_3_Panel_Status,
- pVehicle_3_Doors_Status,
- pVehicle_3_Lights_Status,
- pVehicle_3_Tires_Status,
- Float:pVehicle_3_Health,
- pVehicle_3_Fuel,
- pSpawned_Vehicle,
- pSpawned_Vehicle_Slot,
- Float:pPark_X,
- Float:pPark_Y,
- Float:pPark_Z,
- Float:pPark_FA,
- Float:pCrash_X,
- Float:pCrash_Y,
- Float:pCrash_Z,
- Float:pCrash_F,
- pCrashed,
- Float:pSpawn_X,
- Float:pSpawn_Y,
- Float:pSpawn_Z,
- pInterior,
- pInObject,
- Float:pObjectEnterX,
- Float:pObjectEnterY,
- Float:pObjectEnterZ,
- Float:pObjectExitX,
- Float:pObjectExitY,
- Float:pObjectExitZ,
- pObjectInterior,
- pObjectType,
- pHouse_Key,
- pWeed,
- pCoke,
- pLSD,
- pPayCheck,
- pJob,
- pBiz_Key,
- pWeapon_1,
- pWeapon_1_Ammo,
- pWeapon_2,
- pWeapon_2_Ammo,
- pWeapon_3,
- pWeapon_3_Ammo,
- pWeapon_4,
- pWeapon_4_Ammo,
- pWeapon_5,
- pWeapon_5_Ammo,
- pWeapon_6,
- pWeapon_6_Ammo,
- pWeapon_7,
- pWeapon_7_Ammo,
- pWeapon_8,
- pWeapon_8_Ammo,
- pWeapon_9,
- pWeapon_9_Ammo,
- pWeapon_10,
- pWeapon_10_Ammo,
- pWeapon_11,
- pWeapon_11_Ammo,
- pWeapon_12,
- pWeapon_12_Ammo,
- pWeapon_13,
- pWeapon_13_Ammo,
- pMobile_Num,
- pMobile_Tog,
- pFueling,
- pCuffed,
- pDraging,
- pDragingTimer,
- pDragged,
- pTazed,
- pADuty,
- pStealing,
- pStealingTimer
- }
- new GlobalType;
- new Player_Infos[MAX_PLAYERS][_Player];
- new Doing_Tutorial[MAX_PLAYERS] = 0;
- new pMuted[MAX_PLAYERS] = 0;
- main(){
- printf("Welcome to %s", SERVERNAME);
- return 1;
- }
- public OnGameModeInit(){
- SetGameModeText(SERVERNAME);
- ManualVehicleEngineAndLights();
- ShowPlayerMarkers(0);
- AddPlayerClass(0, 0.0, 0.0, 0.0, 0.0, 0, 0, 0, 0, 0, 0);
- SetTimer("AntiCheatMoney", 1000, true);
- SetTimer("AntiCheatWeapon", 1000, true);
- SetTimer("FuelSystem", 30000, true);
- SetTimer("SpeedCamsTimer", 1000, true);
- DisableInteriorEnterExits();
- EnableStuntBonusForAll(0);
- OOC_Enabled = true;
- LoadJobs();
- LoadFactions();
- LoadHouses();
- LoadBusiness();
- LoadVehicleShops();
- LoadVehicleSpawns();
- Load247();
- LoadBanks();
- LoadVehicles(1);
- LoadMapIcons();
- LoadAtms();
- LoadSpeedCams();
- GlobalType = 0;
- return 1;
- }
- public OnGameModeExit(){
- return 1;
- }
- public OnPlayerRequestSpawn(playerid){
- if(PlayerLogedIn[playerid] != 1){
- SendClientMessage(playerid, COLOR_RED, "You need to login first.");
- return 0;
- }else{
- return 1;
- }
- }
- public OnPlayerSpawn(playerid){
- if(Player_Infos[playerid][pTutorial] == 999){
- TutorialStep1(playerid);
- return 0;
- }
- new spawn_string[128];
- if(IsPlayerAdministrator(playerid, 1338)){
- format(spawn_string, sizeof(spawn_string), "Welcome back owner %s", Player_Infos[playerid][pName]);
- SendClientMessage(playerid, COLOR_BLUE, spawn_string);
- }
- SetPlayerCash(playerid, Player_Infos[playerid][pCash]);
- SetPlayerSkin(playerid, Player_Infos[playerid][pSkin]);
- SetPlayerPos(playerid, Player_Infos[playerid][pSpawn_X], Player_Infos[playerid][pSpawn_Y], Player_Infos[playerid][pSpawn_Z]);
- SetPlayerInterior(playerid, Player_Infos[playerid][pInterior]);
- return 1;
- }
- public OnPlayerRequestClass(playerid, classid){
- new Player_Name[128], Account[128], class_req_string[128];
- GetPlayerName(playerid, Player_Name, sizeof(Player_Name));
- format(Account, sizeof(Account), "Players/%s.ini", Player_Name);
- if(dini_Exists(Account)){
- format(class_req_string, sizeof(class_req_string), "Welcome %s, please login\n\rType your password bellow.", Player_Name);
- ShowPlayerDialog(playerid, 1, DIALOG_STYLE_PASSWORD, "Login", class_req_string, "Login", "Close");
- return 1;
- }else{
- format(class_req_string, sizeof(class_req_string), "Welcome %s, please register\n\rType your password bellow.", Player_Name);
- ShowPlayerDialog(playerid, 2, 1, "Register", class_req_string, "Register", "Close");
- return 1;
- }
- }
- public OnPlayerConnect(playerid){
- new WelcomeText[128];
- format(WelcomeText, sizeof(WelcomeText), "Welcome to %s", SERVERNAME);
- PlayerLogedIn[playerid] = 0;
- SendClientMessage(playerid, COLOR_YELLOW, WelcomeText);
- OfferedHouse[playerid] = -1;
- WrongPassword[playerid] = 0;
- ShowSpeedo[playerid] = 0;
- SpeedCamPlayer[playerid] = 0;
- Player_Infos[playerid][pFueling] = 0;
- Player_Infos[playerid][pCuffed] = 0;
- Player_Infos[playerid][pDraging] = -1;
- Player_Infos[playerid][pDragged] = -1;
- Player_Infos[playerid][pTazed] = 0;
- Player_Infos[playerid][pADuty] = 0;
- Player_Infos[playerid][pStealing] = 0;
- SpeedoTimer[playerid] = -1;
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason){
- WrongPassword[playerid] = 0;
- if(Player_Infos[playerid][pSpawned_Vehicle] != -1){
- DestroyVehicle(Player_Infos[playerid][pSpawned_Vehicle]);
- }
- if(reason == 0){
- SaveAccount(Player_Infos[playerid][pName], 1);
- return 1;
- }
- SaveAccount(Player_Infos[playerid][pName], 0);
- return 1;
- }
- public OnPlayerText(playerid, text[]){
- if(Doing_Tutorial[playerid] == 1){
- SendClientMessage(playerid, COLOR_RED, "No commands available while reading tutorial.");
- return 0;
- }else if(pMuted[playerid] == 1){
- SendClientMessage(playerid, COLOR_RED, "You can not chat, you are muted...");
- SendClientMessage(playerid, COLOR_RED, "use /unmuteme to ask admin to unmute you.");
- return 0;
- }
- new String[1024], Name[24];
- GetPlayerName(playerid, Name, sizeof(Name));
- format(String, sizeof(String), "%s: %s", Name, text);
- SendToNearPlayers(playerid, COLOR_FADE1, COLOR_FADE2, COLOR_FADE3, COLOR_FADE4, COLOR_FADE5, 20, String);
- return 0;
- }
- public OnPlayerCommandText(playerid, cmdtext[]){
- if(Doing_Tutorial[playerid] == 1){
- SendClientMessage(playerid, COLOR_RED, "No commands available while reading tutorial.");
- return 1;
- }
- new idx, cmd[128], tmp[128];
- cmd = strtok(cmdtext, idx);
- if(!strcmp(cmd, "/addobject", true)){
- tmp = strtok(cmdtext, idx);
- if(!strlen(tmp)){
- SendClientMessage(playerid, COLOR_GREY, "USAGE: /addobject objectid");
- return 1;
- }
- new Float:X, Float:Y, Float:Z, Float:FA;
- GetPlayerPos(playerid, X, Y, Z);
- GetPlayerFacingAngle(playerid, FA);
- new tmpobjid;
- tmpobjid = CreateObject(strval(tmp), X, Y, Z+1, 0.0, 0.0, FA);
- DestroyObject(tmpobjid);
- return 1;
- }
- if(strcmp(cmd, "/vehid", true) == 0){
- if(IsPlayerInAnyVehicle(playerid)){
- new vids[128];
- format(vids, sizeof(vids), "Vehicle ID: %d", GetPlayerVehicleID(playerid));
- SendClientMessage(playerid, COLOR_WHITE, vids);
- return 1;
- }
- }
- if(strcmp(cmd, "/credits", true) == 0){
- SendClientMessage(playerid, COLOR_YELLOW, "Roleplayer script by CoaPsyFactor, v0.0.1");
- return 1;
- }else if(strcmp(cmd, "/addjob", true) == 0){
- if(IsPlayerAdministrator(playerid, 1338)){
- new Job_Name_Create[128], Job_Type_Create, Float:JCX, Float:JCY, Float:JCZ;
- tmp = strtok(cmdtext, idx);
- if(!strlen(tmp)){
- SendClientMessage(playerid, COLOR_GREY, "USAGE: /addjob [Type] [Name]");
- return 1;
- }
- Job_Type_Create = strval(tmp);
- tmp = strrest(cmdtext, idx);
- if(!strlen(tmp)){
- SendClientMessage(playerid, COLOR_GREY, "USAGE: /addjob [Type] [Name]");
- return 1;
- }
- format(Job_Name_Create, sizeof(Job_Name_Create), "%s", tmp);
- GetPlayerPos(playerid, JCX, JCY, JCZ);
- AddJob(Job_Name_Create, Job_Type_Create, JCX, JCY, JCZ);
- return 1;
- }
- return 1;
- }else if(strcmp(cmd, "/loadjobs", true) == 0){
- if(IsPlayerAdministrator(playerid, 1338)){
- LoadJobs();
- return 1;
- }
- }else if(strcmp(cmd, "/writepos", true) == 0){
- if(IsPlayerAdministrator(playerid, 1338)){
- new Float:x, Float:y, Float:z, string[128];
- GetPlayerPos(playerid, x, y, z);
- new File:Cords = fopen("cords.txt", io_append);
- format(string, sizeof(string), "%f,%f,%f\n", x, y, z);
- fwrite(Cords, string);
- fclose(Cords);
- return 1;
- }
- }else if(strcmp(cmd, "/addvehicle", true) == 0){
- if(IsPlayerAdministrator(playerid, 1338)){
- new ModelID, Float:My_X, Float:My_Y, Float:My_Z, Float:My_Facing_Angle, Color_1, Color_2, Faction, Faction_Rank;
- tmp = strtok(cmdtext, idx);
- if(!strlen(tmp)){
- SendClientMessage(playerid, COLOR_GREY, "USAGE: /addvehicle [model] [color_1] [color_2] [faction] [faction_rank]");
- return 1;
- }
- ModelID = strval(tmp);
- tmp = strtok(cmdtext, idx);
- if(!strlen(tmp)){
- SendClientMessage(playerid, COLOR_GREY, "USAGE: /addvehicle [model] [color_1] [color_2] [faction] [faction_rank]");
- return 1;
- }
- Color_1 = strval(tmp);
- tmp = strtok(cmdtext, idx);
- if(!strlen(tmp)){
- SendClientMessage(playerid, COLOR_GREY, "USAGE: /addvehicle [model] [color_1] [color_2] [faction] [faction_rank]");
- return 1;
- }
- Color_2 = strval(tmp);
- tmp = strtok(cmdtext, idx);
- if(!strlen(tmp)){
- Faction = -1;
- }else{
- Faction = strval(tmp);
- }
- tmp = strtok(cmdtext, idx);
- if(!strlen(tmp)){
- Faction_Rank = -1;
- }else{
- Faction_Rank = strval(tmp);
- }
- GetPlayerPos(playerid, My_X, My_Y, My_Z);
- GetPlayerFacingAngle(playerid, My_Facing_Angle);
- AddVehicle(ModelID, My_X, My_Y, My_Z, My_Facing_Angle, Color_1, Color_2, Faction, Faction_Rank);
- return 1;
- }
- }else if(strcmp(cmd, "/loadvehicles", true) == 0){
- if(IsPlayerAdministrator(playerid, 1338)){
- CallLocalFunction("LoadVehicles", "d", 0);
- return 1;
- }
- }else if(strcmp(cmd, "/addfaction", true) == 0){
- if(IsPlayerAdministrator(playerid, 1338)){
- new Type, fName[128];
- tmp = strtok(cmdtext, idx);
- if(!strlen(tmp)){
- SendClientMessage(playerid, COLOR_GREY, "USAGE: /addfaction [Type] [Name]");
- return 1;
- }
- Type = strval(tmp);
- tmp = strrest(cmdtext, idx);
- if(strlen(tmp) < 3){
- SendClientMessage(playerid, COLOR_RED, "Faction name must have at least 3 characters");
- return 1;
- }
- format(fName, sizeof(fName), "%s", tmp);
- AddFaction(fName, Type);
- return 1;
- }
- }else if(strcmp(cmd, "/setrankname", true) == 0){
- if(IsPlayerAdministrator(playerid, 1338)){
- new Faction_ID, Rank_ID, rName[128];
- tmp = strtok(cmdtext, idx);
- if(!strlen(tmp)){
- SendClientMessage(playerid, COLOR_GREY, "USAGE: /setrankname [FactionID] [Rank] [Rank_Name]");
- return 1;
- }
- Faction_ID = strval(tmp);
- tmp = strtok(cmdtext, idx);
- if(!strlen(tmp)){
- SendClientMessage(playerid, COLOR_GREY, "USAGE: /setrankname [FactionID] [Rank] [Rank_Name]");
- return 1;
- }
- Rank_ID = strval(tmp);
- tmp = strrest(cmdtext, idx);
- if(strlen(tmp) < 3){
- SendClientMessage(playerid, COLOR_RED, "Rank name must have at least 3 characters");
- return 1;
- }
- format(rName, sizeof(rName), "%s", tmp);
- SetFactionRankName(Faction_Infos[Faction_ID][fFaction_Name], Rank_ID, rName);
- new string[128];
- format(string, sizeof(string), "You changed rank name for faction %s and rank %d to %s", Faction_Infos[Faction_ID][fFaction_Name], Rank_ID, rName);
- SendClientMessage(playerid, COLOR_YELLOW, string);
- return 1;
- }
- }else if(strcmp(cmd, "/setrankskin", true) == 0){
- if(IsPlayerAdministrator(playerid, 1338)){
- new Faction_ID, Rank, SkinID, text[128];
- tmp = strtok(cmdtext, idx);
- if(!strlen(tmp)){
- SendClientMessage(playerid, COLOR_GREY, "USAGE: /setrankskin [Faction_ID] [Rank] [Skin]");
- return 1;
- }
- Faction_ID = strval(tmp);
- tmp = strtok(cmdtext, idx);
- if(!strlen(tmp)){
- SendClientMessage(playerid, COLOR_GREY, "USAGE: /setrankskin [Faction_ID] [Rank] [Skin]");
- return 1;
- }
- Rank = strval(tmp);
- tmp = strtok(cmdtext, idx);
- if(!strlen(tmp)){
- SendClientMessage(playerid, COLOR_GREY, "USAGE: /setrankskin [Faction_ID] [Rank] [Skin]");
- return 1;
- }
- SkinID = strval(tmp);
- SetFactionRankSkin(Faction_Infos[Faction_ID][fFaction_Name], Rank, SkinID);
- format(text, sizeof(text), "You set skin %d for faction %s, rank %d", SkinID, Faction_Infos[Faction_ID][fFaction_Name], Rank);
- SendClientMessage(playerid, COLOR_YELLOW, text);
- return 1;
- }
- }else if(strcmp(cmd, "/addfactionhq", true) == 0){
- if(IsPlayerAdministrator(playerid, 1338)){
- new Faction_ID, Float:ix, Float:iy, Float:iz, interior, text[128];
- tmp = strtok(cmdtext, idx);
- if(!strlen(tmp)){
- SendClientMessage(playerid, COLOR_GREY, "USAGE: /addfactionhq [Faction_ID] [Inside_X] [Inside_Y] [Inside_Z] [Interior]");
- return 1;
- }
- Faction_ID = strval(tmp);
- tmp = strtok(cmdtext, idx);
- if(!strlen(tmp)){
- SendClientMessage(playerid, COLOR_GREY, "USAGE: /addfactionhq [Faction_ID] [Inside_X] [Inside_Y] [Inside_Z] [Interior]");
- return 1;
- }
- ix = floatstr(tmp);
- tmp = strtok(cmdtext, idx);
- if(!strlen(tmp)){
- SendClientMessage(playerid, COLOR_GREY, "USAGE: /addfactionhq [Faction_ID] [Inside_X] [Inside_Y] [Inside_Z] [Interior]");
- return 1;
- }
- iy = floatstr(tmp);
- tmp = strtok(cmdtext, idx);
- if(!strlen(tmp)){
- SendClientMessage(playerid, COLOR_GREY, "USAGE: /addfactionhq [Faction_ID] [Inside_X] [Inside_Y] [Inside_Z] [Interior]");
- return 1;
- }
- iz = floatstr(tmp);
- tmp = strtok(cmdtext, idx);
- if(!strlen(tmp)){
- SendClientMessage(playerid, COLOR_GREY, "USAGE: /addfactionhq [Faction_ID] [Inside_X] [Inside_Y] [Inside_Z] [Interior]");
- return 1;
- }
- interior = strval(tmp);
- AddFactionHQ(Faction_Infos[Faction_ID][fFaction_Name], ix, iy, iz, interior, playerid);
- format(text, sizeof(text), "You created HQ for faction %s.", Faction_Infos[Faction_ID][fFaction_Name]);
- SendClientMessage(playerid, COLOR_YELLOW, text);
- return 1;
- }
- }else if(strcmp(cmd, "/loadfactions", true) == 0){
- if(IsPlayerAdministrator(playerid, 1338)){
- LoadFactions();
- return 1;
- }
- }else if(strcmp(cmd, "/factions", true) == 0){
- if(Player_Infos[playerid][pAdministrator] >= 1){
- new List_String[128];
- for(new i = 0; i<sizeof(Faction_Infos); i++){
- if(strlen(Faction_Infos[i][fFaction_Name]) >= 3){
- format(List_String, sizeof(List_String), "Faction ID %d, Name: %s", i, Faction_Infos[i][fFaction_Name]);
- SendClientMessage(playerid, COLOR_YELLOW, List_String);
- }
- }
- return 1;
- }
- }else if(strcmp(cmd, "/createhouse", true) == 0){
- if(IsPlayerAdministrator(playerid, 1338)){
- ShowPlayerDialog(playerid, 3, 1, "Create House. Step 1", "House/Street Name:", "Next", "Exit");
- return 1;
- }
- }else if(strcmp(cmd, "/enter", true) == 0){
- PutPlayerInObject(playerid);
- }else if(strcmp(cmd, "/exit", true) == 0){
- RemovePlayerFromObject(playerid);
- }else if(strcmp(cmd, "/fill", true) == 0){
- new VehID, Fuel, gsid, money;
- if(!IsPlayerInAnyVehicle(playerid)){
- SendClientMessage(playerid, COLOR_RED, "You are not in vehicle");
- return 1;
- }
- if(!IsPlayerNearGasStation(playerid, gsid)){
- SendClientMessage(playerid, COLOR_RED, "You are not at gas station.");
- return 1;
- }
- VehID = GetPlayerVehicleID(playerid);
- Fuel = 100 - VehicleFuel[VehID];
- money = (Fuel * 3) * GasStations[gsid][gssrate];
- if(money > GetPlayerCash(playerid)){
- SendClientMessage(playerid, COLOR_RED, "You need more money to fill your vehicle.");
- return 1;
- }
- if(Fuel){
- Player_Infos[playerid][pFueling] = 1;
- ToggleVehicleEngine(VehID, 0);
- GameTextForPlayer(playerid, "~y~Fueling..... ~g~Please wait...", 10000, 5);
- SetTimerEx("Fueling", 10000, false, "ddd", playerid, VehID, money);
- return 1;
- }else{
- SendClientMessage(playerid, COLOR_YELLOW, "You vehicle is full.");
- return 1;
- }
- }else if(strcmp(cmd, "/fixcar", true) == 0){
- if(GetPlayerState(playerid) != PLAYER_STATE_ONFOOT){
- SendClientMessage(playerid, COLOR_RED, "You need to be on foot to fix car.");
- return 1;
- }
- if(IsUsableCommand(0, GetJobType(playerid), "/fixcar")){
- new VehID, Float:Health, Time;
- if(GetNearestVehicleID(playerid, 2.0, VehID)){
- GetVehicleHealth(VehID, Health);
- Health = Health / 10;
- if(Health >= 100){
- SendClientMessage(playerid, COLOR_YELLOW, "This vehicle doesn't need fix.");
- return 1;
- }
- Time = 100 - floatround(Health);
- ApplyAnimation(playerid, "CAR", "Fixn_Car_Loop", 1, 1, 0, 0, 0, Time * 1000, 1);
- GameTextForPlayer(playerid, "Fixing vehicle...", Time * 1000, 3);
- SetTimerEx("FixVehicle", Time * 1000, false, "dd", playerid, VehID);
- return 1;
- }else{
- SendClientMessage(playerid, COLOR_RED, "No vehicles near...");
- return 1;
- }
- }else{
- SendClientMessage(playerid, COLOR_RED, "You can't use this command.");
- return 1;
- }
- }else if(strcmp(cmd, "/job", true) == 0){
- new JobID;
- if(Player_Infos[playerid][pJob] != 255){
- SendClientMessage(playerid, COLOR_RED, "You already have job.");
- return 1;
- }
- if(IsPlayerNearJob(playerid, JobID)){
- new str[128];
- Player_Infos[playerid][pJob] = JobID;
- format(str, sizeof(str), "You got new job. %s", Job_Infos[JobID][jName]);
- SendClientMessage(playerid, COLOR_GREEN, str);
- return 1;
- }
- }else if(strcmp(cmd, "/cuff", true) == 0){
- new Type, Rank;
- GetPlayerFactionInfos(playerid, Type, Rank);
- if(IsUsableCommand(Rank, Type, cmd) || IsPlayerAdministrator(playerid, 1338)){
- new ID, String[128];
- tmp = strtok(cmdtext, idx);
- if(!strlen(tmp)){
- SendClientMessage(playerid, COLOR_GREY, "USAGE: /cuff [PlayerID]");
- return 1;
- }
- ID = strval(tmp);
- if(!IsPlayerConnected(ID) || ID == playerid){
- SendClientMessage(playerid, COLOR_RED, "Inactive ID");
- return 1;
- }
- if(!IsPlayerNearPlayer(playerid, ID, 2.0)){
- SendClientMessage(playerid, COLOR_RED, "Player must be near you.");
- return 1;
- }
- if(Player_Infos[ID][pCuffed] == 0){
- format(String, sizeof(String), "You cuffed %s.", Player_Infos[ID][pName]);
- SendClientMessage(playerid, COLOR_YELLOW, String);
- format(String, sizeof(String), "%s cuffed you.", Player_Infos[playerid][pName]);
- SendClientMessage(ID, COLOR_BLUE, String);
- Player_Infos[ID][pCuffed] = 1;
- TogglePlayerControllable(ID, 0);
- return 1;
- }else{
- format(String, sizeof(String), "You released %s.", Player_Infos[ID][pName]);
- SendClientMessage(playerid, COLOR_YELLOW, String);
- format(String, sizeof(String), "%s released you.", Player_Infos[playerid][pName]);
- SendClientMessage(ID, COLOR_BLUE, String);
- Player_Infos[ID][pCuffed] = 0;
- TogglePlayerControllable(ID, 1);
- return 1;
- }
- }
- }else if(strcmp(cmd, "/handsup", true) == 0){
- if(!IsPlayerInAnyVehicle(playerid)){
- SetPlayerSpecialAction(playerid, SPECIAL_ACTION_HANDSUP);
- return 1;
- }
- }else if(strcmp(cmd, "/drag", true) == 0){
- new Type, Rank, ID, str[128];
- GetPlayerFactionInfos(playerid, Type, Rank);
- if(IsUsableCommand(Rank, Type, cmd)|| IsPlayerAdministrator(playerid, 1338)){
- tmp = strtok(cmdtext, idx);
- if(!strlen(tmp)){
- SendClientMessage(playerid, COLOR_GREY, "USAGE: /drag [PlayerID]");
- return 1;
- }
- ID = strval(tmp);
- if(!IsPlayerConnected(ID) || playerid == ID){
- SendClientMessage(playerid, COLOR_RED, "InactiveID");
- return 1;
- }
- if(!IsPlayerNearPlayer(playerid, ID, 2.0)){
- SendClientMessage(playerid, COLOR_RED, "You must ne near player.");
- return 1;
- }
- if(Player_Infos[ID][pTazed] == 0 && Player_Infos[ID][pCuffed] == 0 && GetPlayerSpecialAction(ID) != SPECIAL_ACTION_HANDSUP){
- SendClientMessage(playerid, COLOR_RED, "Player must be tazed/cuffed/handsup if you want to drag him.");
- return 1;
- }
- Player_Infos[ID][pCuffed] = 1;
- format(str, sizeof(str), "You are draging %s", Player_Infos[ID][pName]);
- SendClientMessage(playerid, COLOR_YELLOW, str);
- format(str, sizeof(str), "%s is draging you.", Player_Infos[playerid][pName]);
- SendClientMessage(ID, COLOR_BLUE, str);
- Player_Infos[playerid][pDraging] = ID;
- Player_Infos[ID][pDragged] = playerid;
- TogglePlayerControllable(ID, 0);
- Player_Infos[playerid][pDragingTimer] = SetTimerEx("DragPlayer", 1000, true, "dd", playerid, ID);
- return 1;
- }
- }else if(strcmp(cmd, "/stopdrag", true) == 0){
- new Type, Rank, ID, str[128];
- GetPlayerFactionInfos(playerid, Type, Rank);
- if(IsUsableCommand(Rank, Type, cmd) || IsPlayerAdministrator(playerid, 1338)){
- ID = Player_Infos[playerid][pDraging];
- if(Player_Infos[playerid][pDraging] != -1 && Player_Infos[ID][pDragged] == playerid){
- if(!Player_Infos[ID][pCuffed]){
- TogglePlayerControllable(ID, 1);
- }
- Player_Infos[playerid][pDraging] = -1;
- Player_Infos[ID][pDragged] = -1;
- KillTimer(Player_Infos[playerid][pDragingTimer]);
- format(str, sizeof(str), "You released %s", Player_Infos[ID][pName]);
- SendClientMessage(playerid, COLOR_YELLOW, str);
- format(str, sizeof(str), "%s released you", Player_Infos[playerid][pName]);
- SendClientMessage(ID, COLOR_BLUE, str);
- return 1;
- }
- }
- }else if(strcmp(cmd, "/detain", true) == 0){
- new Type, Rank, VehID, Seat, str[128], ID;
- GetPlayerFactionInfos(playerid, Type, Rank);
- if(IsUsableCommand(Rank, Type, cmd) || IsPlayerAdministrator(playerid, 1338)){
- ID = Player_Infos[playerid][pDraging];
- if(ID == -1){
- SendClientMessage(playerid, COLOR_RED, "You are not draging anyone.");
- return 1;
- }
- if(GetNearestVehicleID(playerid, 2.5, VehID)){
- if(!IsFreeSeat(VehID, 2) && !IsFreeSeat(VehID, 3)){
- SendClientMessage(playerid, COLOR_RED, "Back seat already used.");
- return 1;
- }
- if(IsFreeSeat(VehID, 2)){
- Seat = 2;
- }
- if(IsFreeSeat(VehID, 3)){
- Seat = 3;
- }
- KillTimer(Player_Infos[playerid][pDragingTimer]);
- PutPlayerInVehicle(Player_Infos[playerid][pDraging], VehID, Seat);
- TogglePlayerControllable(ID, 0);
- format(str, sizeof(str), "You placed %s into a car.", Player_Infos[ID][pName]);
- SendClientMessage(playerid, COLOR_YELLOW, str);
- format(str, sizeof(str), "%s placed you into a car.", Player_Infos[playerid][pName]);
- SendClientMessage(ID, COLOR_YELLOW, str);
- return 1;
- }
- }
- }else if(strcmp(cmd, "/takeout", true) == 0){
- new Type, Rank, ID;
- ID = Player_Infos[playerid][pDraging];
- GetPlayerFactionInfos(playerid, Type, Rank);
- if(IsUsableCommand(Rank, Type, cmd) || IsPlayerAdministrator(playerid, 1338)){
- if(ID != -1){
- RemovePlayerFromVehicle(Player_Infos[playerid][pDraging]);
- Player_Infos[playerid][pDragingTimer] = SetTimerEx("DragPlayer", 1000, true, "dd", playerid, ID);
- return 1;
- }
- }
- }else if(strcmp(cmd, "/taze", true) == 0){
- new Type, Rank, ID, str[128];
- GetPlayerFactionInfos(playerid, Type, Rank);
- if(IsUsableCommand(Rank, Type, cmd) || IsPlayerAdministrator(playerid, 1338)){
- tmp = strtok(cmdtext, idx);
- if(!strlen(tmp)){
- SendClientMessage(playerid, COLOR_GREY, "USAGE: /taze [PlayerID]");
- return 1;
- }
- ID = strval(tmp);
- if(!IsPlayerConnected(ID) || playerid == ID){
- SendClientMessage(playerid, COLOR_RED, "Invalid ID");
- return 1;
- }
- if(!IsPlayerNearPlayer(playerid, ID, 2.0)){
- SendClientMessage(playerid, COLOR_RED, "You must be near that player.");
- return 1;
- }
- Player_Infos[ID][pTazed] = 1;
- TogglePlayerControllable(ID, 0);
- SetTimerEx("TazePlayer", 10000, false, "d", ID);
- format(str, sizeof(str), "You tazed %s.", Player_Infos[ID][pName]);
- SendClientMessage(playerid, COLOR_YELLOW, str);
- format(str, sizeof(str), "%s tazed you.", Player_Infos[playerid][pName]);
- SendClientMessage(ID, COLOR_YELLOW, str);
- return 1;
- }
- }else if(!strcmp(cmd, "/heal", true)){
- new Type, Rank, ID, str[128];
- GetPlayerFactionInfos(playerid, Type, Rank);
- if(IsUsableCommand(Rank, Type, cmd) || IsPlayerAdministrator(playerid, 1338)){
- tmp = strtok(cmdtext, idx);
- if(!strlen(tmp)){
- SendClientMessage(playerid, COLOR_GREY, "USAGE: /heal [playerid]");
- return 1;
- }
- ID = strval(tmp);
- if(!IsPlayerConnected(ID) || playerid == ID){
- SendClientMessage(playerid, COLOR_RED, "Invalid ID");
- return 1;
- }
- if(!IsPlayerNearPlayer(playerid, ID, 2.0)){
- SendClientMessage(playerid, COLOR_RED, "You must be near player.");
- return 1;
- }
- SetPlayerHealth(playerid, 100.0);
- format(str, sizeof(str), "**%s healed %s**", Player_Infos[playerid][pName], Player_Infos[ID][pName]);
- SendToNearPlayers(playerid, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, 20, str);
- format(str, sizeof(str), "You healed %s.", Player_Infos[ID][pName]);
- SendClientMessage(playerid, COLOR_YELLOW, str);
- format(str, sizeof(str), "%s healed you.", Player_Infos[playerid][pName]);
- SendClientMessage(ID, COLOR_YELLOW, str);
- return 1;
- }
- }else if(!strcmp(cmd, "/aduty", true)){
- if(IsPlayerAdministrator(playerid, 1)){
- new str[128];
- Player_Infos[playerid][pADuty] = abs(Player_Infos[playerid][pADuty] - 1);
- if(Player_Infos[playerid][pADuty]){
- format(str, sizeof(str), "Administrator %s(%d) is now on duty.", Player_Infos[playerid][pName], playerid);
- }else{
- format(str, sizeof(str), "Administrator %s(%d) is now off duty.", Player_Infos[playerid][pName], playerid);
- }
- SendClientMessageToAll(COLOR_GREEN, str);
- return 1;
- }
- }else if(!strcmp(cmd, "/admins", true)){
- new str[128];
- for(new i = 0; i < MAX_PLAYERS; i++){
- if(IsPlayerConnected(i) && IsPlayerAdministrator(i, 1)){
- switch(Player_Infos[i][pADuty]){
- case 1:{
- format(str, sizeof(str), "%s(%d) on duty.", Player_Infos[i][pName], i);
- SendClientMessage(playerid, COLOR_GREEN, str);
- }
- default:{
- format(str, sizeof(str), "%s(%d) off duty.", Player_Infos[i][pName], i);
- SendClientMessage(playerid, COLOR_GREY, str);
- }
- }
- }
- }
- return 1;
- }else if(strcmp(cmd, "/goto", true) == 0){
- new Choise[12], ID, str[128], Float:X, Float:Y, Float:Z, inter, vw;
- if(!IsPlayerAdministrator(playerid, 1338)){
- return 1;
- }
- tmp = strtok(cmdtext, idx);
- if(!strlen(tmp)){
- SendClientMessage(playerid, COLOR_GREY, "USAGE: /goto [player/car/house/biz/faction/job/gasstaion/247store/bank] [id]");
- return 1;
- }
- format(Choise, sizeof(Choise), "%s", tmp);
- tmp = strtok(cmdtext, idx);
- if(!strlen(tmp)){
- format(str, sizeof(str), "USAGE: /goto %s [id]", Choise);
- SendClientMessage(playerid, COLOR_GREY, str);
- return 1;
- }
- ID = strval(tmp);
- if(!strcmp(Choise, "player", true)){
- if(!IsPlayerConnected(ID) || playerid == ID){
- SendClientMessage(playerid, COLOR_RED, "Invalid ID");
- return 1;
- }
- GetPlayerPos(ID, X, Y, Z);
- GetDirectedXY(1, ID, X, Y, 2.0, 1);
- inter = GetPlayerInterior(ID);
- vw = GetPlayerVirtualWorld(ID);
- SetPlayerInterior(playerid, inter);
- SetPlayerVirtualWorld(playerid, vw);
- SetPlayerPos(playerid, X, Y, Z);
- format(str, sizeof(str), "You teleported to %s", Player_Infos[ID][pName]);
- SendClientMessage(playerid, COLOR_PURPLE, str);
- format(str, sizeof(str), "Administrator %s teleported to you", Player_Infos[playerid][pName]);
- SendClientMessage(playerid, COLOR_PURPLE, str);
- return 1;
- }else if(!strcmp(Choise, "car", true)){
- if(!IsValidVehicle(ID)){
- SendClientMessage(playerid, COLOR_RED, "Invalid Vehicle ID");
- return 1;
- }
- GetVehiclePos(ID, X, Y, Z);
- vw = GetVehicleVirtualWorld(ID);
- SetPlayerVirtualWorld(playerid, vw);
- SetPlayerPos(playerid, X, Y, Z+1.3);
- return 1;
- }else if(!strcmp(Choise, "house", true)){
- if(!strlen(HouseInfos[ID][HouseName])){
- SendClientMessage(playerid, COLOR_RED, "Invalid House ID");
- return 1;
- }
- format(str, sizeof(str), "You have teleported to house %s(%d)", HouseInfos[ID][HouseName], ID);
- SendClientMessage(playerid, COLOR_PURPLE, str);
- SetPlayerPos(playerid, HouseInfos[ID][HouseEnterX], HouseInfos[ID][HouseEnterY], HouseInfos[ID][HouseEnterZ]);
- return 1;
- }else if(!strcmp(Choise, "biz", true)){
- if(!strlen(Business_Infos[ID][bizName])){
- SendClientMessage(playerid, COLOR_RED, "Invalid Business ID");
- return 1;
- }
- format(str, sizeof(str), "You have teleported to business %s(%d)", Business_Infos[ID][bizName], ID);
- SendClientMessage(playerid, COLOR_PURPLE, str);
- SetPlayerPos(playerid, Business_Infos[ID][bizEntrance_X], Business_Infos[ID][bizEntrance_Y], Business_Infos[ID][bizEntrance_Z]);
- return 1;
- }else if(!strcmp(Choise, "faction", true)){
- if(!strlen(Faction_Infos[ID][fFaction_Name])){
- SendClientMessage(playerid, COLOR_RED, "Invalid Faction ID");
- return 1;
- }
- format(str, sizeof(str), "You have teleported to faction %s(%d)", Faction_Infos[ID][fFaction_Name], ID);
- SendClientMessage(playerid, COLOR_PURPLE, str);
- SetPlayerPos(playerid, Faction_Infos[ID][fFaction_HQ_X], Faction_Infos[ID][fFaction_HQ_Y], Faction_Infos[ID][fFaction_HQ_Z]);
- return 1;
- }else if(!strcmp(Choise, "job", true)){
- if(!strlen(Job_Infos[ID][jName])){
- SendClientMessage(playerid, COLOR_RED, "Invalid Job ID");
- return 1;
- }
- format(str, sizeof(str), "You have teleported to job %s(%d)", Job_Infos[ID][jName], ID);
- SendClientMessage(playerid, COLOR_PURPLE, str);
- SetPlayerPos(playerid, Job_Infos[ID][jPos_X], Job_Infos[ID][jPos_Y], Job_Infos[ID][jPos_Z]);
- return 1;
- }else if(!strcmp(Choise, "gasstation", true)){
- if(!strlen(GasStations[ID][gssname])){
- SendClientMessage(playerid, COLOR_RED, "Invalid Job ID");
- return 1;
- }
- format(str, sizeof(str), "You have teleported to gasstation %s(%d)", GasStations[ID][gssname], ID);
- SendClientMessage(playerid, COLOR_PURPLE, str);
- SetPlayerPos(playerid, GasStations[ID][gssx], GasStations[ID][gssy], GasStations[ID][gssz]);
- return 1;
- }
- }else if(!strcmp(cmd, "/gethere", true)){
- if(IsPlayerAdministrator(playerid, 1)){
- new Float:X, Float:Y, Float:Z, ID, inter, vw, str[128];
- tmp = strtok(cmdtext, idx);
- if(!strlen(tmp)){
- SendClientMessage(playerid, COLOR_GREY, "USAGE: /gethere [playerid]");
- return 1;
- }
- ID = strval(tmp);
- if(!IsPlayerConnected(ID) || playerid == ID){
- SendClientMessage(playerid, COLOR_RED, "Invalid ID");
- return 1;
- }
- GetPlayerPos(playerid, X, Y, Z);
- inter = GetPlayerInterior(playerid);
- vw = GetPlayerVirtualWorld(playerid);
- GetDirectedXY(1, ID, X, Y, 2.0, 1);
- SetPlayerVirtualWorld(ID, vw);
- SetPlayerInterior(ID, inter);
- SetPlayerPos(ID, X, Y, Z);
- format(str, sizeof(str), "You teleported %s(%d) to your position.", Player_Infos[ID][pName], ID);
- SendClientMessage(playerid, COLOR_PURPLE, str);
- format(str, sizeof(str), "Administrator %s(%d) teleported you to their position.", Player_Infos[playerid][pName], playerid);
- SendClientMessage(ID, COLOR_PURPLE, str);
- return 1;
- }
- }else if(strcmp(cmd, "/giveadmin", true) == 0){
- new ID, Level, str[128];
- if(IsPlayerAdministrator(playerid, 1338)){
- tmp = strtok(cmdtext, idx);
- if(!strlen(tmp)){
- SendClientMessage(playerid, COLOR_GREY, "USAGE: /giveadmin [PlayerID] [Level]");
- return 1;
- }
- ID = strval(tmp);
- if(!IsPlayerConnected(ID) || playerid == ID){
- SendClientMessage(playerid, COLOR_RED, "Inactive ID");
- return 1;
- }
- tmp = strtok(cmdtext, idx);
- if(!strlen(tmp)){
- SendClientMessage(playerid, COLOR_GREY, "USAGE: /giveadmin [PlayerID] [Level]");
- return 1;
- }
- Level = strval(tmp);
- Player_Infos[ID][pAdministrator] = Level;
- format(str, sizeof(str), "You set admin level %d to player %s(%d)", Level, Player_Infos[ID][pName], ID);
- SendClientMessage(playerid, COLOR_YELLOW, str);
- format(str, sizeof(str), "Administrator %s(%d) set your admin level to %d", Player_Infos[playerid][pName], playerid, Level);
- SendClientMessage(ID, COLOR_GREEN, str);
- return 1;
- }
- }else if(strcmp(cmd, "/loadhouses", true) == 0){
- if(IsPlayerAdministrator(playerid, 1338)){
- LoadHouses();
- return 1;
- }
- }else if(strcmp(cmd, "/createmapicon", true) == 0){
- if(IsPlayerAdministrator(playerid, 1338)){
- new Icon_Type;
- tmp = strtok(cmdtext, idx);
- if(!strlen(tmp)){
- SendClientMessage(playerid, COLOR_GREY, "USAGE: /createmapicon [Icon]");
- return 1;
- }
- Icon_Type = strval(tmp);
- AddMapIcon(playerid, Icon_Type);
- LoadMapIcons();
- return 1;
- }
- }else if(strcmp(cmd, "/addbiz", true) == 0){
- if(IsPlayerAdministrator(playerid, 1338)){
- new Biz_Name[128], Biz_Price, Float:IntX, Float:IntY, Float:IntZ, Int, Biz_String[128];
- tmp = strtok(cmdtext, idx);
- if(!strlen(tmp)){
- SendClientMessage(playerid, COLOR_GREY, "USAGE: /addbiz [Business_Name] [Price] [Interior_X] [Interior_Y] [Interior_Z] [Interior]");
- return 1;
- }
- format(Biz_Name, sizeof(Biz_Name), "%s", tmp);
- tmp = strtok(cmdtext, idx);
- if(!strlen(tmp)){
- SendClientMessage(playerid, COLOR_GREY, "USAGE: /addbiz [Business_Name] [Price] [Interior_X] [Interior_Y] [Interior_Z] [Interior]");
- return 1;
- }
- Biz_Price = strval(tmp);
- tmp = strtok(cmdtext, idx);
- if(!strlen(tmp)){
- SendClientMessage(playerid, COLOR_GREY, "USAGE: /addbiz [Business_Name] [Price] [Interior_X] [Interior_Y] [Interior_Z] [Interior]");
- return 1;
- }
- IntX = floatstr(tmp);
- tmp = strtok(cmdtext, idx);
- if(!strlen(tmp)){
- SendClientMessage(playerid, COLOR_GREY, "USAGE: /addbiz [Business_Name] [Price] [Interior_X] [Interior_Y] [Interior_Z] [Interior]");
- return 1;
- }
- IntY = floatstr(tmp);
- tmp = strtok(cmdtext, idx);
- if(!strlen(tmp)){
- SendClientMessage(playerid, COLOR_GREY, "USAGE: /addbiz [Business_Name] [Price] [Interior_X] [Interior_Y] [Interior_Z] [Interior]");
- return 1;
- }
- IntZ = floatstr(tmp);
- tmp = strtok(cmdtext, idx);
- if(!strlen(tmp)){
- SendClientMessage(playerid, COLOR_GREY, "USAGE: /addbiz [Business_Name] [Price] [Interior_X] [Interior_Y] [Interior_Z] [Interior]");
- return 1;
- }
- Int = strval(tmp);
- AddBusiness(playerid, Biz_Name, "For_Sale", 0, 1, Biz_Price, 1, IntX, IntY, IntZ, Int);
- format(Biz_String, sizeof(Biz_String), "You created business %s", Biz_Name);
- SendClientMessage(playerid, COLOR_YELLOW, Biz_String);
- return 1;
- }
- }else if(strcmp(cmd, "/loadbusiness", true) == 0){
- if(IsPlayerAdministrator(playerid, 1338)){
- LoadBusiness();
- return 1;
- }
- }else if(!strcmp(cmd, "/engine", true) || !strcmp(cmd, "/e", true)){
- new VehicleID;
- if(IsPlayerInAnyVehicle(playerid)){
- if(Player_Infos[playerid][pFueling] == 1){
- SendClientMessage(playerid, COLOR_RED, "You can not start engine, fueling...");
- return 1;
- }
- VehicleID = GetPlayerVehicleID(playerid);
- new engine, lights, alarm, doors, bonnet, boot, objective;
- GetVehicleParamsEx(VehicleID, engine, lights, alarm, doors, bonnet, boot, objective);
- if(engine == 0){
- if(VehicleFuel[VehicleID] == 0){
- SendClientMessage(playerid, COLOR_YELLOW, "No fuel, you cant start engine.");
- return 1;
- }
- GameTextForPlayer(playerid, "~b~Starting engine", 2000, 5);
- SetTimerEx("SwitchEngineOn", 2000, false, "dd", playerid, VehicleID);
- }else{
- ToggleVehicleEngine(VehicleID, 0);
- }
- return 1;
- }
- }else if(strcmp(cmd, "/lights", true) == 0){
- new engine, lights, alarm, doors, bonnet, boot, objective;
- new PlayerVehicle = GetPlayerVehicleID(playerid);
- GetVehicleParamsEx(PlayerVehicle, engine, lights, alarm, doors, bonnet, boot, objective);
- if(lights == 1){
- SetVehicleParamsEx(PlayerVehicle, engine, 0, alarm, doors, bonnet, boot, objective);
- }else{
- SetVehicleParamsEx(PlayerVehicle, engine, 1, alarm, doors, bonnet, boot, objective);
- }
- return 1;
- }else if(strcmp(cmd, "/mycars", true) == 0){
- new Vehicle_1[30], Vehicle_2[30], Vehicle_3[30], Spawned, MyCarsString[128];
- if(Player_Infos[playerid][pVehicle_1_Key] != 999){
- for(new v1 = 0; v1 < sizeof(buyablevehicles); v1++){
- if(buyablevehicles[v1][bvModel] == Player_Infos[playerid][pVehicle_1_Key]){
- format(Vehicle_1, sizeof(Vehicle_1), "%s", buyablevehicles[v1][bvName]);
- }
- }
- }else{
- format(Vehicle_1, sizeof(Vehicle_1), "None");
- }
- if(Player_Infos[playerid][pVehicle_2_Key] != 999){
- for(new v2 = 0; v2 < sizeof(buyablevehicles); v2++){
- if(buyablevehicles[v2][bvModel] == Player_Infos[playerid][pVehicle_2_Key]){
- format(Vehicle_2, sizeof(Vehicle_2), "%s", buyablevehicles[v2][bvName]);
- }
- }
- }else{
- format(Vehicle_2, sizeof(Vehicle_2), "None");
- }
- if(Player_Infos[playerid][pVehicle_3_Key] != 999){
- for(new v3 = 0; v3 < sizeof(buyablevehicles); v3++){
- if(buyablevehicles[v3][bvModel] == Player_Infos[playerid][pVehicle_3_Key]){
- format(Vehicle_3, sizeof(Vehicle_3), "%s", buyablevehicles[v3][bvName]);
- }
- }
- }else{
- format(Vehicle_3, sizeof(Vehicle_3), "None");
- }
- if(Player_Infos[playerid][pSpawned_Vehicle] != -1){
- Spawned = Player_Infos[playerid][pSpawned_Vehicle];
- }
- format(MyCarsString, sizeof(MyCarsString), "Slot 1: %s, Slot 2: %s, Slot 3: %s, Spawned ID: %d", Vehicle_1, Vehicle_2, Vehicle_3, Spawned);
- SendClientMessage(playerid, COLOR_YELLOW, MyCarsString);
- return 1;
- }else if(strcmp(cmd, "/v", true) == 0 || strcmp(cmd, "/vehicle", true) == 0){
- new Player_Vehicle_ID = GetPlayerVehicleID(playerid);
- new Option[128];
- tmp = strtok(cmdtext, idx);
- if(!strlen(tmp)){
- SendClientMessage(playerid, COLOR_GREY, "USAGE: /v [get/park/lock/save/paint/buy/sell/accept]");
- return 1;
- }
- format(Option, sizeof(Option), "%s", tmp);
- if(strcmp(Option, "get", true) == 0){
- if(Player_Infos[playerid][pSpawned_Vehicle] != -1){
- SendClientMessage(playerid, COLOR_BLUE, "You have already spawned a vehicle.\n Please park it firs.");
- return 1;
- }
- tmp = strtok(cmdtext, idx);
- if(!strval(tmp) || strval(tmp) < 1 && strval(tmp) > 3){
- SendClientMessage(playerid, COLOR_GREY, "USAGE: /v get [Slot_ID(1,2,3)]");
- return 1;
- }
- new PlateID;
- switch(strval(tmp)){
- case 1:{
- if(Player_Infos[playerid][pVehicle_1_Key] == 999){
- SendClientMessage(playerid, COLOR_RED, "You don't have vehicle in that slot.");
- return 1;
- }
- Player_Infos[playerid][pSpawned_Vehicle] = CreateVehicle(Player_Infos[playerid][pVehicle_1_Key], Player_Infos[playerid][pPark_X], Player_Infos[playerid][pPark_Y], Player_Infos[playerid][pPark_Z],Player_Infos[playerid][pPark_FA], Player_Infos[playerid][pVehicle_1_Color_1], Player_Infos[playerid][pVehicle_1_Color_2], -1);
- UpdateVehicleDamageStatus(Player_Infos[playerid][pSpawned_Vehicle], Player_Infos[playerid][pVehicle_1_Panel_Status], Player_Infos[playerid][pVehicle_1_Doors_Status], Player_Infos[playerid][pVehicle_1_Lights_Status], Player_Infos[playerid][pVehicle_1_Tires_Status]);
- SetVehicleHealth(Player_Infos[playerid][pSpawned_Vehicle], Player_Infos[playerid][pVehicle_1_Health]);
- PlateID = Player_Infos[playerid][pVehicle_1_Plate];
- VehicleFuel[Player_Infos[playerid][pSpawned_Vehicle]] = Player_Infos[playerid][pVehicle_1_Fuel];
- }
- case 2:{
- if(Player_Infos[playerid][pVehicle_2_Key] == 999){
- SendClientMessage(playerid, COLOR_RED, "You don't have vehicle in that slot.");
- return 1;
- }
- Player_Infos[playerid][pSpawned_Vehicle] = CreateVehicle(Player_Infos[playerid][pVehicle_2_Key], Player_Infos[playerid][pPark_X], Player_Infos[playerid][pPark_Y], Player_Infos[playerid][pPark_Z],Player_Infos[playerid][pPark_FA], Player_Infos[playerid][pVehicle_2_Color_1], Player_Infos[playerid][pVehicle_2_Color_2], -1);
- UpdateVehicleDamageStatus(Player_Infos[playerid][pSpawned_Vehicle], Player_Infos[playerid][pVehicle_2_Panel_Status], Player_Infos[playerid][pVehicle_2_Doors_Status], Player_Infos[playerid][pVehicle_2_Lights_Status], Player_Infos[playerid][pVehicle_2_Tires_Status]);
- SetVehicleHealth(Player_Infos[playerid][pSpawned_Vehicle], Player_Infos[playerid][pVehicle_2_Health]);
- PlateID = Player_Infos[playerid][pVehicle_2_Plate];
- VehicleFuel[Player_Infos[playerid][pSpawned_Vehicle]] = Player_Infos[playerid][pVehicle_2_Fuel];
- }
- case 3:{
- if(Player_Infos[playerid][pVehicle_3_Key] == 999){
- SendClientMessage(playerid, COLOR_RED, "You don't have vehicle in that slot.");
- return 1;
- }
- Player_Infos[playerid][pSpawned_Vehicle] = CreateVehicle(Player_Infos[playerid][pVehicle_3_Key], Player_Infos[playerid][pPark_X], Player_Infos[playerid][pPark_Y], Player_Infos[playerid][pPark_Z],Player_Infos[playerid][pPark_FA], Player_Infos[playerid][pVehicle_3_Color_1], Player_Infos[playerid][pVehicle_3_Color_2], -1);
- UpdateVehicleDamageStatus(Player_Infos[playerid][pSpawned_Vehicle], Player_Infos[playerid][pVehicle_3_Panel_Status], Player_Infos[playerid][pVehicle_3_Doors_Status], Player_Infos[playerid][pVehicle_3_Lights_Status], Player_Infos[playerid][pVehicle_3_Tires_Status]);
- SetVehicleHealth(Player_Infos[playerid][pSpawned_Vehicle], Player_Infos[playerid][pVehicle_3_Health]);
- PlateID = Player_Infos[playerid][pVehicle_3_Plate];
- VehicleFuel[Player_Infos[playerid][pSpawned_Vehicle]] = Player_Infos[playerid][pVehicle_3_Fuel];
- }
- }
- Player_Infos[playerid][pSpawned_Vehicle_Slot] = strval(tmp);
- SetVehicleParamsEx(Player_Infos[playerid][pSpawned_Vehicle], 0, 0, 0, 0, 0, 0, 0);
- SetVehicleZAngle(Player_Infos[playerid][pSpawned_Vehicle], Player_Infos[playerid][pPark_FA]);
- new Plate[64];
- format(Plate, sizeof(Plate), "LH-%d", PlateID);
- SetVehicleNumberPlate(Player_Infos[playerid][pSpawned_Vehicle], Plate);
- SetPlayerCheckpoint(playerid, Player_Infos[playerid][pPark_X], Player_Infos[playerid][pPark_Y], Player_Infos[playerid][pPark_Z], 5.0);
- return 1;
- }else if(strcmp(Option, "park", true) == 0){
- if(Player_Infos[playerid][pSpawned_Vehicle] == -1){
- SendClientMessage(playerid, COLOR_RED, "You havent spawned any vehicle");
- return 1;
- }
- if(!IsPlayerInAnyVehicle(playerid)){
- SendClientMessage(playerid, COLOR_RED, "You are not in your vehicle.");
- return 1;
- }
- if(Player_Vehicle_ID != Player_Infos[playerid][pSpawned_Vehicle]){
- SendClientMessage(playerid, COLOR_RED, "This is not your vehicle.");
- return 1;
- }
- if(IsPlayerInRangeOfPoint(playerid, 10, Player_Infos[playerid][pPark_X], Player_Infos[playerid][pPark_Y], Player_Infos[playerid][pPark_Z])){
- if(Player_Infos[playerid][pSpawned_Vehicle_Slot] == 1){
- GetVehicleDamageStatus(Player_Infos[playerid][pSpawned_Vehicle], Player_Infos[playerid][pVehicle_1_Panel_Status], Player_Infos[playerid][pVehicle_1_Doors_Status], Player_Infos[playerid][pVehicle_1_Lights_Status], Player_Infos[playerid][pVehicle_1_Tires_Status]);
- GetVehicleHealth(Player_Infos[playerid][pSpawned_Vehicle], Player_Infos[playerid][pVehicle_1_Health]);
- Player_Infos[playerid][pVehicle_1_Fuel] = VehicleFuel[Player_Infos[playerid][pSpawned_Vehicle]];
- }else if(Player_Infos[playerid][pSpawned_Vehicle_Slot] == 2){
- GetVehicleDamageStatus(Player_Infos[playerid][pSpawned_Vehicle], Player_Infos[playerid][pVehicle_2_Panel_Status], Player_Infos[playerid][pVehicle_2_Doors_Status], Player_Infos[playerid][pVehicle_2_Lights_Status], Player_Infos[playerid][pVehicle_2_Tires_Status]);
- GetVehicleHealth(Player_Infos[playerid][pSpawned_Vehicle], Player_Infos[playerid][pVehicle_2_Health]);
- Player_Infos[playerid][pVehicle_2_Fuel] = VehicleFuel[Player_Infos[playerid][pSpawned_Vehicle]];
- }else if(Player_Infos[playerid][pSpawned_Vehicle_Slot] == 3){
- GetVehicleDamageStatus(Player_Infos[playerid][pSpawned_Vehicle], Player_Infos[playerid][pVehicle_3_Panel_Status], Player_Infos[playerid][pVehicle_3_Doors_Status], Player_Infos[playerid][pVehicle_3_Lights_Status], Player_Infos[playerid][pVehicle_3_Tires_Status]);
- GetVehicleHealth(Player_Infos[playerid][pSpawned_Vehicle], Player_Infos[playerid][pVehicle_3_Health]);
- Player_Infos[playerid][pVehicle_3_Fuel] = VehicleFuel[Player_Infos[playerid][pSpawned_Vehicle]];
- }
- DestroyVehicle(Player_Infos[playerid][pSpawned_Vehicle]);
- Player_Infos[playerid][pSpawned_Vehicle] = -1;
- return 1;
- }else{
- SendClientMessage(playerid, COLOR_RED, "You are not near your parking, marker will show you parking position.");
- SetPlayerCheckpoint(playerid, Player_Infos[playerid][pPark_X], Player_Infos[playerid][pPark_Y], Player_Infos[playerid][pPark_Z], 3.0);
- return 1;
- }
- }else if(strcmp(Option, "lock", true) == 0){
- new Lock_Unlock[16], Lock_String[128], Float:Veh_X, Float:Veh_Y, Float:Veh_Z;
- new engine, lights, alarm, doors, bonnet, boot, objective;
- GetVehicleParamsEx(Player_Infos[playerid][pSpawned_Vehicle], engine, lights, alarm, doors, bonnet, boot, objective);
- if(doors == 0){
- format(Lock_Unlock, sizeof(Lock_Unlock), "locked");
- }else {
- format(Lock_Unlock, sizeof(Lock_Unlock), "unlocked");
- }
- if(IsPlayerInVehicle(playerid, Player_Infos[playerid][pSpawned_Vehicle])){
- if(strcmp(Lock_Unlock, "locked", true) == 0){
- SetVehicleParamsEx(Player_Infos[playerid][pSpawned_Vehicle], engine, lights, alarm, 1, bonnet, boot, objective);
- }else{
- SetVehicleParamsEx(Player_Infos[playerid][pSpawned_Vehicle], engine, lights, alarm, 0, bonnet, boot, objective);
- }
- format(Lock_String, sizeof(Lock_String), "***%s %s their vehicle.", Player_Infos[playerid][pName], Lock_Unlock);
- }else{
- GetVehiclePos(Player_Infos[playerid][pSpawned_Vehicle], Veh_X, Veh_Y, Veh_Z);
- if(IsPlayerInRangeOfPoint(playerid, 5.0, Veh_X, Veh_Y, Veh_Z)){
- if(strcmp(Lock_Unlock, "locked", true) == 0){
- SetVehicleParamsEx(Player_Infos[playerid][pSpawned_Vehicle], engine, lights, alarm, 1, bonnet, boot, objective);
- }else{
- SetVehicleParamsEx(Player_Infos[playerid][pSpawned_Vehicle], engine, lights, alarm, 0, bonnet, boot, objective);
- }
- format(Lock_String, sizeof(Lock_String), "***%s pressed button and %s their vehicle.", Player_Infos[playerid][pName], Lock_Unlock);
- }else{
- return 1;
- }
- }
- SendToNearPlayers(playerid, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, 20.0, Lock_String);
- return 1;
- }else if(strcmp(Option, "save", true) == 0){
- new Float:MPX, Float:MPY, Float:MPZ, Float:MFA;
- if(Player_Infos[playerid][pSpawned_Vehicle] == -1){
- SendClientMessage(playerid, COLOR_RED, "You didn't spawned your vehicle, /v get [SlotID]");
- return 1;
- }
- if(IsPlayerInVehicle(playerid, Player_Infos[playerid][pSpawned_Vehicle])){
- GetVehiclePos(Player_Infos[playerid][pSpawned_Vehicle], MPX, MPY, MPZ);
- GetVehicleZAngle(Player_Infos[playerid][pSpawned_Vehicle], MFA);
- Player_Infos[playerid][pPark_X] = MPX;
- Player_Infos[playerid][pPark_Y] = MPY;
- Player_Infos[playerid][pPark_Z] = MPZ;
- Player_Infos[playerid][pPark_FA] = MFA;
- SendClientMessage(playerid, COLOR_YELLOW, "Parking position saved.");
- }
- }else if(strcmp(Option, "buy", true) == 0){
- new NearShop = -1;
- if(Player_Infos[playerid][pVehicle_1_Key] != 999 && Player_Infos[playerid][pVehicle_2_Key] != 999 && Player_Infos[playerid][pVehicle_3_Key] != 999){
- SendClientMessage(playerid, COLOR_BLUE, "All vehicle slots are used");
- return 1;
- }
- for(new shop = 0; shop < MAX_VEHICLES_SHOPS; shop++){
- if(IsPlayerInRangeOfPoint(playerid, 15.0, Vehicles_Shops[shop][vsX], Vehicles_Shops[shop][vsY], Vehicles_Shops[shop][vsZ])){
- NearShop = shop;
- break;
- }
- }
- if(NearShop != -1){
- new vtext[256], vi, Vehicle_Price, Vehicle;
- new show = sizeof(buyablevehicles);
- tmp = strtok(cmdtext, idx);
- if(!strlen(tmp)){
- new show2 = show / 3;
- for(new v; v<show2; v++){
- vi = v * 3;
- format(vtext, sizeof(vtext), "ID: %d - Name: %s, Price: %d$ | ID: %d - Name: %s, Price: %d$ | ID: %d - Name: %s, Price: %d$", buyablevehicles[vi][bvModel], buyablevehicles[vi][bvName], buyablevehicles[vi][bvPrice], buyablevehicles[vi+1][bvModel], buyablevehicles[vi+1][bvName], buyablevehicles[vi+1][bvPrice], buyablevehicles[vi+2][bvModel], buyablevehicles[vi+2][bvName], buyablevehicles[vi+2][bvPrice]);
- SendClientMessage(playerid, COLOR_YELLOW,vtext);
- }
- return 1;
- }
- Vehicle = strval(tmp);
- new CanBuy = 0;
- for(new vsi = 0; vsi < show; vsi++){
- if(buyablevehicles[vsi][bvModel] == Vehicle){
- Vehicle_Price = buyablevehicles[vsi][bvPrice];
- CanBuy = 1;
- }
- }
- if(CanBuy != 0){
- if(Player_Infos[playerid][pCash] >= Vehicle_Price){
- GivePlayerCash(playerid, -Vehicle_Price);
- SendClientMessage(playerid, COLOR_BLUE, "Seller gave you keys from your new vehicle.");
- if(Player_Infos[playerid][pVehicle_1_Key] == 999){
- Player_Infos[playerid][pVehicle_1_Key] = strval(tmp);
- Player_Infos[playerid][pVehicle_1_Fuel] = 50;
- if(Player_Infos[playerid][pSpawned_Vehicle] != -1){
- SendClientMessage(playerid, COLOR_YELLOW, "You have one spawned vehicle, park that one, and /v get the one you just bought(vehicle will spawn on your parking location).");
- return 1;
- }
- Player_Infos[playerid][pSpawned_Vehicle] = CreateVehicle(strval(tmp), Vehicles_Shops[NearShop][vsvsx],Vehicles_Shops[NearShop][vsvsy], Vehicles_Shops[NearShop][vsvsz], Vehicles_Shops[NearShop][vsvsfa], 0, 0, 600);
- return 1;
- }else if(Player_Infos[playerid][pVehicle_2_Key] == 999){
- Player_Infos[playerid][pVehicle_2_Key] = strval(tmp);
- Player_Infos[playerid][pVehicle_2_Fuel] = 50;
- if(Player_Infos[playerid][pSpawned_Vehicle] != -1){
- SendClientMessage(playerid, COLOR_YELLOW, "You have one spawned vehicle, park that one, and /v get the one you just bought(vehicle will spawn on your parking location).");
- return 1;
- }
- Player_Infos[playerid][pSpawned_Vehicle] = CreateVehicle(strval(tmp), Vehicles_Shops[NearShop][vsvsx],Vehicles_Shops[NearShop][vsvsy], Vehicles_Shops[NearShop][vsvsz], Vehicles_Shops[NearShop][vsvsfa], 0, 0, 600);
- return 1;
- }else if(Player_Infos[playerid][pVehicle_3_Key] == 999){
- Player_Infos[playerid][pVehicle_3_Key] = strval(tmp);
- Player_Infos[playerid][pVehicle_3_Fuel] = 50;
- if(Player_Infos[playerid][pSpawned_Vehicle] != -1){
- SendClientMessage(playerid, COLOR_YELLOW, "You have one spawned vehicle, park that one, and /v get the one you just bought(vehicle will spawn on your parking location).");
- return 1;
- }
- Player_Infos[playerid][pSpawned_Vehicle] = CreateVehicle(strval(tmp), Vehicles_Shops[NearShop][vsvsx],Vehicles_Shops[NearShop][vsvsy], Vehicles_Shops[NearShop][vsvsz], Vehicles_Shops[NearShop][vsvsfa], 0, 0, 600);
- VehicleFuel[Player_Infos[playerid][pSpawned_Vehicle]] = 50;
- return 1;
- }else{
- SendClientMessage(playerid, COLOR_RED, "All vehicles slots are full");
- }
- }else{
- SendClientMessage(playerid, COLOR_RED, "You can not afford this vehicle right now, get more money.");
- return 1;
- }
- }else{
- SendClientMessage(playerid, COLOR_BLUE, "We dont have vehicle you are looking for.");
- return 1;
- }
- }else{
- SendClientMessage(playerid, COLOR_RED, "You are not near dealership.");
- return 1;
- }
- }else if(strcmp(Option, "paint", true) == 0){
- if(IsPlayerInVehicle(playerid, Player_Infos[playerid][pSpawned_Vehicle])){
- new Color_1, Color_2;
- tmp = strtok(cmdtext, idx);
- if(!strlen(tmp)){
- SendClientMessage(playerid, COLOR_GREY, "USAGE: /v paint [color1] [color2]");
- return 1;
- }
- Color_1 = strval(tmp);
- tmp = strtok(cmdtext, idx);
- if(!strlen(tmp)){
- SendClientMessage(playerid, COLOR_GREY, "USAGE: /v paint [color1] [color2]");
- return 1;
- }
- Color_2 = strval(tmp);
- switch(Player_Infos[playerid][pSpawned_Vehicle_Slot]){
- case 1:{
- Player_Infos[playerid][pVehicle_1_Color_1] = Color_1;
- Player_Infos[playerid][pVehicle_1_Color_2] = Color_2;
- }
- case 2:{
- Player_Infos[playerid][pVehicle_2_Color_1] = Color_1;
- Player_Infos[playerid][pVehicle_2_Color_2] = Color_2;
- }
- case 3:{
- Player_Infos[playerid][pVehicle_3_Color_1] = Color_1;
- Player_Infos[playerid][pVehicle_3_Color_2] = Color_2;
- }
- }
- ChangeVehicleColor(Player_Infos[playerid][pSpawned_Vehicle], Color_1, Color_2);
- }else{
- SendClientMessage(playerid, COLOR_RED, "You must be in your vehicle.");
- return 1;
- }
- }else if(strcmp(Option, "sell", true) == 0){
- new stmp[128], sid, price, vehicle_sell_string[256];
- if(Player_Infos[playerid][pSpawned_Vehicle] == -1){
- SendClientMessage(playerid, COLOR_RED, "You have to /v get vehicle that you want to sell.");
- return 1;
- }
- stmp = strtok(cmdtext, idx);
- if(strlen(stmp) == 0){
- SendClientMessage(playerid, COLOR_GREY, "USAGE: /v sell [id] [price]");
- return 1;
- }
- sid = strval(stmp);
- stmp = strtok(cmdtext, idx);
- if(strlen(stmp) == 0){
- SendClientMessage(playerid, COLOR_GREY, "USAGE: /v sell [id] [price]");
- return 1;
- }
- price = strval(stmp);
- if(!IsPlayerConnected(sid)){
- SendClientMessage(playerid, COLOR_RED,"Inactive player.");
- return 1;
- }
- if(playerid == sid){
- SendClientMessage(playerid, COLOR_GREY, "You can not sell to your self.");
- return 1;
- }
- if(IsPlayerNearPlayer(playerid, sid, 5.0)){
- if(Player_Infos[sid][pVehicle_1_Key] != 999 && Player_Infos[sid][pVehicle_2_Key] != 999 && Player_Infos[sid][pVehicle_3_Key] != 999){
- SendClientMessage(playerid, COLOR_BLUE, "Player has no free slot for vehicles.");
- return 1;
- }
- OfferVehiclePlayer[sid] = playerid;
- OfferVehiclePrice[sid] = price;
- OfferVehicleModel[sid] = GetVehicleModel(Player_Infos[playerid][pSpawned_Vehicle]);
- OfferedVehicle[sid] = 1;
- new vehicle_sell[128], svModel[128];
- for(new bavs = 0; bavs < sizeof(buyablevehicles); bavs++){
- if(buyablevehicles[bavs][bvModel] == OfferVehicleModel[sid]){
- format(svModel, sizeof(svModel), "%s", buyablevehicles[bavs][bvName]);
- }
- }
- new Seller_Name[24];
- GetPlayerName(playerid, Seller_Name, sizeof(Seller_Name));
- format(vehicle_sell_string, sizeof(vehicle_sell_string), "Player %s offer you vehicle %s for %d$", Seller_Name, svModel, price);
- SendClientMessage(sid, COLOR_YELLOW, vehicle_sell);
- return 1;
- }
- }else if(strcmp(Option, "accept", true) == 0){
- new string[128], buyer_name[24];
- if(OfferedVehicle[playerid] == 1){
- if(GetPlayerMoney(playerid) >= OfferVehiclePrice[playerid]){
- if(IsPlayerNearPlayer(playerid, OfferVehiclePlayer[playerid], 10.0)){
- GetPlayerName(playerid, buyer_name, sizeof(buyer_name));
- format(string, sizeof(string), "%s has bought a vehicle from you for $%d.", buyer_name, OfferVehiclePrice[playerid]);
- SendClientMessage(OfferVehiclePlayer[playerid], COLOR_WHITE, string);
- GetPlayerName(OfferVehiclePlayer[playerid], buyer_name, sizeof(buyer_name));
- format(string, sizeof(string), "You have bought a vehicle from %s for $%d.", buyer_name, OfferVehiclePrice[playerid]);
- SendClientMessage(playerid, COLOR_WHITE, string);
- if(Player_Infos[playerid][pVehicle_1_Key] == 999){
- Player_Infos[playerid][pVehicle_1_Key] = OfferVehicleModel[playerid];
- }else if(Player_Infos[playerid][pVehicle_2_Key] == 999){
- Player_Infos[playerid][pVehicle_2_Key] = OfferVehicleModel[playerid];
- }else if(Player_Infos[playerid][pVehicle_3_Key] == 999){
- Player_Infos[playerid][pVehicle_3_Key] = OfferVehicleModel[playerid];
- }
- if(Player_Infos[OfferVehiclePlayer[playerid]][pSpawned_Vehicle_Slot] == 1){
- Player_Infos[OfferVehiclePlayer[playerid]][pVehicle_1_Key] = 999;
- }else if(Player_Infos[OfferVehiclePlayer[playerid]][pSpawned_Vehicle_Slot] == 2){
- Player_Infos[OfferVehiclePlayer[playerid]][pVehicle_2_Key] = 999;
- }else if(Player_Infos[OfferVehiclePlayer[playerid]][pSpawned_Vehicle_Slot] == 3){
- Player_Infos[OfferVehiclePlayer[playerid]][pVehicle_3_Key] = 999;
- }
- DestroyVehicle(Player_Infos[playerid][pSpawned_Vehicle]);
- Player_Infos[playerid][pSpawned_Vehicle] = Player_Infos[OfferVehiclePlayer[playerid]][pSpawned_Vehicle];
- Player_Infos[OfferVehiclePlayer[playerid]][pSpawned_Vehicle] = -1;
- GivePlayerCash(OfferVehiclePlayer[playerid], OfferVehiclePrice[playerid]);
- GivePlayerCash(playerid, -OfferVehiclePrice[playerid]);
- new NameP[64];
- GetPlayerName(playerid, NameP, sizeof(NameP));
- SaveAccount(NameP, 0);
- GetPlayerName(OfferVehiclePlayer[playerid], NameP, sizeof(NameP));
- SaveAccount(NameP, 0);
- return 1;
- }else{
- SendClientMessage(playerid, COLOR_RED, "You are not near player.");
- return 1;
- }
- }else{
- SendClientMessage(playerid, COLOR_RED, "You dont have enough cash.");
- return 1;
- }
- }else{
- SendClientMessage(playerid, COLOR_RED, "There is no vehicle offer.");
- return 1;
- }
- }
- }else if(strcmp(cmd, "/pay", true) == 0){
- new PayID, Amount;
- tmp = strtok(cmdtext, idx);
- if(!strlen(tmp)){
- SendClientMessage(playerid, COLOR_GREY, "USAGE: /pay [PlayerID] [Amount]");
- return 1;
- }
- PayID = strval(tmp);
- tmp = strtok(cmdtext, idx);
- if(!strlen(tmp)){
- SendClientMessage(playerid, COLOR_GREY, "USAGE: /pay [PlayerID] [Amount]");
- return 1;
- }
- Amount = strval(tmp);
- Amount = abs(Amount);
- new Pay_String[128];
- if(!IsPlayerConnected(PayID) || PayID == playerid){
- SendClientMessage(playerid, COLOR_GREY, "Wrong id.");
- return 1;
- }
- if(IsPlayerNearPlayer(playerid, PayID, 3.0)){
- if(GetPlayerCash(playerid) >= Amount){
- GivePlayerCash(playerid, -Amount);
- GivePlayerCash(PayID, Amount);
- format(Pay_String, sizeof(Pay_String), "You gave %d$ to %s.", Amount, Player_Infos[PayID][pName]);
- SendClientMessage(playerid, COLOR_BLUE, Pay_String);
- format(Pay_String, sizeof(Pay_String), "%s gave you %d$.", Player_Infos[playerid][pName], Amount);
- SendClientMessage(playerid, COLOR_BLUE, Pay_String);
- return 1;
- }else{
- SendClientMessage(playerid, COLOR_RED, "You don't have that much money.");
- return 1;
- }
- }
- }else if(strcmp(cmd, "/o", true) == 0){
- new OOC_String[256];
- tmp = strrest(cmdtext, idx);
- if(OOC_Enabled == true){
- if(!strlen(tmp)){
- return 1;
- }
- format(OOC_String, sizeof(OOC_String), "%s: %s", Player_Infos[playerid][pName], tmp);
- SendClientMessageToAll(COLOR_GREY, OOC_String);
- }else{
- SendClientMessage(playerid, COLOR_RED, "OOC Channel disabled by admin");
- return 1;
- }
- }else if(strcmp(cmd, "/me", true) == 0){
- new Me_String[256];
- tmp = strrest(cmdtext, idx);
- if(!strlen(tmp)){
- SendClientMessage(playerid, COLOR_GREY, "USAGE: /me [Text]");
- return 1;
- }
- format(Me_String, sizeof(Me_String), "%s %s", Player_Infos[playerid][pName], tmp);
- SendToNearPlayers(playerid, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, 10.0, Me_String);
- return 1;
- }else if(strcmp(cmd, "/w", true) == 0){
- new W_ID, W_String[256];
- tmp = strtok(cmdtext, idx);
- if(!strlen(tmp)){
- SendClientMessage(playerid, COLOR_GREY, "USAGE: /w [PlayerID] [Text]");
- return 1;
- }
- W_ID = strval(tmp);
- tmp = strrest(cmdtext, idx);
- if(!strlen(tmp)){
- SendClientMessage(playerid, COLOR_GREY, "USAGE: /w [PlayerID] [Text]");
- return 1;
- }
- if(IsPlayerNearPlayer(playerid, W_ID, 2.0) && IsPlayerConnected(W_ID) && W_ID != playerid){
- format(W_String, sizeof(W_String), "You to %s: %s", Player_Infos[W_ID][pName], tmp);
- SendClientMessage(playerid, COLOR_YELLOW, W_String);
- format(W_String, sizeof(W_String), "%s wgisper's to You: %s", Player_Infos[playerid][pName], tmp);
- SendClientMessage(W_ID, COLOR_YELLOW, W_String);
- format(W_String, sizeof(W_String), "%s whisper's something to %s", Player_Infos[playerid][pName], Player_Infos[W_ID][pName]);
- SendToNearPlayers(playerid, COLOR_FADE1, COLOR_FADE2, COLOR_FADE3, COLOR_FADE4, COLOR_FADE5, 10.0, W_String);
- }else{
- SendClientMessage(playerid, COLOR_RED, "You must be near that player");
- return 1;
- }
- }else if(strcmp(cmd, "/s", true) == 0){
- new Shout_String[256];
- tmp = strrest(cmdtext, idx);
- if(!strlen(tmp)){
- SendClientMessage(playerid, COLOR_GREY, "USAGE: /s [Text]");
- return 1;
- }
- format(Shout_String, sizeof(Shout_String), "%s shouts: %s", Player_Infos[playerid][pName], tmp);
- SendToNearPlayers(playerid, COLOR_FADE1, COLOR_FADE2, COLOR_FADE3, COLOR_FADE4, COLOR_FADE5, 20.0, Shout_String);
- return 1;
- }else if(strcmp(cmd, "/b", true) == 0){
- new Local_OOC_String[256];
- tmp = strrest(cmdtext, idx);
- if(!strlen(tmp)){
- SendClientMessage(playerid, COLOR_GREY, "USAGE: /b [Text]");
- return 1;
- }
- format(Local_OOC_String, sizeof(Local_OOC_String), "((%s: %s))", Player_Infos[playerid][pName], tmp);
- SendToNearPlayers(playerid, COLOR_FADE1, COLOR_FADE2, COLOR_FADE3, COLOR_FADE4, COLOR_FADE5, 10.0, Local_OOC_String);
- return 1;
- }else if(strcmp(cmd, "/f", true) == 0){
- new Faction_Chat[256];
- if(Player_Infos[playerid][pFaction] == 255){
- SendClientMessage(playerid, COLOR_RED, "You are not in faction.");
- return 1;
- }
- tmp = strrest(cmdtext, idx);
- if(!strlen(tmp)){
- SendClientMessage(playerid, COLOR_GREY, "USAGE: /f [Text]");
- return 1;
- }
- format(Faction_Chat, sizeof(Faction_Chat), "(Faction)%s: %s", Player_Infos[playerid][pName], tmp);
- for(new i=0;i<MAX_PLAYERS;i++){
- if(IsPlayerConnected(i) && Player_Infos[i][pFaction] == Player_Infos[playerid][pFaction]){
- SendClientMessage(i, COLOR_FADE3, Faction_Chat);
- }
- }
- return 1;
- }else if(strcmp(cmd, "/do", true) == 0){
- new Do_String[128];
- tmp = strrest(cmdtext, idx);
- if(!strlen(tmp)){
- SendClientMessage(playerid, COLOR_GREY, "USAGE: /do [Action]");
- return 1;
- }
- format(Do_String, sizeof(Do_String), "%s ((%s))", Player_Infos[playerid][pName], tmp);
- SendToNearPlayers(playerid, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, 10.0, Do_String);
- return 1;
- }else if(strcmp(cmd, "/togphone", true) == 0){
- new Tog_Phone_String[128];
- new Color;
- if(Player_Infos[playerid][pMobile_Num] != 0){
- Player_Infos[playerid][pMobile_Tog] = abs(Player_Infos[playerid][pMobile_Tog] - 1);
- if(Player_Infos[playerid][pMobile_Tog] == 0){
- Color = COLOR_GREEN;
- format(Tog_Phone_String, sizeof(Tog_Phone_String), "You phone is now off.");
- }else{
- Color = COLOR_RED;
- format(Tog_Phone_String, sizeof(Tog_Phone_String), "You phone is now on");
- }
- SendClientMessage(playerid, Color, Tog_Phone_String);
- return 1;
- }else{
- SendClientMessage(playerid, COLOR_RED, "You don't have cellphone.");
- return 1;
- }
- }else if(strcmp(cmd, "/balance", true) == 0){
- if(Player_Infos[playerid][pInObject] != -1 && Player_Infos[playerid][pObjectType] == 5 || IsPlayerNearATM(playerid)){
- BankSystem("balance", -1, playerid, -1);
- return 1;
- }else{
- SendClientMessage(playerid, COLOR_RED, "You are not in bank or near atm.");
- return 1;
- }
- }else if(strcmp(cmd, "/addbank", true) == 0){
- if(IsPlayerAdministrator(playerid, 1338)){
- new Float:IntX, Float:IntY, Float:IntZ, Int;
- tmp = strtok(cmdtext,idx);
- if(!strlen(tmp)){
- AddBank(2315.952880, -1.618174, 26.742187, 0, playerid);
- SendClientMessage(playerid, COLOR_GREEN, "Bank has been created.");\
- LoadBanks();
- return 1;
- }
- IntX = floatstr(tmp);
- tmp = strtok(cmdtext,idx);
- if(!strlen(tmp)){
- AddBank(2315.952880, -1.618174, 26.742187, 0, playerid);
- SendClientMessage(playerid, COLOR_GREEN, "Bank has been created.");
- LoadBanks();
- return 1;
- }
- IntY = floatstr(tmp);
- tmp = strtok(cmdtext,idx);
- if(!strlen(tmp)){
- AddBank(2315.952880, -1.618174, 26.742187, 0, playerid);
- SendClientMessage(playerid, COLOR_GREEN, "Bank has been created.");
- LoadBanks();
- return 1;
- }
- IntZ = floatstr(tmp);
- tmp = strtok(cmdtext,idx);
- if(!strlen(tmp)){
- AddBank(2315.952880, -1.618174, 26.742187, 0, playerid);
- SendClientMessage(playerid, COLOR_GREEN, "Bank has been created.");
- LoadBanks();
- return 1;
- }
- Int = strval(tmp);
- AddBank(IntX, IntY, IntZ, Int, playerid);
- SendClientMessage(playerid, COLOR_GREEN, "Bank has been created.");
- LoadBanks();
- return 1;
- }
- return 1;
- }else if(strcmp(cmd, "/loadbanks", true) == 0){
- if(IsPlayerAdministrator(playerid, 1338)){
- LoadBanks();
- return 1;
- }
- return 1;
- }else if(strcmp(cmd, "/deposit", true) == 0){
- new Money;
- if(Player_Infos[playerid][pInObject] != -1 && Player_Infos[playerid][pObjectType] == 5 || IsPlayerNearATM(playerid)){
- tmp = strtok(cmdtext, idx);
- if(!strlen(tmp)){
- SendClientMessage(playerid, COLOR_GREY, "USAGE: /deposid [Amount]");
- return 1;
- }
- Money = BankSystem("deposit", strval(tmp), playerid, -1);
- if(!Money){
- SendClientMessage(playerid, COLOR_RED, "You don't have that much money.");
- return 1;
- }
- return 1;
- }else{
- SendClientMessage(playerid, COLOR_RED, "You are not in bank or near atm.");
- return 1;
- }
- }else if(strcmp(cmd, "/withdraw", true) == 0){
- new Money;
- if(Player_Infos[playerid][pInObject] != -1 && Player_Infos[playerid][pObjectType] == 5 || IsPlayerNearATM(playerid)){
- tmp = strtok(cmdtext, idx);
- if(!strlen(tmp)){
- SendClientMessage(playerid, COLOR_GREY, "USAGE: /withdraw [Amount]");
- return 1;
- }
- Money = BankSystem("withdraw", strval(tmp), playerid, -1);
- if(!Money){
- SendClientMessage(playerid, COLOR_RED, "You don't have that much money.");
- return 1;
- }
- return 1;
- }else{
- SendClientMessage(playerid, COLOR_RED, "You are not in bank or near atm.");
- return 1;
- }
- }else if(strcmp(cmd, "/transfer", true) == 0){
- new Transfer_String[256], Money, GiveID;
- if(Player_Infos[playerid][pInObject] != -1 && Player_Infos[playerid][pObjectType] == 5 || IsPlayerNearATM(playerid)){
- tmp = strtok(cmdtext, idx);
- if(!strlen(tmp)){
- SendClientMessage(playerid, COLOR_GREY, "USAGE: /transfer [PlayerID] [Amount]");
- return 1;
- }
- GiveID = strval(tmp);
- tmp = strtok(cmdtext, idx);
- if(!strlen(tmp)){
- SendClientMessage(playerid, COLOR_GREY, "USAGE: /transfer [PlayerID] [Amount]");
- return 1;
- }
- Money = strval(tmp);
- if(!IsPlayerConnected(GiveID)){
- SendClientMessage(playerid, COLOR_GREY, "Inactive id.");
- return 1;
- }
- if(Player_Infos[playerid][pBank] < Money){
- SendClientMessage(playerid, COLOR_RED, "You don't have that much money.");
- return 1;
- }
- BankSystem("transfer", Money, playerid, GiveID);
- format(Transfer_String, sizeof(Transfer_String), "You trasfered %d$ to %s bank account.", Money, Player_Infos[GiveID][pName]);
- SendClientMessage(playerid, COLOR_BLUE, Transfer_String);
- format(Transfer_String, sizeof(Transfer_String), "%s trasfered %d$ to your bank account.", Player_Infos[playerid][pName], Money);
- SendClientMessage(playerid, COLOR_BLUE, Transfer_String);
- return 1;
- }else{
- SendClientMessage(playerid, COLOR_RED, "You are not in bank or near atm.");
- return 1;
- }
- }else if(strcmp(cmd, "/house", true) == 0){
- new Option[24];
- tmp = strtok(cmdtext, idx);
- if(!strlen(tmp)){
- SendClientMessage(playerid, COLOR_GREY, "USAGE: /house [key/lock,buy,sell,store]");
- return 1;
- }
- format(Option, sizeof(Option), "%s", tmp);
- if(strcmp(Option, "key", true) == 0){
- new key_string[64];
- format(key_string, sizeof(key_string), "House key: %d", Player_Infos[playerid][pHouse_Key]);
- SendClientMessage(playerid, COLOR_WHITE, key_string);
- return 1;
- }
- if(strcmp(Option, "lock", true) == 0){
- if(Player_Infos[playerid][pHouse_Key] == 999){
- SendClientMessage(playerid, COLOR_RED, "You dont have a house.");
- return 1;
- }
- for(new i = 0; i < MAX_HOUSES; i++){
- if(strcmp(HouseInfos[i][OwnerName], Player_Infos[playerid][pName], true) == 0){
- if(IsPlayerInRangeOfPoint(playerid, 5, HouseInfos[i][HouseEnterX], HouseInfos[i][HouseEnterY], HouseInfos[i][HouseEnterZ])){
- if(HouseInfos[i][Locked] == 1){
- HouseInfos[i][Locked] = 0;
- GameTextForPlayer(playerid, "~g~Unlocked", 2000, 5);
- return 1;
- }else{
- HouseInfos[i][Locked] = 1;
- GameTextForPlayer(playerid, "~r~Locked", 2000, 5);
- return 1;
- }
- }else{
- SendClientMessage(playerid, COLOR_RED, "You are not near your house.");
- return 1;
- }
- }
- }
- }else if(strcmp(Option, "buy", true) == 0){
- new hbstring[128];
- if(Player_Infos[playerid][pHouse_Key] != 999){
- SendClientMessage(playerid, COLOR_RED, "You already own the house.");
- return 1;
- }
- for(new i = 0; i < MAX_HOUSES; i++){
- if(IsPlayerInRangeOfPoint(playerid, 5, HouseInfos[i][HouseEnterX], HouseInfos[i][HouseEnterY], HouseInfos[i][HouseEnterZ])){
- if(HouseInfos[i][OnSale] != 1){
- SendClientMessage(playerid, COLOR_RED, "This house is not on sale.");
- return 1;
- }
- if(GetPlayerCash(playerid) >= HouseInfos[i][Price]){
- Player_Infos[playerid][pHouse_Key] = i;
- HouseInfos[i][OnSale] = 0;
- format(HouseInfos[i][OwnerName], 24, "%s", Player_Infos[playerid][pName]);
- Delete3DTextLabel(HouseInfos[i][hTextLabelID]);
- format(hbstring, sizeof(hbstring), "%s, Owner: %s", HouseInfos[i][HouseName], Player_Infos[playerid][pName]);
- HouseInfos[i][hTextLabelID] = Create3DTextLabel(hbstring, 0x0000BBAA, HouseInfos[i][HouseEnterX], HouseInfos[i][HouseEnterY], HouseInfos[i][HouseEnterZ], 20, 0, 0);
- GameTextForPlayer(playerid, "~g~You bought the house", 3000, 5);
- GivePlayerCash(playerid, -HouseInfos[i][Price]);
- ReloadHousesFile();
- return 1;
- }
- }
- }
- }else if(strcmp(Option, "sell", true) == 0){
- new ID, SellPrice, hSell_String[128];
- if(Player_Infos[playerid][pHouse_Key] == 999){
- SendClientMessage(playerid, COLOR_RED, "You dont have a house");
- return 1;
- }
- tmp = strtok(cmdtext, idx);
- if(!strlen(tmp)){
- SendClientMessage(playerid, COLOR_GREY, "USAGE: /house sell [playerid] [price]");
- return 1;
- }
- ID = strval(tmp);
- tmp = strtok(cmdtext, idx);
- if(!strlen(tmp)){
- SendClientMessage(playerid, COLOR_GREY, "USAGE: /house sell [playerid] [price]");
- return 1;
- }
- SellPrice = strval(tmp);
- if(!IsPlayerConnected(ID)){
- SendClientMessage(playerid, COLOR_RED, "Inactive player");
- return 1;
- }
- if(!IsPlayerNearPlayer(playerid, ID, 5.0)){
- SendClientMessage(playerid, COLOR_RED, "Player must be near");
- return 1;
- }
- if(Player_Infos[ID][pHouse_Key] != 999){
- SendClientMessage(playerid, COLOR_RED, "Player already own the house");
- return 1;
- }
- format(hSell_String, sizeof(hSell_String), "%s want to sell you house for %d$, /house accept", Player_Infos[playerid][pName], SellPrice);
- SendClientMessage(ID, COLOR_WHITE, hSell_String);
- OfferedHouse[ID] = Player_Infos[playerid][pHouse_Key];
- OfferedHousePrice[ID] = SellPrice;
- OfferedHousePlayer[ID] = playerid;
- return 1;
- }else if(strcmp(Option, "accept", true) == 0){
- new Accept_String[128], hbstring[128];
- if(OfferedHouse[playerid] == -1){
- return 1;
- }
- if(GetPlayerCash(playerid) < OfferedHousePrice[playerid]){
- SendClientMessage(playerid, COLOR_RED, "You dont have enought money");
- return 1;
- }
- format(Accept_String, sizeof(Accept_String), "%s bought house from you for %d$", Player_Infos[playerid][pName], OfferedHousePrice[playerid]);
- SendClientMessage(OfferedHousePlayer[playerid], COLOR_WHITE, Accept_String);
- format(Accept_String, sizeof(Accept_String), "You bought house from %s for %d$", Player_Infos[OfferedHousePlayer[playerid]], OfferedHousePrice[playerid]);
- SendClientMessage(playerid, COLOR_WHITE, Accept_String);
- GivePlayerCash(playerid, -OfferedHousePrice[playerid]);
- GivePlayerCash(OfferedHousePlayer[playerid], OfferedHousePrice[playerid]);
- Player_Infos[playerid][pHouse_Key] = OfferedHouse[playerid];
- Player_Infos[OfferedHousePlayer[playerid]][pHouse_Key] = 999;
- Delete3DTextLabel(HouseInfos[Player_Infos[playerid][pHouse_Key]][hTextLabelID]);
- format(hbstring, sizeof(hbstring), "%s, Owner: %s", HouseInfos[Player_Infos[playerid][pHouse_Key]][HouseName], Player_Infos[playerid][pName]);
- HouseInfos[Player_Infos[playerid][pHouse_Key]][hTextLabelID] = Create3DTextLabel(hbstring, 0x0000BBAA, HouseInfos[Player_Infos[playerid][pHouse_Key]][HouseEnterX], HouseInfos[Player_Infos[playerid][pHouse_Key]][HouseEnterY], HouseInfos[Player_Infos[playerid][pHouse_Key]][HouseEnterZ], 20, 0, 0);
- ReloadHousesFile();
- return 1;
- }
- }else if(strcmp(cmd, "/business", true) == 0){
- new Option[10];
- new bizID = Player_Infos[playerid][pBiz_Key];
- tmp = strtok(cmdtext, idx);
- if(!strlen(tmp)){
- SendClientMessage(playerid, COLOR_GREY, "USAGE: /business [buy/sell/fee/lock]");
- return 1;
- }
- format(Option, sizeof(Option), "%s", tmp);
- if(strcmp(Option, "buy", true) == 0){
- if(bizID != 999){
- SendClientMessage(playerid, COLOR_RED, "You already own a business.");
- return 1;
- }
- for(new i = 0; i < MAX_BUSINESS; i++){
- if(IsPlayerInRangeOfPoint(playerid, 5, Business_Infos[i][bizEntrance_X], Business_Infos[i][bizEntrance_Y], Business_Infos[i][bizEntrance_Z])){
- if(Business_Infos[i][bizOn_Sale] == 0){
- SendClientMessage(playerid, COLOR_RED, "This business is not for sale.");
- return 1;
- }
- if(GetPlayerCash(playerid) < Business_Infos[i][bizPrice]){
- SendClientMessage(playerid, COLOR_RED, "You dont have enought money.");
- return 1;
- }
- format(Business_Infos[i][bizOwner_Name], 24, "%s", Player_Infos[playerid][pName]);
- Business_Infos[i][bizOn_Sale] = 0;
- Player_Infos[playerid][pBiz_Key] = i;
- GivePlayerCash(playerid, -Business_Infos[i][bizPrice]);
- GameTextForPlayer(playerid, "~g~You bought a business", 2000, 5);
- ReloadBusinessFile();
- }
- }
- }else if(strcmp(Option, "key", true) == 0){
- new KeyS[64];
- format(KeyS, sizeof(KeyS), "Biz key %d", bizID);
- SendClientMessage(playerid, COLOR_WHITE, KeyS);
- return 1;
- }else if(strcmp(Option, "lock", true) == 0){
- if(bizID == 999){
- SendClientMessage(playerid, COLOR_RED, "You doesn't own any business");
- return 1;
- }
- if(IsPlayerInRangeOfPoint(playerid, 5, Business_Infos[bizID][bizEntrance_X], Business_Infos[bizID][bizEntrance_Y], Business_Infos[bizID][bizEntrance_Z])){
- if(Business_Infos[bizID][bizLocked] == 0){
- Business_Infos[bizID][bizLocked] = 1;
- GameTextForPlayer(playerid, "~b~Business ~r~locked", 2000, 5);
- return 1;
- }else{
- Business_Infos[bizID][bizLocked] = 0;
- GameTextForPlayer(playerid, "~b~Business ~g~unlocked", 2000, 5);
- return 1;
- }
- }else{
- SendClientMessage(playerid, COLOR_RED, "You are not near your business.");
- return 1;
- }
- }else if(strcmp(Option, "sell", true) == 0){
- new bSell_Price, bSell_Buyer, bSell_String[128];
- if(bizID == 999){
- SendClientMessage(playerid, COLOR_RED, "You doesn't own any business");
- return 1;
- }
- tmp = strtok(cmdtext, idx);
- if(!strlen(tmp)){
- SendClientMessage(playerid, COLOR_GREY, "USAGE: /business sell [playerid] [price]");
- return 1;
- }
- bSell_Buyer = strval(tmp);
- tmp = strtok(cmdtext, idx);
- if(!strlen(tmp)){
- SendClientMessage(playerid, COLOR_GREY, "USAGE: /business sell [playerid] [price]");
- return 1;
- }
- bSell_Price = strval(tmp);
- if(!IsPlayerNearPlayer(playerid, bSell_Buyer, 3.0)){
- SendClientMessage(playerid, COLOR_RED, "Player must be near you.");
- return 1;
- }
- if(!IsPlayerConnected(bSell_Buyer)){
- SendClientMessage(playerid, COLOR_RED, "Inactive player");
- return 1;
- }
- if(Player_Infos[bSell_Buyer][pBiz_Key] != 999){
- SendClientMessage(playerid, COLOR_RED, "Player already have business.");
- return 1;
- }
- OfferedBusiness[bSell_Buyer] = bizID;
- OfferedBusinessPlayer[bSell_Buyer] = playerid;
- OfferedBusinessPrice[bSell_Buyer] = bSell_Price;
- format(bSell_String, sizeof(bSell_String), "%s want to sell you business for %d$, type /business accept to buy it", Player_Infos[playerid][pName], bSell_Price);
- SendClientMessage(bSell_Buyer, COLOR_WHITE, bSell_String);
- return 1;
- }else if(strcmp(Option, "accept", true) == 0){
- if(OfferedBusiness[playerid] == -1){
- return 1;
- }
- if(GetPlayerCash(playerid) < OfferedBusinessPrice[playerid]){
- SendClientMessage(playerid, COLOR_RED, "You don't have enough money.");
- OfferedBusiness[playerid] = -1;
- OfferedBusinessPrice[playerid] = 0;
- OfferedBusinessPlayer[playerid] = -1;
- return 1;
- }
- GivePlayerCash(playerid, -OfferedBusinessPrice[playerid]);
- Player_Infos[playerid][pBiz_Key] = OfferedBusiness[playerid];
- Player_Infos[OfferedBusinessPlayer[playerid]][pBiz_Key] = -1;
- GameTextForPlayer(playerid, "~g~You bought new business", 2000, 5);
- GameTextForPlayer(OfferedBusinessPlayer[playerid], "~r~You sold your business", 2000, 5);
- OfferedBusiness[playerid] = -1;
- OfferedBusinessPrice[playerid] = 0;
- OfferedBusinessPlayer[playerid] = -1;
- return 1;
- }
- }else if(strcmp(cmd, "/addvehicleshop", true) == 0){
- if(IsPlayerAdministrator(playerid, 1338)){
- tmp = strrest(cmdtext, idx);
- if(strlen(tmp) < 5){
- SendClientMessage(playerid, COLOR_RED, "Shop name must have at least 5 characters");
- return 1;
- }
- AddVehicleShop(playerid, tmp);
- return 1;
- }
- }else if(strcmp(cmd, "/loadvehicleshop", true) == 0){
- if(IsPlayerAdministrator(playerid, 1338)){
- LoadVehicleShops();
- return 1;
- }
- }else if(strcmp(cmd, "/vehicleshops", true) == 0){
- new VSS[128];
- if(IsPlayerAdministrator(playerid, 1338)){
- for(new i = 0; i<sizeof(Vehicles_Shops);i++){
- if(strlen(Vehicles_Shops[i][vsName])){
- format(VSS, sizeof(VSS), "%d: %s, %f, %f, %f, %f", i, Vehicles_Shops[i][vsName], Vehicles_Shops[i][vsvsx], Vehicles_Shops[i][vsvsy], Vehicles_Shops[i][vsvsz], Vehicles_Shops[i][vsvsfa]);
- SendClientMessage(playerid, COLOR_YELLOW, VSS);
- }
- }
- return 1;
- }
- }else if(strcmp(cmd, "/setvehiclespawn", true) == 0){
- tmp = strtok(cmdtext, idx);
- if(IsPlayerAdministrator(playerid, 1338)){
- if(!strlen(tmp)){
- SendClientMessage(playerid, COLOR_GREY, "USAGE: /setvehiclespawn [Vehicle ShopID]");
- return 1;
- }
- return SetVehicleSpawn(strval(tmp), playerid);
- }
- }else if(strcmp(cmd, "/loadvehiclespawns", true) == 0){
- if(IsPlayerAdministrator(playerid, 1338)){
- return LoadVehicleSpawns();
- }
- }else if(strcmp(cmd, "/add247store", true) == 0){
- if(IsPlayerAdministrator(playerid, 1338)){
- tmp = strtok(cmdtext, idx);
- if(!strlen(tmp)){
- SendClientMessage(playerid, COLOR_GREY, "USAGE /add247store [Type (1,2,3,4,5,6)]");
- return 1;
- }
- if(strval(tmp) > 6 && strval(tmp) < 1){
- SendClientMessage(playerid, COLOR_GREY, "USAGE /add247store [Type (1,2,3,4,5,6)]");
- return 1;
- }
- Add247(playerid, strval(tmp));
- return 1;
- }
- }else if(strcmp(cmd, "/load247", true) == 0){
- if(IsPlayerAdministrator(playerid, 1338)){
- Load247();
- return 1;
- }
- }else if(strcmp(cmd, "/houses", true) == 0){
- if(Player_Infos[playerid][pAdministrator] >= 1){
- new send[128];
- for(new i = 0; i < MAX_HOUSES; i++){
- if(strlen(HouseInfos[i][OwnerName]) >= 5){
- format(send, sizeof(send), "%s, %s, %d, %d", HouseInfos[i][OwnerName], HouseInfos[i][HouseName], HouseInfos[i][OnSale], i);
- SendClientMessage(playerid, COLOR_YELLOW, send);
- }
- }
- }
- }else if(strcmp(cmd, "/addatm", true) == 0){
- if(Player_Infos[playerid][pAdministrator] != 1338){
- return 1;
- }else{
- AddAtm(playerid);
- SendClientMessage(playerid, COLOR_YELLOW, "You added ATM at your current possition");
- }
- }else if(strcmp(cmd, "/loadatms", true) == 0){
- if(IsPlayerAdministrator(playerid, 1338)){
- LoadAtms();
- SendClientMessage(playerid, COLOR_GREEN, "ATMS Loaded...");
- return 1;
- }
- }else if(strcmp(cmd, "/addspeedcam", true) == 0){
- if(IsPlayerAdministrator(playerid, 1338)){
- tmp = strtok(cmdtext, idx);
- if(!strlen(tmp)){
- SendClientMessage(playerid, COLOR_GREY, "USAGE: /addspeedcam [Max Speed]");
- return 1;
- }
- if(strval(tmp) < 20){
- SendClientMessage(playerid, COLOR_RED, "Max speed must be at least 20");
- return 1;
- }
- AddSpeedCam(playerid, strval(tmp));
- SendClientMessage(playerid, COLOR_GREEN, "You added speedcam on your position...");
- return 1;
- }
- }else if(strcmp(cmd, "/loadspeedcams", true) == 0){
- if(IsPlayerAdministrator(playerid, 1338)){
- LoadSpeedCams();
- return 1;
- }
- }else if(strcmp(cmd, "/addgasstation", true) == 0){
- if(IsPlayerAdministrator(playerid, 1338)){
- new rate;
- tmp = strtok(cmdtext, idx);
- if(!strlen(tmp)){
- SendClientMessage(playerid, COLOR_GREY, "USAGE: /addgasstaion [Rate] [Name]");
- return 1;
- }
- rate = strval(tmp);
- if(rate < 1) rate = 1;
- tmp = strrest(cmdtext, idx);
- if(!strlen(tmp)){
- SendClientMessage(playerid, COLOR_GREY, "USAGE: /addgasstaion [Rate] [Name]");
- return 1;
- }
- AddGasStation(playerid, rate, tmp);
- SendClientMessage(playerid, COLOR_GREEN, "Gas Station added...");
- return 1;
- }
- }else if(strcmp(cmd, "/loadgasstations", true) == 0){
- if(IsPlayerAdministrator(playerid, 1338)){
- if(LoadGasStations()) SendClientMessage(playerid, COLOR_GREEN, "Gas Stations Loaded...");
- return 1;
- }
- }else if(strcmp(cmd, "/setcommand", true) ==0){
- if(IsPlayerAdministrator(playerid, 1338)){
- new Rank, Type;
- tmp = strtok(cmdtext, idx);
- if(!strlen(tmp)){
- SendClientMessage(playerid, COLOR_GREY, "USAGE: /setcommand [Rank] [Type] [Command]");
- return 1;
- }
- Rank = strval(tmp);
- tmp = strtok(cmdtext, idx);
- if(!strlen(tmp)){
- SendClientMessage(playerid, COLOR_GREY, "USAGE: /setcommand [Rank] [Type] [Command]");
- return 1;
- }
- Type = strval(tmp);
- tmp = strtok(cmdtext, idx);
- if(!strlen(tmp)){
- SendClientMessage(playerid, COLOR_GREY, "USAGE: /setcommand [Rank] [Type] [Command]");
- return 1;
- }
- AddUsableCommand(Rank, Type, tmp);
- SendClientMessage(playerid, COLOR_GREEN, "Command added to usable...");
- return 1;
- }
- }else if(strcmp(cmd, "/loadcommands", true) == 0){
- if(IsPlayerAdministrator(playerid, 1338)){
- tmp = strtok(cmdtext, idx);
- if(!strlen(tmp)){
- SendClientMessage(playerid, COLOR_GREY, "USAGE: /loadcommands [Type]");
- return 1;
- }
- if(LoadUsableCommands(strval(tmp))) SendClientMessage(playerid, COLOR_GREEN, "Commands Loaded...");
- return 1;
- }
- }else{
- SendClientMessage(playerid, COLOR_RED, "Unknown command.");
- return 1;
- }
- return 1;
- }
- public OnPlayerPickUpPickup(playerid, pickupid){
- new PickUpString[256];
- if(PickUps[pickupid][puModel] == 1273){
- for(new i = 0; i < MAX_HOUSES; i++){
- if(IsPlayerInRangeOfPoint(playerid, 2.0, HouseInfos[i][HouseEnterX], HouseInfos[i][HouseEnterY], HouseInfos[i][HouseEnterZ])){
- if(HouseInfos[i][OnSale] == 1){
- format(PickUpString, sizeof(PickUpString), "~g~This house is on sale~n~~b~Price~b~ ~w~%d$~w~", HouseInfos[i][Price]);
- GameTextForPlayer(playerid, PickUpString, 3000, 6);
- return 1;
- }
- if(HouseInfos[i][Locked] == 1){
- format(PickUpString, sizeof(PickUpString), "~r~Locked", HouseInfos[i][Price]);
- GameTextForPlayer(playerid, PickUpString, 3000, 6);
- return 1;
- }
- }
- }
- }else if(PickUps[pickupid][puModel] == 1210){
- new jS[128];
- for(new ji = 0; ji < MAX_JOBS; ji++){
- if(IsPlayerInRangeOfPoint(playerid, 2.0, Job_Infos[ji][jPos_X], Job_Infos[ji][jPos_Y], Job_Infos[ji][jPos_Z])){
- format(jS, sizeof(jS), "~w~Type /job get to become: ~g~%s", Job_Infos[ji][jName]);
- GameTextForPlayer(playerid, jS, 3000, 5);
- }
- }
- }else if(PickUps[pickupid][puModel] == 1239){
- new string_1239[128];
- for(new bi = 0; bi < MAX_BUSINESS; bi++){
- if(IsPlayerInRangeOfPoint(playerid, 2.0, Business_Infos[bi][bizEntrance_X], Business_Infos[bi][bizEntrance_Y], Business_Infos[bi][bizEntrance_Z])){
- format(string_1239, sizeof(string_1239), "~w~Business: ~b~%s~n~~w~Owner: ~b~%s", Business_Infos[bi][bizName], Business_Infos[bi][bizOwner_Name]);
- GameTextForPlayer(playerid, string_1239, 3000, 5);
- }
- }
- }
- return 1;
- }
- public OnPlayerStateChange(playerid, newstate, oldstate){
- new str[128];
- if(newstate == PLAYER_STATE_DRIVER){
- new engine, lights, alarm, doors, bonnet, boot, objective;
- new vehicleid = GetPlayerVehicleID(playerid);
- GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
- SpeedoTimer[playerid] = SetTimerEx("Speedo", 1000, true, "d", playerid);
- ShowSpeedo[playerid] = 1;
- if(Player_Infos[playerid][pSpawned_Vehicle] == vehicleid){
- if(engine == 0){
- SendClientMessage(playerid, COLOR_YELLOW, "Engine is off, press SPACE or type /e to start engine.");
- return 1;
- }
- }
- if(LoadedVehicles[vehicleid][vFaction] != Player_Infos[playerid][pFaction] && LoadedVehicles[vehicleid][vFaction_Rank] != Player_Infos[playerid][pFaction_Rank]){
- new rank_name[32];
- switch(LoadedVehicles[vehicleid][vFaction_Rank]){
- case 1:{
- format(rank_name, sizeof(rank_name), "%s", Faction_Infos[LoadedVehicles[vehicleid][vFaction]][fRank_1_Name]);
- }
- case 2:{
- format(rank_name, sizeof(rank_name), "%s", Faction_Infos[LoadedVehicles[vehicleid][vFaction]][fRank_2_Name]);
- }
- case 3:{
- format(rank_name, sizeof(rank_name), "%s", Faction_Infos[LoadedVehicles[vehicleid][vFaction]][fRank_3_Name]);
- }
- case 4:{
- format(rank_name, sizeof(rank_name), "%s", Faction_Infos[LoadedVehicles[vehicleid][vFaction]][fRank_4_Name]);
- }
- case 5:{
- format(rank_name, sizeof(rank_name), "%s", Faction_Infos[LoadedVehicles[vehicleid][vFaction]][fRank_5_Name]);
- }
- }
- format(str, sizeof(str), "Only %s rank %d:%s can drive this vehicle.", Faction_Infos[LoadedVehicles[vehicleid][vFaction]][fFaction_Name], LoadedVehicles[vehicleid][vFaction_Rank], rank_name);
- SendClientMessage(playerid, COLOR_BLUE, str);
- RemovePlayerFromVehicle(playerid);
- return 1;
- }
- }
- if(newstate == PLAYER_STATE_ONFOOT && oldstate == PLAYER_STATE_DRIVER){
- KillTimer(SpeedoTimer[playerid]);
- ShowSpeedo[playerid] = 0;
- }
- return 1;
- }
- public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger){
- new str[128];
- new engine, lights, alarm, doors, bonnet, boot, objective;
- GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
- if(ispassenger){
- return 1;
- }
- if(doors && !IsPlayerAdministrator(playerid, 1) && Player_Infos[playerid][pSpawned_Vehicle] != -1 || Player_Infos[playerid][pSpawned_Vehicle] != vehicleid){
- TogglePlayerControllable(playerid, 0);
- Player_Infos[playerid][pStealing] = 1;
- format(str, sizeof(str), "***%s is hijacking vehicle***", Player_Infos[playerid][pName]);
- SendToNearPlayers(playerid, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE,COLOR_PURPLE, COLOR_PURPLE, 20.0, str);
- SendClientMessage(playerid, COLOR_YELLOW, "Press [RETURN] button to cancel");
- Player_Infos[playerid][pStealingTimer] = SetTimerEx("StealVehicle", 10000, false, "dd", playerid, vehicleid);
- GameTextForPlayer(playerid, "Hijacking vehicle...", 10000, 6);
- return 1;
- }
- return 1;
- }
- public OnPlayerExitVehicle(playerid, vehicleid){
- if(ShowSpeedo[playerid] != 0){
- KillTimer(SpeedoTimer[playerid]);
- ShowSpeedo[playerid] = 0;
- }
- return 1;
- }
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]){
- new Dialog_Player_Name[128];
- GetPlayerName(playerid, Dialog_Player_Name, sizeof(Dialog_Player_Name));
- if(dialogid == 1){
- if(!response){
- Kick(playerid);
- return 1;
- }
- LoginPlayer(Dialog_Player_Name, inputtext);
- return 0;
- }
- if(dialogid == 2){
- if(!response){
- Kick(playerid);
- return 1;
- }
- if(strlen(inputtext) < 5){
- SendClientMessage(playerid, COLOR_RED, "Password must have at least 5 characters");
- ShowPlayerDialog(playerid, 2, 1, "Register", "Type your password bellow", "Register", "Close");
- return 1;
- }
- RegisterPlayer(playerid, inputtext);
- }
- if(dialogid == 3 && response){
- if(strlen(inputtext) <= 5){
- SendClientMessage(playerid, COLOR_RED, "House/Street name must be at least 6 characters");
- ShowPlayerDialog(playerid, 3, 1, "Create House. Step 1", "House/Street Name:", "Next", "Exit");
- return 1;
- }
- format(HouseCreatingName, sizeof(HouseCreatingName), "%s", inputtext);
- ShowPlayerDialog(playerid, 4, 1, "Create House. Step 2", "House price:", "Next", "Exit");
- return 1;
- }
- if(dialogid == 4 && response){
- if(strval(inputtext) < 15000){
- SendClientMessage(playerid, COLOR_RED, "House price must be at least 15000$");
- ShowPlayerDialog(playerid, 4, 1, "Create House. Step 2", "House price:", "Next", "Exit");
- return 1;
- }
- HouseCreatingPrice[playerid] = strval(inputtext);
- ShowPlayerDialog(playerid, 5, 2, "Create House. Step 3", "House 1\r\nHouse 2\r\nHouse 3\r\nHouse 4\r\nHouse 5\r\nHouse 6\r\nHouse 7", "Next", "Exit");
- }
- if(dialogid == 5){
- if(!response){
- HouseCreatingName[playerid] = 0;
- HouseCreatingPrice[playerid] = 0;
- return 1;
- }
- new Float:PlayerX, Float:PlayerY, Float:PlayerZ;
- GetPlayerPos(playerid, PlayerX, PlayerY, PlayerZ);
- switch(listitem){
- case 0:{
- CreateHouse(HouseCreatingName[playerid], "For_Sale", HouseCreatingPrice[playerid], 1, 1, PlayerX, PlayerY, PlayerZ, 235.508994, 1189.169897, 1080.339966, 3);
- LoadHouses();
- return 1;
- }
- case 1:{
- CreateHouse(HouseCreatingName[playerid], "For_Sale", HouseCreatingPrice[playerid], 1, 1, PlayerX, PlayerY, PlayerZ, 225.756989, 1240.000000, 1082.149902, 2);
- LoadHouses();
- return 1;
- }
- case 2:{
- CreateHouse(HouseCreatingName[playerid], "For_Sale", HouseCreatingPrice[playerid], 1, 1, PlayerX, PlayerY, PlayerZ, 223.043991, 1289.259888, 1082.199951 , 1);
- LoadHouses();
- return 1;
- }
- case 3:{
- CreateHouse(HouseCreatingName[playerid], "For_Sale", HouseCreatingPrice[playerid], 1, 1, PlayerX, PlayerY, PlayerZ, 225.630997, 1022.479980, 1084.069946 , 7);
- LoadHouses();
- return 1;
- }
- case 4:{
- CreateHouse(HouseCreatingName[playerid], "For_Sale", HouseCreatingPrice[playerid], 1, 1, PlayerX, PlayerY, PlayerZ, 295.138977, 1474.469971, 1080.519897 , 15);
- LoadHouses();
- return 1;
- }
- case 5:{
- CreateHouse(HouseCreatingName[playerid], "For_Sale", HouseCreatingPrice[playerid], 1, 1, PlayerX, PlayerY, PlayerZ, 328.493988, 1480.589966, 1084.449951, 15);
- LoadHouses();
- return 1;
- }
- case 6:{
- CreateHouse(HouseCreatingName[playerid], "For_Sale", HouseCreatingPrice[playerid], 1, 1, PlayerX, PlayerY, PlayerZ, 385.803986, 1471.769897, 1080.209961, 15);
- LoadHouses();
- return 1;
- }
- }
- }
- return 1;
- }
- public OnPlayerKeyStateChange(playerid, newkeys, oldkeys){
- if(newkeys & KEY_SECONDARY_ATTACK){
- if(Player_Infos[playerid][pStealing] == 1){
- KillTimer(Player_Infos[playerid][pStealingTimer]);
- TogglePlayerControllable(playerid, 1);
- return 1;
- }
- if(!IsPlayerInAnyVehicle(playerid)){
- if(Player_Infos[playerid][pInObject] != -1){
- RemovePlayerFromObject(playerid);
- return 1;
- }else{
- PutPlayerInObject(playerid);
- return 1;
- }
- }
- }else if(newkeys & KEY_HANDBRAKE){
- if(IsPlayerInAnyVehicle(playerid)){
- new VehicleID;
- if(Player_Infos[playerid][pFueling] == 1){
- SendClientMessage(playerid, COLOR_RED, "You can not start engine, fueling...");
- return 1;
- }
- VehicleID = GetPlayerVehicleID(playerid);
- new engine, lights, alarm, doors, bonnet, boot, objective;
- GetVehicleParamsEx(VehicleID, engine, lights, alarm, doors, bonnet, boot, objective);
- if(engine == 0){
- if(VehicleFuel[VehicleID] == 0){
- SendClientMessage(playerid, COLOR_YELLOW, "No fuel, you cant start engine.");
- return 1;
- }
- GameTextForPlayer(playerid, "~b~Starting engine", 2000, 5);
- SetTimerEx("SwitchEngineOn", 2000, false, "dd", playerid, VehicleID);
- }
- return 1;
- }
- }
- return 1;
- }
- public AddSpeedCam(playerid, maxspeed){
- new File:Handler = fopen("speedcams.txt", io_append);
- new Float:X, Float:Y, Float:Z, Float:FA, String[128];
- GetPlayerPos(playerid, X, Y, Z);
- GetPlayerFacingAngle(playerid, FA);
- format(String, sizeof(String), "%d,%f,%f,%f,%f\n", maxspeed, X, Y, Z, FA);
- if(!fwrite(Handler, String)) return false;
- if(!fclose(Handler)) return false;
- return true;
- }
- public LoadSpeedCams(){
- if(!dini_Exists("speedcams.txt")){
- return 1;
- }
- new File:Handler = fopen("speedcams.txt", io_read);
- for(new i = 0; i < MAX_SPEEDCAMS; i++){
- if(SpeedCams[i][scmaxspeed]){
- DestroyObject(SpeedCams[i][scobjid]);
- }
- }
- new String[256], SplitString[6][24];
- new sc = 0;
- while(fread(Handler, String)){
- split(String, SplitString, ',');
- SpeedCams[sc][scmaxspeed] = strval(SplitString[0]);
- SpeedCams[sc][scx] = strval(SplitString[1]);
- SpeedCams[sc][scy] = strval(SplitString[2]);
- SpeedCams[sc][scz] = strval(SplitString[3]);
- SpeedCams[sc][scfa] = strval(SplitString[4]);
- SpeedCams[sc][scobjid] = CreateObject(18880, SpeedCams[sc][scx], SpeedCams[sc][scy], SpeedCams[sc][scz] - 1, 0.0, 0.0, SpeedCams[sc][scfa]);
- sc++;
- }
- fclose(Handler);
- return true;
- }
- public SpeedCamsTimer(){
- new String[256], Float:tmpX, Float:tmpY;
- for(new i = 0; i < MAX_PLAYERS; i++){
- new State = GetPlayerState(i);
- if(IsPlayerConnected(i) && IsPlayerInAnyVehicle(i) && GetPlayerSpeed(i, true) > 0 && State == PLAYER_STATE_DRIVER){
- for(new p = 0; p < MAX_SPEEDCAMS; p++){
- tmpX = SpeedCams[p][scx];
- tmpY = SpeedCams[p][scy];
- GetDirectedXY(2, p, tmpX, tmpY, 5.0, 1);
- if(IsPlayerInRangeOfPoint(i, 20.0, tmpX, tmpY, SpeedCams[p][scz])){
- new CSpeed;
- CSpeed = GetPlayerSpeed(i, true);
- if(CSpeed > SpeedCams[p][scmaxspeed] && SpeedCamPlayer[i] == 0){
- SpeedCamPlayer[i] = 1;
- Player_Infos[i][pFines] = Player_Infos[i][pFines] + 150;
- format(String, sizeof(String), "You were cought on speed cam(%d/%d), you have to pay %d$ of fines.", CSpeed, SpeedCams[p][scmaxspeed], Player_Infos[i][pFines]);
- SendClientMessage(i, COLOR_RED, String);
- SetTimerEx("SpeedCamCheck", 5000, false, "d", i);
- }
- }
- }
- }
- }
- }
- public SpeedCamCheck(playerid){
- SpeedCamPlayer[playerid] = 0;
- return 1;
- }
- public AddGasStation(playerid, rate, name[]){
- new File:Handler = fopen("gasstations.txt", io_append);
- new String[256], Float:X, Float:Y, Float:Z;
- GetPlayerPos(playerid, X, Y, Z);
- format(String, sizeof(String), "%s,%d,%f,%f,%f\n", name, rate, X, Y, Z);
- if(!fwrite(Handler, String)) return false;
- if(!fclose(Handler)) return false;
- return true;
- }
- public LoadGasStations(){
- if(!fexist("gasstations.txt")){
- return 1;
- }
- new File:Handler = fopen("gasstations.txt", io_read);
- new String[256], SplitString[6][24];
- new GS = 0;
- while(fread(Handler, String)){
- split(String, SplitString, ',');
- format(GasStations[GS][gssname], 24, "%s", SplitString[0]);
- GasStations[GS][gssrate] = strval(SplitString[1]);
- GasStations[GS][gssx] = floatstr(SplitString[2]);
- GasStations[GS][gssy] = floatstr(SplitString[3]);
- GasStations[GS][gssz] = floatstr(SplitString[4]);
- GS++;
- }
- fclose(Handler);
- return 1;
- }
- public Fueling(playerid, vehicleid, money){
- new str[128];
- format(str, sizeof(str), "~w~Fueling: ~g~Finished. ~y~You paid ~r~%d$ ~y~for fuel...", money);
- GameTextForPlayer(playerid, str, 3000, 4);
- Player_Infos[playerid][pFueling] = 0;
- VehicleFuel[vehicleid] = 100;
- if(vehicleid == Player_Infos[playerid][pSpawned_Vehicle]){
- switch(Player_Infos[playerid][pSpawned_Vehicle_Slot]){
- case 1:{
- Player_Infos[playerid][pVehicle_1_Fuel] = 100;
- }
- case 2:{
- Player_Infos[playerid][pVehicle_2_Fuel] = 100;
- }
- case 3:{
- Player_Infos[playerid][pVehicle_3_Fuel] = 100;
- }
- }
- }
- GivePlayerCash(playerid, -money);
- return 1;
- }
- public AddVehicle(model, Float:x, Float:y, Float:z, Float:facing_angle, color_1, color_2, faction, faction_rank){
- new File:Vehicles = fopen("vehicles.txt", io_append);
- new Params[256];
- format(Params, sizeof(Params), "%d,%f,%f,%f,%f,%d,%d,%d,%d\n\r", model, x, y, z, facing_angle, color_1, color_2, faction, faction_rank);
- fwrite(Vehicles, Params);
- fclose(Vehicles);
- return 1;
- }
- public LoadVehicles(static_vehicle){
- print("Loading vehicles...");
- if(!fexist("vehicles.txt")){
- return true;
- }
- new Vehicles_Params[256], Vehicle_Param[10][20], Created_Vehicle, Plate[20];
- new File:LoadVehiclesFile = fopen("vehicles.txt", io_read);
- while(fread(LoadVehiclesFile, Vehicles_Params)){
- new Can_Create = 1;
- split(Vehicles_Params, Vehicle_Param, ',');
- for(new i = 0; i < MAX_VEHICLES; i++){
- if(LoadedVehicles[i][vModel_ID] == strval(Vehicle_Param[0]) && LoadedVehicles[i][vx] == floatstr(Vehicle_Param[1]) && LoadedVehicles[i][vy] == floatstr(Vehicle_Param[2]) && LoadedVehicles[i][vz] == floatstr(Vehicle_Param[3]) && LoadedVehicles[i][vFacing_Angle] == floatstr(Vehicle_Param[4])){
- Can_Create = 0;
- }
- }
- if(Can_Create == 1){
- if(static_vehicle == 0){
- Created_Vehicle = CreateVehicle(strval(Vehicle_Param[0]), floatstr(Vehicle_Param[1]), floatstr(Vehicle_Param[2]), floatstr(Vehicle_Param[3]), floatstr(Vehicle_Param[4]), strval(Vehicle_Param[5]), strval(Vehicle_Param[6]), 1800);
- }else{
- Created_Vehicle = AddStaticVehicleEx(strval(Vehicle_Param[0]), floatstr(Vehicle_Param[1]), floatstr(Vehicle_Param[2]), floatstr(Vehicle_Param[3]), floatstr(Vehicle_Param[4]), strval(Vehicle_Param[5]), strval(Vehicle_Param[6]), 1800);
- }
- VehicleFuel[Created_Vehicle] = 100;
- SetVehicleParamsEx(Created_Vehicle, 0, 0, 0, 0, 0, 0, 0);
- LoadedVehicles[Created_Vehicle][vModel_ID] = strval(Vehicle_Param[0]);
- LoadedVehicles[Created_Vehicle][vx] = floatstr(Vehicle_Param[1]);
- LoadedVehicles[Created_Vehicle][vy] = floatstr(Vehicle_Param[2]);
- LoadedVehicles[Created_Vehicle][vz] = floatstr(Vehicle_Param[3]);
- LoadedVehicles[Created_Vehicle][vFacing_Angle] = floatstr(Vehicle_Param[4]);
- LoadedVehicles[Created_Vehicle][vColor_1] = strval(Vehicle_Param[5]);
- LoadedVehicles[Created_Vehicle][vColor_2] = strval(Vehicle_Param[6]);
- LoadedVehicles[Created_Vehicle][vFaction] = strval(Vehicle_Param[7]);
- LoadedVehicles[Created_Vehicle][vFaction_Rank] = strval(Vehicle_Param[8]);
- format(Plate, sizeof(Plate), "LH-%d",Created_Vehicle);
- SetVehicleNumberPlate(Created_Vehicle, Plate);
- }
- }
- fclose(LoadVehiclesFile);
- return 1;
- }
- public AddBank(Float:Inside_X, Float:Inside_Y, Float:Inside_Z, Interior, playerid){
- new Float:My_X, Float:My_Y, Float:My_Z, Bank_Data[256];
- new File:Banks = fopen("banks.txt", io_append);
- GetPlayerPos(playerid, My_X, My_Y, My_Z);
- format(Bank_Data, sizeof(Bank_Data), "%f,%f,%f,%d,%f,%f,%f\n", Inside_X, Inside_Y, Inside_Z, Interior, My_X, My_Y, My_Z);
- fwrite(Banks, Bank_Data);
- fclose(Banks);
- return 1;
- }
- public LoadBanks(){
- new File:BanksToLoad = fopen("banks.txt", io_read);
- print("Loading Banks...");
- if(!dini_Exists("banks.txt")){
- print("No banks...");
- return 1;
- }
- new banks = 0;
- new bstring[256], bsplit[8][32];
- while(fread(BanksToLoad, bstring)){
- split(bstring, bsplit, ',');
- BankInfos[banks][BankEnterX] = floatstr(bsplit[0]);
- BankInfos[banks][BankEnterY] = floatstr(bsplit[1]);
- BankInfos[banks][BankEnterZ] = floatstr(bsplit[2]);
- BankInfos[banks][BankInteriorID] = strval(bsplit[3]);
- BankInfos[banks][BankExitX] = floatstr(bsplit[4]);
- BankInfos[banks][BankExitY] = floatstr(bsplit[5]);
- BankInfos[banks][BankExitZ] = floatstr(bsplit[6]);
- CreatePickupEx(1274, 1, BankInfos[banks][BankExitX], BankInfos[banks][BankExitY], BankInfos[banks][BankExitZ], 0);
- print("Bank Loaded");
- banks++;
- }
- return 1;
- }
- public AddFaction(const Name[], type){
- new File:Factions = fopen("factions.txt", io_append);
- new Faction_Data[128], Faction_String[64];
- format(Faction_Data, sizeof(Faction_Data), "%s,%d\n", Name, type);
- fwrite(Factions, Faction_Data);
- fclose(Factions);
- format(Faction_String, sizeof(Faction_String), "Factions/%s_Ranks.ini", Name);
- dini_Create(Faction_String);
- format(Faction_String, sizeof(Faction_String), "Factions/%s_Skins.ini", Name);
- dini_Create(Faction_String);
- format(Faction_String, sizeof(Faction_String), "Factions/%s_HQ.ini", Name);
- dini_Create(Faction_String);
- return 1;
- }
- public SetFactionRankName(const Faction_Name[], Rank, const Rank_Name[]){
- new Faction_Name_Rank[128], Faction_Rank_Name[128], Faction_Rank[64];
- format(Faction_Name_Rank, sizeof(Faction_Name_Rank), "Factions/%s_Ranks.ini", Faction_Name);
- if(!dini_Exists(Faction_Name_Rank)){
- return 1;
- }
- format(Faction_Rank_Name, sizeof(Faction_Rank_Name), "%s", Rank_Name);
- format(Faction_Rank, sizeof(Faction_Rank), "%d", Rank);
- dini_Set(Faction_Name_Rank, Faction_Rank, Faction_Rank_Name);
- LoadFactions();
- return 1;
- }
- public SetFactionRankSkin(const Faction_Name[], Rank, SkinID){
- new Faction_Skin[128], Faction_Skin_Rank[128];
- format(Faction_Skin, sizeof(Faction_Skin), "Factions/%s_Skins.ini", Faction_Name);
- if(!dini_Exists(Faction_Skin)){
- return 1;
- }
- format(Faction_Skin_Rank, sizeof(Faction_Skin_Rank), "%d", Rank);
- dini_IntSet(Faction_Skin, Faction_Skin_Rank, SkinID);
- LoadFactions();
- return 1;
- }
- public AddFactionHQ(const Faction_HQ_Name[], Float:Inside_X, Float:Inside_Y, Float:Inside_Z, Interior, playerid){
- new Float:My_X, Float:My_Y, Float:My_Z, HQ_String[128];
- GetPlayerPos(playerid, My_X, My_Y, My_Z);
- format(HQ_String, sizeof(HQ_String), "Factions/%s_HQ.ini", Faction_HQ_Name);
- if(!dini_Exists(HQ_String)){
- print(HQ_String);
- return 1;
- }
- dini_FloatSet(HQ_String, "Entrance_X", My_X);
- dini_FloatSet(HQ_String, "Entrance_Y", My_Y);
- dini_FloatSet(HQ_String, "Entrance_Z", My_Z);
- dini_FloatSet(HQ_String, "Inside_X", Inside_X);
- dini_FloatSet(HQ_String, "Inside_Y", Inside_Y);
- dini_FloatSet(HQ_String, "Inside_Z", Inside_Z);
- dini_IntSet(HQ_String, "Interior", Interior);
- LoadFactions();
- return 1;
- }
- public LoadFactions(){
- print("Loading factions...");
- new File:FactionsToLoad = fopen("factions.txt", io_read);
- if(!dini_Exists("factions.txt")){
- return 1;
- }
- new faction = 0;
- new fstring[128], fsplit[3][128], load_hq[64], load_ranks[64], load_skins[64], sstring[128];
- while(fread(FactionsToLoad, fstring)){
- split(fstring, fsplit, ',');
- format(Faction_Infos[faction][fFaction_Name], 128, "%s", fsplit[0]);
- Faction_Infos[faction][fFaction_Type] = strval(fsplit[1]);
- format(load_hq, sizeof(load_hq), "Factions/%s_HQ.ini", fsplit[0]);
- Faction_Infos[faction][fFaction_HQ_X] = dini_Float(load_hq, "Entrance_X");
- Faction_Infos[faction][fFaction_HQ_Y] = dini_Float(load_hq, "Entrance_Y");
- Faction_Infos[faction][fFaction_HQ_Z] = dini_Float(load_hq, "Entrance_Z");
- Faction_Infos[faction][fFaction_HQ_Inside_X] = dini_Float(load_hq, "Inside_X");
- Faction_Infos[faction][fFaction_HQ_Inside_Y] = dini_Float(load_hq, "Inside_Y");
- Faction_Infos[faction][fFaction_HQ_Inside_Z] = dini_Float(load_hq, "Inside_Z");
- Faction_Infos[faction][fFaction_HQ_Inside_Interior] = dini_Int(load_hq, "Interior");
- format(load_ranks, sizeof(load_ranks), "Factions/%s_Ranks.ini", fsplit[0]);
- format(Faction_Infos[faction][fRank_1_Name], 64, "%s",dini_Get(load_ranks, "1"));
- format(Faction_Infos[faction][fRank_2_Name], 64, "%s",dini_Get(load_ranks, "2"));
- format(Faction_Infos[faction][fRank_3_Name], 64, "%s",dini_Get(load_ranks, "3"));
- format(Faction_Infos[faction][fRank_4_Name], 64, "%s",dini_Get(load_ranks, "4"));
- format(Faction_Infos[faction][fRank_5_Name], 64, "%s",dini_Get(load_ranks, "5"));
- format(load_skins, sizeof(load_skins), "Factions/%s_Skins.ini", fsplit[0]);
- Faction_Infos[faction][fRank_1_Skin] = dini_Int(load_skins, "1");
- Faction_Infos[faction][fRank_2_Skin] = dini_Int(load_skins, "2");
- Faction_Infos[faction][fRank_3_Skin] = dini_Int(load_skins, "3");
- Faction_Infos[faction][fRank_4_Skin] = dini_Int(load_skins, "4");
- Faction_Infos[faction][fRank_5_Skin] = dini_Int(load_skins, "5");
- format(sstring, sizeof(sstring), "Faction: %s loaded", fsplit[0]);
- Create3DTextLabel(Faction_Infos[faction][fFaction_Name], 0x0000BBAA, Faction_Infos[faction][fFaction_HQ_X], Faction_Infos[faction][fFaction_HQ_Y], Faction_Infos[faction][fFaction_HQ_Z], 20, 0, 0);
- CreatePickupEx(1272, 1, Faction_Infos[faction][fFaction_HQ_X], Faction_Infos[faction][fFaction_HQ_Y], Faction_Infos[faction][fFaction_HQ_Z], 0);
- SendClientMessageToAll(COLOR_YELLOW, sstring);
- print(sstring);
- faction++;
- }
- fclose(FactionsToLoad);
- return 1;
- }
- public CreateHouse(const housename[], const owner[], price, locked, onsale, Float:x, Float:y, Float:z, Float:ix, Float:iy, Float:iz, interior){
- new File:Houses = fopen("houses.txt", io_append);
- new String[256];
- format(String, sizeof(String), "%s,%s,%d,%d,%d,%f,%f,%f,%f,%f,%f,%d\r\n", housename, owner, price, locked, onsale, x, y, z, ix, iy, iz, interior);
- fwrite(Houses, String);
- fclose(Houses);
- format(String, sizeof(String), "house_store/%s_weapons.ini", housename);
- dini_Create(String);
- format(String, sizeof(String), "house_store/%s_money.ini", housename);
- dini_Create(String);
- format(String, sizeof(String), "house_store/%s_drugs.ini", housename);
- dini_Create(String);
- return 1;
- }
- public LoadHouses(){
- print("Loading houses...");
- if(!fexist("houses.txt")){
- return true;
- }
- new File:LoadHouse = fopen("houses.txt", io_read);
- new LoadString[256];
- new String[64];
- new ID = 0;
- new SplitString[12][64];
- while(fread(LoadHouse, LoadString)){
- split(LoadString, SplitString, ',');
- HouseInfos[ID][HouseName] = SplitString[0];
- HouseInfos[ID][OwnerName] = SplitString[1];
- HouseInfos[ID][Price] = strval(SplitString[2]);
- HouseInfos[ID][Locked] = strval(SplitString[3]);
- HouseInfos[ID][OnSale] = strval(SplitString[4]);
- HouseInfos[ID][HouseEnterX] = floatstr(SplitString[5]);
- HouseInfos[ID][HouseEnterY] = floatstr(SplitString[6]);
- HouseInfos[ID][HouseEnterZ] = floatstr(SplitString[7]);
- HouseInfos[ID][HouseInteriorX] = floatstr(SplitString[8]);
- HouseInfos[ID][HouseInteriorY] = floatstr(SplitString[9]);
- HouseInfos[ID][HouseInteriorZ] = floatstr(SplitString[10]);
- HouseInfos[ID][HouseInteriorID] = strval(SplitString[11]);
- format(String, sizeof(String), "%s , Owner: %s", HouseInfos[ID][HouseName], HouseInfos[ID][OwnerName]);
- HouseInfos[ID][hTextLabelID] = Create3DTextLabel(String, 0x0000BBAA, HouseInfos[ID][HouseEnterX], HouseInfos[ID][HouseEnterY], HouseInfos[ID][HouseEnterZ], 20, 0, 0);
- HouseInfos[ID][hPickup_ID] = CreatePickupEx(1273, 1, HouseInfos[ID][HouseEnterX], HouseInfos[ID][HouseEnterY], HouseInfos[ID][HouseEnterZ], 0);
- ID++;
- }
- fclose(LoadHouse);
- return 1;
- }
- public AddBusiness(playerid, const Business_Name[], const bOwner_Name[], bEnter_Fee, bOnSale, bPrice, bLocked, Float:Interior_X, Float:Interior_Y, Float:Interior_Z, bInterior){
- new Float:bX, Float:bY, Float:bZ, bString[128];
- GetPlayerPos(playerid, bX, bY, bZ);
- format(bString, sizeof(bString), "%s,%s,%d,%d,%d,%d,%f,%f,%f,%d,%f,%f,%f\n", Business_Name, bOwner_Name, bEnter_Fee, bOnSale, bPrice, bLocked, Interior_X, Interior_Y, Interior_Z, bInterior, bX, bY,bZ);
- new File:BusinessAdd = fopen("business.txt", io_append);
- fwrite(BusinessAdd, bString);
- fclose(BusinessAdd);
- return 1;
- }
- public ReloadBusinessFile(){
- new bString[256], LB_String[128];
- fremove("business.txt");
- new File:BusinessReload = fopen("business.txt", io_append);
- for(new i = 0; i < MAX_BUSINESS; i++){
- if(strlen(Business_Infos[i][bizName]) != 0){
- format(bString, sizeof(bString), "%s,%s,%d,%d,%d,%d,%f,%f,%f,%d,%f,%f,%f\n", Business_Infos[i][bizName], Business_Infos[i][bizOwner_Name], Business_Infos[i][bizEnter_Fee], Business_Infos[i][bizOn_Sale], Business_Infos[i][bizPrice], Business_Infos[i][bizLocked], Business_Infos[i][bizInterior_Z], Business_Infos[i][bizInterior_Y], Business_Infos[i][bizInterior_Z], Business_Infos[i][bizInterior], Business_Infos[i][bizEntrance_X], Business_Infos[i][bizEntrance_Y], Business_Infos[i][bizEntrance_Z]);
- format(LB_String, 128, "Business: %s\n\rOwner: %s", Business_Infos[i][bizName], Business_Infos[i][bizOwner_Name]);
- Update3DTextLabelText(Business_Infos[i][labelid], COLOR_GREEN, LB_String);
- fwrite(BusinessReload, bString);
- }
- }
- fclose(BusinessReload);
- return 1;
- }
- public LoadBusiness(){
- print("Loading business...");
- new Load_Biz_String[128], LBS[256], LBSS[13][64], LB_String[128];
- format(Load_Biz_String, sizeof(Load_Biz_String), "business.txt");
- if(!dini_Exists(Load_Biz_String)){
- return 1;
- }
- new File:LoadBusinessFile = fopen(Load_Biz_String, io_read);
- new bid = 0;
- while(fread(LoadBusinessFile, LBS)){
- split(LBS, LBSS, ',');
- Business_Infos[bid][bizName] = LBSS[0];
- Business_Infos[bid][bizOwner_Name] = LBSS[1];
- Business_Infos[bid][bizEnter_Fee] = strval(LBSS[2]);
- Business_Infos[bid][bizOn_Sale] = strval(LBSS[3]);
- Business_Infos[bid][bizPrice] = strval(LBSS[4]);
- Business_Infos[bid][bizLocked] = strval(LBSS[5]);
- Business_Infos[bid][bizInterior_X] = floatstr(LBSS[6]);
- Business_Infos[bid][bizInterior_Y] = floatstr(LBSS[7]);
- Business_Infos[bid][bizInterior_Z] = floatstr(LBSS[8]);
- Business_Infos[bid][bizInterior] = strval(LBSS[9]);
- Business_Infos[bid][bizEntrance_X] = floatstr(LBSS[10]);
- Business_Infos[bid][bizEntrance_Y] = floatstr(LBSS[11]);
- Business_Infos[bid][bizEntrance_Z] = floatstr(LBSS[12]);
- format(LB_String, 128, "Business: %s\n\rOwner: %s", Business_Infos[bid][bizName], Business_Infos[bid][bizOwner_Name]);
- Business_Infos[bid][labelid] = Create3DTextLabel(LB_String, COLOR_BLUE, Business_Infos[bid][bizEntrance_X], Business_Infos[bid][bizEntrance_Y], Business_Infos[bid][bizEntrance_Z], 20, 0, 0);
- CreatePickupEx(1239, 1, Business_Infos[bid][bizEntrance_X], Business_Infos[bid][bizEntrance_Y], Business_Infos[bid][bizEntrance_Z], 0);
- bid++;
- }
- fclose(LoadBusinessFile);
- return 1;
- }
- public SetVehicleSpawn(shopid, playerid){
- new File:Handler = fopen("vehicle_spawns.txt", io_append);
- new String[128], Float:X, Float:Y, Float:Z, Float:FA;
- GetPlayerPos(playerid, X, Y, Z);
- GetPlayerFacingAngle(playerid, FA);
- format(String, sizeof(String), "%d,%f,%f,%f,%f\n", shopid, X, Y, Z, FA);
- if(!fwrite(Handler, String)) return false;
- if(!fclose(Handler)) return false;
- return true;
- }
- public LoadVehicleSpawns(){
- if(!dini_Exists("vehicle_spawns.txt")){
- print("No vehicle spawns yet :D");
- return 1;
- }
- new File:HandlerVS = fopen("vehicle_spawns.txt", io_read);
- new StringVS[256], SplitStringVS[6][24];
- while(fread(HandlerVS, StringVS)){
- split(StringVS, SplitStringVS, ',');
- if(strlen(Vehicles_Shops[strval(SplitStringVS[0])][vsName])){
- Vehicles_Shops[strval(SplitStringVS[0])][vsvsx] = floatstr(SplitStringVS[1]);
- Vehicles_Shops[strval(SplitStringVS[0])][vsvsy] = floatstr(SplitStringVS[2]);
- Vehicles_Shops[strval(SplitStringVS[0])][vsvsz] = floatstr(SplitStringVS[3]);
- Vehicles_Shops[strval(SplitStringVS[0])][vsvsfa] = floatstr(SplitStringVS[4]);
- }
- }
- if(!fclose(HandlerVS)) return false;
- return true;
- }
- public AddVehicleShop(playerid, const Vehicle_Shop_Name[]){
- new Float:Vehicle_Shop_X, Float:Vehicle_Shop_Y, Float:Vehicle_Shop_Z, Vehicle_Shop_String[128];
- new File:VehicleShop = fopen("vehicle_shops.txt", io_append);
- GetPlayerPos(playerid, Vehicle_Shop_X, Vehicle_Shop_Y, Vehicle_Shop_Z);
- format(Vehicle_Shop_String, sizeof(Vehicle_Shop_String), "%s,%f,%f,%f\n", Vehicle_Shop_Name, Vehicle_Shop_X, Vehicle_Shop_Y, Vehicle_Shop_Z);
- fwrite(VehicleShop, Vehicle_Shop_String);
- fclose(VehicleShop);
- return 1;
- }
- public LoadVehicleShops(){
- print("Loading vehicle shops...");
- new Load_Vehicle_Shops_String[128], Load_Vehicle_Shop_String_Split[5][24], LS[128];
- if(!dini_Exists("vehicle_shops.txt")){
- return 1;
- }
- new File:LoadVehicleShop = fopen("vehicle_shops.txt", io_read);
- new Vehicle_Shop_ID = 0;
- while(fread(LoadVehicleShop, Load_Vehicle_Shops_String)){
- split(Load_Vehicle_Shops_String, Load_Vehicle_Shop_String_Split, ',');
- Vehicles_Shops[Vehicle_Shop_ID][vsName] = Load_Vehicle_Shop_String_Split[0];
- Vehicles_Shops[Vehicle_Shop_ID][vsX] = floatstr(Load_Vehicle_Shop_String_Split[1]);
- Vehicles_Shops[Vehicle_Shop_ID][vsY] = floatstr(Load_Vehicle_Shop_String_Split[2]);
- Vehicles_Shops[Vehicle_Shop_ID][vsZ] = floatstr(Load_Vehicle_Shop_String_Split[3]);
- format(LS, sizeof(LS), "Vehicle DealerShip:\n%s", Vehicles_Shops[Vehicle_Shop_ID][vsName]);
- //CreatePickupEx(pickup_model, pickup_type, Float:pickup_X, Float:pickup_Y, Float:pickup_Z, pickup_virtualworld);
- Create3DTextLabel(LS, COLOR_PURPLE, Vehicles_Shops[Vehicle_Shop_ID][vsX], Vehicles_Shops[Vehicle_Shop_ID][vsY], Vehicles_Shops[Vehicle_Shop_ID][vsZ], 20, 0, 0);
- Vehicle_Shop_ID++;
- }
- fclose(LoadVehicleShop);
- return 1;
- }
- public AddMapIcon(playerid, icon_type){
- new Float:Map_X, Float:Map_Y, Float:Map_Z, write_string[128];
- GetPlayerPos(playerid, Map_X, Map_Y, Map_Z);
- new File:Mapicon = fopen("mapicon.txt", io_append);
- format(write_string, sizeof(write_string), "%f,%f,%f,%d\n", Map_X, Map_Y, Map_Z, icon_type);
- fwrite(Mapicon, write_string);
- fclose(Mapicon);
- return 1;
- }
- public LoadMapIcons(){
- print("Loading map icons...");
- if(!fexist("mapicon.txt")){
- return true;
- }
- new File:MapIconLoad = fopen("mapicon.txt", io_read);
- new String[128], SplitString[6][20];
- new mid = 0;
- while(fread(MapIconLoad, String)){
- split(String, SplitString, ',');
- for(new playerid = 0; playerid < MAX_PLAYERS; playerid++){
- if(IsPlayerConnected(playerid)){
- SetPlayerMapIcon(playerid, mid, floatstr(SplitString[0]), floatstr(SplitString[1]), floatstr(SplitString[2]), strval(SplitString[4]), 0, MAPICON_LOCAL);
- }
- }
- mid++;
- }
- fclose(MapIconLoad);
- return 1;
- }
- public LoginPlayer(const PlayerName[], const PlayerPassword[]){
- new Login_String[128], pass, pass_new[128], id;
- GetPlayerIDByName(PlayerName, id);
- if(WrongPassword[id] == 3){
- SendClientMessage(id, COLOR_RED, "You have type wrong password for three times, you have been kicked");
- Kick(id);
- return 1;
- }
- format(Login_String, 128, "Players/%s.ini", PlayerName);
- if(!dini_Exists(Login_String)){
- SendClientMessage(id, COLOR_RED, "Username is not registered, please register.");
- return 1;
- }
- pass = dini_Int(Login_String, "Key");
- format(pass_new, sizeof(pass_new), "%s", PlayerPassword);
- if(udb_hash(pass_new) != pass){
- SendClientMessage(id, COLOR_RED, "Wrong password.");
- ShowPlayerDialog(id, 1, DIALOG_STYLE_PASSWORD, "Login", "Wrong password please try again", "Login", "Close");
- WrongPassword[id]++;
- return 1;
- }
- Player_Infos[id][pKey] = pass;
- format(Player_Infos[id][pName], 128, "%s", PlayerName);
- Player_Infos[id][pLevel] = dini_Int(Login_String, "Level");
- Player_Infos[id][pCash] = dini_Int(Login_String, "Cash");
- Player_Infos[id][pBank] = dini_Int(Login_String, "Bank");
- Player_Infos[id][pAdministrator] = dini_Int(Login_String, "Administrator");
- Player_Infos[id][pModerator] = dini_Int(Login_String, "Moderator");
- Player_Infos[id][pDonator] = dini_Int(Login_String, "Donator");
- Player_Infos[id][pFaction] = dini_Int(Login_String, "Faction");
- Player_Infos[id][pFaction_Rank] = dini_Int(Login_String, "Faction_Rank");
- Player_Infos[id][pCK] = dini_Int(Login_String, "CK");
- Player_Infos[id][pKills] = dini_Int(Login_String, "Kills");
- Player_Infos[id][pDeaths] = dini_Int(Login_String, "Deaths");
- Player_Infos[id][pTutorial] = dini_Int(Login_String, "Tutorial");
- Player_Infos[id][pFines] = dini_Int(Login_String, "Fines");
- Player_Infos[id][pVehicle_1_Key] = dini_Int(Login_String, "Vehicle_1_Key");
- Player_Infos[id][pVehicle_1_Color_1] = dini_Int(Login_String, "Vehicle_1_Color_1");
- Player_Infos[id][pVehicle_1_Color_2] = dini_Int(Login_String, "Vehicle_1_Color_2");
- Player_Infos[id][pVehicle_1_Panel_Status] = dini_Int(Login_String, "Vehicle_1_Panel_Status");
- Player_Infos[id][pVehicle_1_Doors_Status] = dini_Int(Login_String, "Vehicle_1_Doors_Status");
- Player_Infos[id][pVehicle_1_Lights_Status] = dini_Int(Login_String, "Vehicle_1_Lights_Status");
- Player_Infos[id][pVehicle_1_Tires_Status] = dini_Int(Login_String, "Vehicle_1_Tires_Status");
- Player_Infos[id][pVehicle_1_Health] = dini_Float(Login_String, "Vehicle_1_Health");
- Player_Infos[id][pVehicle_1_Plate] = dini_Int(Login_String, "Vehicle_1_Plate");
- Player_Infos[id][pVehicle_1_Fuel] = dini_Int(Login_String, "Vehicle_1_Fuel");
- Player_Infos[id][pVehicle_2_Key] = dini_Int(Login_String, "Vehicle_2_Key");
- Player_Infos[id][pVehicle_2_Color_1] = dini_Int(Login_String, "Vehicle_2_Color_1");
- Player_Infos[id][pVehicle_2_Color_2] = dini_Int(Login_String, "Vehicle_2_Color_2");
- Player_Infos[id][pVehicle_2_Panel_Status] = dini_Int(Login_String, "Vehicle_2_Panel_Status");
- Player_Infos[id][pVehicle_2_Doors_Status] = dini_Int(Login_String, "Vehicle_2_Doors_Status");
- Player_Infos[id][pVehicle_2_Lights_Status] = dini_Int(Login_String, "Vehicle_2_Lights_Status");
- Player_Infos[id][pVehicle_2_Tires_Status] = dini_Int(Login_String, "Vehicle_2_Tires_Status");
- Player_Infos[id][pVehicle_2_Health] = dini_Float(Login_String, "Vehicle_2_Health");
- Player_Infos[id][pVehicle_2_Plate] = dini_Int(Login_String, "Vehicle_2_Plate");
- Player_Infos[id][pVehicle_2_Fuel] = dini_Int(Login_String, "Vehicle_2_Fuel");
- Player_Infos[id][pVehicle_3_Key] = dini_Int(Login_String, "Vehicle_3_Key");
- Player_Infos[id][pVehicle_3_Color_1] = dini_Int(Login_String, "Vehicle_3_Color_1");
- Player_Infos[id][pVehicle_3_Color_2] = dini_Int(Login_String, "Vehicle_3_Color_2");
- Player_Infos[id][pVehicle_3_Panel_Status] = dini_Int(Login_String, "Vehicle_3_Panel_Status");
- Player_Infos[id][pVehicle_3_Doors_Status] = dini_Int(Login_String, "Vehicle_3_Doors_Status");
- Player_Infos[id][pVehicle_3_Lights_Status] = dini_Int(Login_String, "Vehicle_3_Lights_Status");
- Player_Infos[id][pVehicle_3_Tires_Status] = dini_Int(Login_String, "Vehicle_3_Tires_Status");
- Player_Infos[id][pVehicle_3_Health] = dini_Float(Login_String, "Vehicle_3_Health");
- Player_Infos[id][pVehicle_3_Plate] = dini_Int(Login_String, "Vehicle_3_Plate");
- Player_Infos[id][pVehicle_3_Fuel] = dini_Int(Login_String, "Vehicle_3_Fuel");
- Player_Infos[id][pPark_X] = dini_Int(Login_String, "Park_X");
- Player_Infos[id][pPark_Y] = dini_Int(Login_String, "Park_Y");
- Player_Infos[id][pPark_Z] = dini_Int(Login_String, "Park_Z");
- Player_Infos[id][pPark_FA] = dini_Int(Login_String, "Park_FA");
- Player_Infos[id][pCrash_X] = dini_Int(Login_String, "Crash_X");
- Player_Infos[id][pCrash_Y] = dini_Int(Login_String, "Crash_Y");
- Player_Infos[id][pCrash_Z] = dini_Int(Login_String, "Crash_Z");
- Player_Infos[id][pCrash_F] = dini_Int(Login_String, "Crash_F");
- Player_Infos[id][pCrashed] = dini_Int(Login_String, "Chrashed");
- Player_Infos[id][pSpawn_X] = dini_Float(Login_String, "Spawn_X");
- Player_Infos[id][pSpawn_Y] = dini_Float(Login_String, "Spawn_Y");
- Player_Infos[id][pSpawn_Z] = dini_Float(Login_String, "Spawn_Z");
- Player_Infos[id][pSkin] = dini_Int(Login_String, "Skin");
- Player_Infos[id][pInterior] = dini_Int(Login_String, "Interior");
- Player_Infos[id][pInObject] = -1;
- Player_Infos[id][pObjectEnterX] = dini_Float(Login_String, "ObjectEnterX");
- Player_Infos[id][pObjectEnterY] = dini_Float(Login_String, "ObjectEnterY");
- Player_Infos[id][pObjectEnterZ] = dini_Float(Login_String, "ObjectEnterZ");
- Player_Infos[id][pObjectInterior] = dini_Int(Login_String, "ObjectInterior");
- Player_Infos[id][pSpawned_Vehicle] = -1;
- Player_Infos[id][pHouse_Key] = 999;
- for(new i = 0; i < MAX_HOUSES; i++){
- if(strlen(HouseInfos[i][OwnerName]) >= 5){
- if(strcmp(HouseInfos[i][OwnerName], Player_Infos[id][pName], true) == 0){
- Player_Infos[id][pHouse_Key] = i;
- print(HouseInfos[i][OwnerName]);
- }
- }
- }
- Player_Infos[id][pBiz_Key] = 999;
- for(new bi = 0; bi < MAX_BUSINESS; bi++){
- if(strlen(Business_Infos[bi][bizOwner_Name]) >= 5){
- if(strcmp(Business_Infos[bi][bizOwner_Name], Player_Infos[id][pName], true) == 0){
- Player_Infos[id][pBiz_Key] = bi;
- print(Business_Infos[bi][bizOwner_Name]);
- }
- }
- }
- Player_Infos[id][pWeed] = dini_Int(Login_String, "Weed");
- Player_Infos[id][pCoke] = dini_Int(Login_String, "Coke");
- Player_Infos[id][pLSD] = dini_Int(Login_String, "LSD");
- Player_Infos[id][pJob] = dini_Int(Login_String, "Job");
- Player_Infos[id][pWeapon_1] = dini_Int(Login_String, "Weapon_1");
- Player_Infos[id][pWeapon_1_Ammo] = dini_Int(Login_String, "Weapon_1_Ammo");
- Player_Infos[id][pWeapon_2] = dini_Int(Login_String, "Weapon_2");
- Player_Infos[id][pWeapon_2_Ammo] = dini_Int(Login_String, "Weapon_2_Ammo");
- Player_Infos[id][pWeapon_3] = dini_Int(Login_String, "Weapon_3");
- Player_Infos[id][pWeapon_3_Ammo] = dini_Int(Login_String, "Weapon_3_Ammo");
- Player_Infos[id][pWeapon_4] = dini_Int(Login_String, "Weapon_4");
- Player_Infos[id][pWeapon_4_Ammo] = dini_Int(Login_String, "Weapon_4_Ammo");
- Player_Infos[id][pWeapon_5] = dini_Int(Login_String, "Weapon_5");
- Player_Infos[id][pWeapon_5_Ammo] = dini_Int(Login_String, "Weapon_5_Ammo");
- Player_Infos[id][pWeapon_6] = dini_Int(Login_String, "Weapon_6");
- Player_Infos[id][pWeapon_6_Ammo] = dini_Int(Login_String, "Weapon_6_Ammo");
- Player_Infos[id][pWeapon_7] = dini_Int(Login_String, "Weapon_7");
- Player_Infos[id][pWeapon_7_Ammo] = dini_Int(Login_String, "Weapon_7_Ammo");
- Player_Infos[id][pWeapon_8] = dini_Int(Login_String, "Weapon_8");
- Player_Infos[id][pWeapon_8_Ammo] = dini_Int(Login_String, "Weapon_8_Ammo");
- Player_Infos[id][pWeapon_9] = dini_Int(Login_String, "Weapon_9");
- Player_Infos[id][pWeapon_9_Ammo] = dini_Int(Login_String, "Weapon_9_Ammo");
- Player_Infos[id][pWeapon_10] = dini_Int(Login_String, "Weapon_10");
- Player_Infos[id][pWeapon_10_Ammo] = dini_Int(Login_String, "Weapon_10_Ammo");
- Player_Infos[id][pWeapon_11] = dini_Int(Login_String, "Weapon_11");
- Player_Infos[id][pWeapon_11_Ammo] = dini_Int(Login_String, "Weapon_11_Ammo");
- Player_Infos[id][pWeapon_12] = dini_Int(Login_String, "Weapon_12");
- Player_Infos[id][pWeapon_12_Ammo] = dini_Int(Login_String, "Weapon_12_Ammo");
- Player_Infos[id][pWeapon_13] = dini_Int(Login_String, "Weapon_13");
- Player_Infos[id][pWeapon_13_Ammo] = dini_Int(Login_String, "Weapon_13_Ammo");
- Player_Infos[id][pMobile_Num] = dini_Int(Login_String, "Mobile_Num");
- Player_Infos[id][pMobile_Tog] = dini_Int(Login_String, "Mobile_Tog");
- PlayerLogedIn[id] = 1;
- SetSpawnInfo(id, 0, Player_Infos[id][pSkin], Player_Infos[id][pSpawn_X], Player_Infos[id][pSpawn_Y], Player_Infos[id][pSpawn_Z], 0.0, 0, 0, 0, 0, 0, 0);
- SpawnPlayer(id);
- return 1;
- }
- public RegisterPlayer(playerid, const password[]){
- new Register_Player_Name[128], Register_String[128], PassNew[128];
- GetPlayerName(playerid, Register_Player_Name, sizeof(Register_Player_Name));
- format(Register_String, sizeof(Register_String), "Players/%s.ini", Register_Player_Name);
- format(PassNew, 128, "%s", password);
- dini_Create(Register_String);
- dini_IntSet(Register_String, "Key", udb_hash(PassNew));
- dini_IntSet(Register_String, "Level", 1);
- dini_IntSet(Register_String, "Cash", 5000);
- dini_IntSet(Register_String, "Bank", 15000);
- dini_IntSet(Register_String, "Skin", 0);
- dini_IntSet(Register_String, "Administrator", 0);
- dini_IntSet(Register_String, "Moderator", 0);
- dini_IntSet(Register_String, "Donator", 0);
- dini_IntSet(Register_String, "Faction", 255);
- dini_IntSet(Register_String, "Faction_Rank", 0);
- dini_IntSet(Register_String, "CK", 0);
- dini_IntSet(Register_String, "Tutorial", 999);
- dini_IntSet(Register_String, "Fines", 0);
- dini_IntSet(Register_String, "Kills", 0);
- dini_IntSet(Register_String, "Deaths", 0);
- dini_IntSet(Register_String, "Vehicle_1_Key", 999);
- dini_IntSet(Register_String, "Vehicle_1_Color_1", 0);
- dini_IntSet(Register_String, "Vehicle_1_Color_2", 0);
- dini_IntSet(Register_String, "Vehicle_1_Panel_Status", 0);
- dini_IntSet(Register_String, "Vehicle_1_Doors_Status", 0);
- dini_IntSet(Register_String, "Vehicle_1_Lights_Status", 0);
- dini_IntSet(Register_String, "Vehicle_1_Tires_Status", 0);
- dini_FloatSet(Register_String, "Vehicle_1_Health", 1000.0);
- dini_IntSet(Register_String, "Vehicle_1_Plate", 0);
- dini_IntSet(Register_String, "Vehicle_1_Fuel", 0);
- dini_IntSet(Register_String, "Vehicle_2_Key", 999);
- dini_IntSet(Register_String, "Vehicle_2_Color_1", 0);
- dini_IntSet(Register_String, "Vehicle_2_Color_2", 0);
- dini_IntSet(Register_String, "Vehicle_2_Panel_Status", 0);
- dini_IntSet(Register_String, "Vehicle_2_Doors_Status", 0);
- dini_IntSet(Register_String, "Vehicle_2_Lights_Status", 0);
- dini_IntSet(Register_String, "Vehicle_2_Tires_Status", 0);
- dini_FloatSet(Register_String, "Vehicle_2_Health", 1000.0);
- dini_IntSet(Register_String, "Vehicle_2_Plate", 0);
- dini_IntSet(Register_String, "Vehicle_2_Fuel", 0);
- dini_IntSet(Register_String, "Vehicle_3_Key", 999);
- dini_IntSet(Register_String, "Vehicle_3_Color_1", 0);
- dini_IntSet(Register_String, "Vehicle_3_Color_2", 0);
- dini_IntSet(Register_String, "Vehicle_3_Panel_Status", 0);
- dini_IntSet(Register_String, "Vehicle_3_Doors_Status", 0);
- dini_IntSet(Register_String, "Vehicle_3_Lights_Status", 0);
- dini_IntSet(Register_String, "Vehicle_3_Tires_Status", 0);
- dini_FloatSet(Register_String, "Vehicle_3_Health", 1000.0);
- dini_IntSet(Register_String, "Vehicle_3_Plate", 0);
- dini_IntSet(Register_String, "Vehicle_3_Fuel", 0);
- dini_FloatSet(Register_String, "Park_X", 0.0);
- dini_FloatSet(Register_String, "Park_Y", 0.0);
- dini_FloatSet(Register_String, "Park_Z", 0.0);
- dini_FloatSet(Register_String, "Park_FA", 0.0);
- dini_FloatSet(Register_String, "Crash_X", 0.0);
- dini_FloatSet(Register_String, "Crash_Y", 0.0);
- dini_FloatSet(Register_String, "Crash_Z", 0.0);
- dini_FloatSet(Register_String, "Crash_F", 0.0);
- dini_IntSet(Register_String, "Crashed", 0);
- dini_FloatSet(Register_String, "Spawn_X", 1454.9869606623206);
- dini_FloatSet(Register_String, "Spawn_Y", -2344.1601259480267);
- dini_FloatSet(Register_String, "Spawn_Z", 10.0);
- dini_IntSet(Register_String, "Interior", 0);
- dini_IntSet(Register_String, "InObject", -1);
- dini_FloatSet(Register_String, "ObjectEnterX", 0.0);
- dini_FloatSet(Register_String, "ObjectEnterY", 0.0);
- dini_FloatSet(Register_String, "ObjectEnterZ", 0.0);
- dini_IntSet(Register_String, "ObjectInterior", 0);
- dini_IntSet(Register_String, "ObjectType", 0);
- dini_IntSet(Register_String, "Weed", 0);
- dini_IntSet(Register_String, "Coke", 0);
- dini_IntSet(Register_String, "LSD", 0);
- dini_IntSet(Register_String, "Job", 255);
- dini_IntSet(Register_String, "Weapon_1", 999);
- dini_IntSet(Register_String, "Weapon_1_Ammo", 0);
- dini_IntSet(Register_String, "Weapon_2", 999);
- dini_IntSet(Register_String, "Weapon_2_Ammo", 0);
- dini_IntSet(Register_String, "Weapon_3", 999);
- dini_IntSet(Register_String, "Weapon_3_Ammo", 0);
- dini_IntSet(Register_String, "Weapon_4", 999);
- dini_IntSet(Register_String, "Weapon_4_Ammo", 0);
- dini_IntSet(Register_String, "Weapon_5", 999);
- dini_IntSet(Register_String, "Weapon_5_Ammo", 0);
- dini_IntSet(Register_String, "Weapon_6", 999);
- dini_IntSet(Register_String, "Weapon_6_Ammo", 0);
- dini_IntSet(Register_String, "Weapon_7", 999);
- dini_IntSet(Register_String, "Weapon_7_Ammo", 0);
- dini_IntSet(Register_String, "Weapon_8", 999);
- dini_IntSet(Register_String, "Weapon_8_Ammo", 0);
- dini_IntSet(Register_String, "Weapon_9", 999);
- dini_IntSet(Register_String, "Weapon_9_Ammo", 0);
- dini_IntSet(Register_String, "Weapon_10", 999);
- dini_IntSet(Register_String, "Weapon_10_Ammo", 0);
- dini_IntSet(Register_String, "Weapon_11", 999);
- dini_IntSet(Register_String, "Weapon_11_Ammo", 0);
- dini_IntSet(Register_String, "Weapon_12", 999);
- dini_IntSet(Register_String, "Weapon_12_Ammo", 0);
- dini_IntSet(Register_String, "Weapon_13", 999);
- dini_IntSet(Register_String, "Weapon_13_Ammo", 0);
- dini_IntSet(Register_String, "Mobile_Num", 0);
- dini_IntSet(Register_String, "Mobile_Tog", 0);
- SendClientMessage(playerid, COLOR_YELLOW, "You have register your account. Please login now");
- ShowPlayerDialog(playerid, 1, 1, "Login", "You have register your account.\n\r Please login:", "Login", "Close");
- return 1;
- }
- stock SendToNearPlayers(playerid, color1, color2, color3, color4, color5, Float:stnp_radius, const stnp_text[]){
- new Float:PosX, Float:PosY, Float:PosZ;
- GetPlayerPos(playerid, PosX, PosY, PosZ);
- for(new i = 0; i < MAX_PLAYERS; i++){
- if(IsPlayerConnected(i)){
- if(IsPlayerInRangeOfPoint(i, stnp_radius / 5, PosX, PosY, PosZ)){
- SendClientMessage(i, color1, stnp_text);
- }else if(IsPlayerInRangeOfPoint(i, stnp_radius / 4, PosX, PosY, PosZ)){
- SendClientMessage(i, color2, stnp_text);
- }else if(IsPlayerInRangeOfPoint(i, stnp_radius / 3, PosX, PosY, PosZ)){
- SendClientMessage(i, color3, stnp_text);
- }else if(IsPlayerInRangeOfPoint(i, stnp_radius / 2, PosX, PosY, PosZ)){
- SendClientMessage(i, color4, stnp_text);
- }else if(IsPlayerInRangeOfPoint(i, stnp_radius, PosX, PosY, PosZ)){
- SendClientMessage(i, color5, stnp_text);
- }
- }
- }
- return 1;
- }
- public TutorialStep1(playerid){
- new WelcomeText[128];
- ClearChat(playerid);
- Doing_Tutorial[playerid] = 1;
- TogglePlayerControllable(playerid, 0);
- SetPlayerVirtualWorld(playerid, playerid+1);
- SetPlayerPos(playerid, 1461.10,-1602.13,47.0);
- SetPlayerCameraPos(playerid, 1461.10,-1602.13,53.47);
- SetPlayerCameraLookAt(playerid, 1542.307861,-1673.120483,13.554246);
- format(WelcomeText, sizeof(WelcomeText), "Welcome to %s", SERVERNAME);
- SendClientMessage(playerid, COLOR_YELLOW, WelcomeText);
- SendClientMessage(playerid, COLOR_YELLOW, "As this is an Roleplay server, administrators belives that you are goint to follow the rules.");
- SendClientMessage(playerid, COLOR_YELLOW, "Cheating or Hacking is not allowed, if you see someone cheat or hack, report him (/report) to administrators.");
- SendClientMessage(playerid, COLOR_YELLOW, "As you know this is roleplay server, so DeathMatching, Metagaming, Powergaming, BunnyHoping is not allowed ");
- SendClientMessage(playerid, COLOR_YELLOW, "If you get caught while DM, MG, PG or BH, you will be warned, 3 warnings and you'll get 10minutes ban.");
- SetTimerEx("TutorialStep2", 15000, false, "d", playerid);
- }
- public TutorialStep2(playerid){
- ClearChat(playerid);
- SetPlayerPos(playerid, 2075.08, -1948.62, 23.79);
- SetPlayerCameraPos(playerid, 2075.08, -1948.62, 28.79);
- SetPlayerCameraLookAt(playerid, 2056.000000,-1911.500000,13.546875);
- SendClientMessage(playerid, COLOR_YELLOW, "You are new around here, so you'll need to pass the driving test");
- SendClientMessage(playerid, COLOR_YELLOW, "If you get caught without driving license, you'll be fined.");
- SendClientMessage(playerid, COLOR_YELLOW, "Here as in real world, you must obey the law, and drive on right side of the road");
- SetTimerEx("TutorialStep3", 10000, false, "d", playerid);
- }
- public TutorialStep3(playerid){
- ClearChat(playerid);
- SetPlayerPos(playerid, 2067.39, -1794.29, 23.31);
- SetPlayerCameraPos(playerid, 2067.39, -1794.29, 28.31);
- SetPlayerCameraLookAt(playerid, 2099.833251,-1806.851684,13.554687);
- SendClientMessage(playerid, COLOR_YELLOW, "If your hp is low, visit Pizza Stack, Burger Shot or Cluckin Bell.");
- SendClientMessage(playerid, COLOR_YELLOW, "Enter inside to buy some food that will regenerate your hp.");
- SendClientMessage(playerid, COLOR_YELLOW, "Be sure you have enought money before you enter some of these Food shops.");
- SetTimerEx("TutorialStep4", 10000, false, "d", playerid);
- }
- public TutorialStep4(playerid){
- ClearChat(playerid);
- SetPlayerPos(playerid, 1221.62, -1325.04, 15.65);
- SetPlayerCameraPos(playerid, 1221.62, -1325.04, 20.65);
- SetPlayerCameraLookAt(playerid, 1177.756103,-1323.031494,14.086398);
- SendClientMessage(playerid, COLOR_YELLOW, "After you die, you will be spawned at nearest hostpital.");
- SendClientMessage(playerid, COLOR_YELLOW, "If you dont have life insurance you will pay the doctor your healing");
- SendClientMessage(playerid, COLOR_YELLOW, "Also if you feel sick, visit hostpital to help you.");
- SetTimerEx("TutorialStep5", 10000, false, "d", playerid);
- }
- public TutorialStep5(playerid){
- ClearChat(playerid);
- SetPlayerPos(playerid, 1942.34, -1053.28, 150.19);
- SetPlayerCameraPos(playerid, 1942.34, -1053.28, 156.19);
- SetPlayerCameraLookAt(playerid, 1967.875976,-1189.621093,25.771028);
- SendClientMessage(playerid, COLOR_YELLOW, "Thats it, if you need any help, just type /help, or contact administrator.");
- SendClientMessage(playerid, COLOR_YELLOW, "Have a nice day in GTA SAMP.");
- SetTimerEx("TutorialFinish", 7000, false, "d", playerid);
- }
- public TutorialFinish(playerid){
- Doing_Tutorial[playerid] = 0;
- SetPlayerVirtualWorld(playerid, 0);
- TogglePlayerControllable(playerid, 1);
- Player_Infos[playerid][pTutorial] = 0;
- SpawnPlayer(playerid);
- }
- stock ClearChat(playerid){
- for(new i = 0; i < 200; i++){
- SendClientMessage(playerid, COLOR_WHITE, " ");
- }
- return 1;
- }
- stock GetPlayerIDByName(const Name[], &playerid){
- new Player_Name_For_ID[64];
- playerid = -1;
- for(new i = 0; i < MAX_PLAYERS; i++){
- GetPlayerName(i, Player_Name_For_ID, sizeof(Player_Name_For_ID));
- if(strcmp(Player_Name_For_ID, Name, true) == 0){
- playerid = i;
- return 1;
- }
- }
- return 1;
- }
- stock split(const strsrc[], strdest[][], delimiter)
- {
- new i, li;
- new aNum;
- new len;
- while(i <= strlen(strsrc))
- {
- if(strsrc[i] == delimiter || i == strlen(strsrc))
- {
- len = strmid(strdest[aNum], strsrc, li, i, 128);
- strdest[aNum][len] = 0;
- li = i+1;
- aNum++;
- }
- i++;
- }
- return 1;
- }
- stock udb_hash(buf[]) {
- new length=strlen(buf);
- new s1 = 1;
- new s2 = 0;
- new n;
- for (n=0; n<length; n++)
- {
- s1 = (s1 + buf[n]) % 65521;
- s2 = (s2 + s1) % 65521;
- }
- return (s2 << 16) + s1;
- }
- stock strtok(const string[], &index){
- new length = strlen(string);
- while ((index < length) && (string[index] <= ' ')) {
- index++;
- }
- new offset = index;
- new result[20];
- while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1))) {
- result[index - offset] = string[index];
- index++;
- }
- result[index - offset] = EOS;
- return result;
- }
- stock strrest(const string[], &index)
- {
- new length = strlen(string);
- while ((index < length) && (string[index] <= ' '))
- {
- index++;
- }
- new offset = index;
- new result[128];
- while ((index < length) && ((index - offset) < (sizeof(result) - 1)))
- {
- result[index - offset] = string[index];
- index++;
- }
- result[index - offset] = EOS;
- return result;
- }
- stock GivePlayerCash(playerid, money)
- {
- Player_Infos[playerid][pCash] += money;
- ResetMoneyBar(playerid);//Resets the money in the original moneybar, Do not remove!
- UpdateMoneyBar(playerid,Player_Infos[playerid][pCash]);//Sets the money in the moneybar to the serverside cash, Do not remove!
- return Player_Infos[playerid][pCash];
- }
- stock SetPlayerCash(playerid, money)
- {
- Player_Infos[playerid][pCash] = money;
- ResetMoneyBar(playerid);//Resets the money in the original moneybar, Do not remove!
- UpdateMoneyBar(playerid,Player_Infos[playerid][pCash]);//Sets the money in the moneybar to the serverside cash, Do not remove!
- return Player_Infos[playerid][pCash];
- }
- stock ResetPlayerCash(playerid)
- {
- Player_Infos[playerid][pCash] = 0;
- ResetMoneyBar(playerid);//Resets the money in the original moneybar, Do not remove!
- UpdateMoneyBar(playerid,Player_Infos[playerid][pCash]);//Sets the money in the moneybar to the serverside cash, Do not remove!
- return Player_Infos[playerid][pCash];
- }
- stock GetPlayerCash(playerid)
- {
- return Player_Infos[playerid][pCash];
- }
- public SwitchEngineOn(playerid, vehicleid){
- new rand = random(15);
- if(rand == 1){
- GameTextForPlayer(playerid, "~r~Engine was not started", 3000, 6);
- return 1;
- }
- GameTextForPlayer(playerid, "~g~Engine started", 3000, 6);
- ToggleVehicleEngine(vehicleid, 1);
- return 1;
- }
- public ToggleVehicleEngine(vehicleid, toggle){
- new engine, lights, alarm, doors,bonnet,boot,objective;
- GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors,bonnet,boot,objective);
- SetVehicleParamsEx(vehicleid, toggle, lights, alarm, doors,bonnet,boot,objective);
- return 1;
- }
- stock ToggleVehicleLights(vehicleid, toggle){
- new engine, lights, alarm, doors,bonnet,boot,objective;
- GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors,bonnet,boot,objective);
- SetVehicleParamsEx(vehicleid, engine, toggle, alarm, doors,bonnet,boot,objective);
- return 1;
- }
- stock GetEngineStatus(vehicleid){
- new engine, lights, alarm, doors,bonnet,boot,objective;
- GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors,bonnet,boot,objective);
- return engine;
- }
- public Add247(playerid, interior){
- new File:Add247File = fopen("247.txt", io_append);
- new Float:X, Float:Y, Float:Z, Add247String[256];
- new Float:IntX, Float:IntY, Float:IntZ, Int;
- GetPlayerPos(playerid, X, Y, Z);
- switch(interior){
- case 1:{
- IntX = -25.884498;
- IntY = -185.868988;
- IntZ = 1003.546875;
- Int = 17;
- }
- case 2:{
- IntX= 6.091179;
- IntY = -29.271898;
- IntZ = 1003.549438;
- Int = 10;
- }
- case 3:{
- IntX = -30.946699;
- IntY = -89.609596;
- IntZ = 1003.546875;
- Int = 18;
- }
- case 4:{
- IntX = -25.132598;
- IntY = -139.066986;
- IntZ = 1003.546875;
- Int = 16;
- }
- case 5:{
- IntX = -27.312299;
- IntY = -29.277599;
- IntZ = 1003.557250;
- Int = 4;
- }
- case 6:{
- IntX = -26.691598;
- IntY = -55.714897;
- IntZ = 1003.546875;
- Int = 6;
- }
- default:{
- IntX = -26.691598;
- IntY = -55.714897;
- IntZ = 1003.546875;
- Int = 6;
- }
- }
- format(Add247String, sizeof(Add247String), "%f,%f,%f,%f,%f,%f,%d", X, Y, Z, IntX, IntY, IntZ, Int);
- fwrite(Add247File, Add247String);
- fclose(Add247File);
- return 1;
- }
- public Load247(){
- print("Loading 24/7");
- new s247File[128], s247FileString[256], s247FileStringSplit[7][12];
- format(s247File, sizeof(s247File), "247.txt");
- if(!dini_Exists(s247File)){
- return 1;
- }
- new File:FileRead = fopen(s247File, io_read);
- new s247_ID = 0;
- while(fread(FileRead, s247FileString)){
- split(s247FileString, s247FileStringSplit, ',');
- Stores_Infos[s247_ID][sEnter_X] = floatstr(s247FileStringSplit[0]);
- Stores_Infos[s247_ID][sEnter_Y] = floatstr(s247FileStringSplit[1]);
- Stores_Infos[s247_ID][sEnter_Z] = floatstr(s247FileStringSplit[2]);
- Stores_Infos[s247_ID][sInt_X] = floatstr(s247FileStringSplit[3]);
- Stores_Infos[s247_ID][sInt_Y] = floatstr(s247FileStringSplit[4]);
- Stores_Infos[s247_ID][sInt_Z] = floatstr(s247FileStringSplit[5]);
- Stores_Infos[s247_ID][sInt] = strval(s247FileStringSplit[6]);
- Create3DTextLabel("24/7 Store", COLOR_YELLOW, Stores_Infos[s247_ID][sEnter_X], Stores_Infos[s247_ID][sEnter_Y], Stores_Infos[s247_ID][sEnter_Z],20,0);
- CreatePickupEx(1239, 1 , Stores_Infos[s247_ID][sEnter_X], Stores_Infos[s247_ID][sEnter_Y], Stores_Infos[s247_ID][sEnter_Z], 0);
- s247_ID++;
- }
- fclose(FileRead);
- return 1;
- }
- public CreatePickupEx(pickup_model, pickup_type, Float:pickup_X, Float:pickup_Y, Float:pickup_Z, pickup_virtualworld){
- new CreatedPickup;
- CreatedPickup = CreatePickup(pickup_model, pickup_type, pickup_X, pickup_Y, pickup_Z, pickup_virtualworld);
- PickUps[CreatedPickup][puModel] = pickup_model;
- PickUps[CreatedPickup][puType] = pickup_type;
- PickUps[CreatedPickup][puX] = pickup_X;
- PickUps[CreatedPickup][puY] = pickup_Y;
- PickUps[CreatedPickup][puZ] = pickup_Z;
- PickUps[CreatedPickup][puVirtualWorld] = pickup_virtualworld;
- return CreatedPickup;
- }
- public GetPickupModel(pickupid){
- return PickUps[pickupid][puModel];
- }
- public SaveAccount(const Player_Name[], crashed){
- new Save_Account_File[128], playerid;
- GetPlayerIDByName(Player_Name, playerid);
- format(Save_Account_File, sizeof(Save_Account_File), "Players/%s.ini", Player_Name);
- if(!dini_Exists(Save_Account_File)){
- return 1;
- }
- dini_IntSet(Save_Account_File, "Level", Player_Infos[playerid][pLevel]);
- dini_IntSet(Save_Account_File, "Cash", Player_Infos[playerid][pCash]);
- dini_IntSet(Save_Account_File, "Bank", Player_Infos[playerid][pBank]);
- dini_IntSet(Save_Account_File, "Skin", Player_Infos[playerid][pSkin]);
- dini_IntSet(Save_Account_File, "Administrator", Player_Infos[playerid][pAdministrator]);
- dini_IntSet(Save_Account_File, "Moderator", Player_Infos[playerid][pModerator]);
- dini_IntSet(Save_Account_File, "Donator", Player_Infos[playerid][pDonator]);
- dini_IntSet(Save_Account_File, "Faction", Player_Infos[playerid][pFaction]);
- dini_IntSet(Save_Account_File, "Faction_Rank", Player_Infos[playerid][pFaction]);
- dini_IntSet(Save_Account_File, "CK", Player_Infos[playerid][pCK]);
- dini_IntSet(Save_Account_File, "Tutorial", Player_Infos[playerid][pTutorial]);
- dini_IntSet(Save_Account_File, "Fines", Player_Infos[playerid][pFines]);
- dini_IntSet(Save_Account_File, "Kills", Player_Infos[playerid][pKills]);
- dini_IntSet(Save_Account_File, "Deaths", Player_Infos[playerid][pDeaths]);
- dini_IntSet(Save_Account_File, "Vehicle_1_Key", Player_Infos[playerid][pVehicle_1_Key]);
- dini_IntSet(Save_Account_File, "Vehicle_1_Color_1", Player_Infos[playerid][pVehicle_1_Color_1]);
- dini_IntSet(Save_Account_File, "Vehicle_1_Color_2", Player_Infos[playerid][pVehicle_1_Color_2]);
- dini_IntSet(Save_Account_File, "Vehicle_1_Panel_Status", Player_Infos[playerid][pVehicle_1_Panel_Status]);
- dini_IntSet(Save_Account_File, "Vehicle_1_Doors_Status", Player_Infos[playerid][pVehicle_1_Doors_Status]);
- dini_IntSet(Save_Account_File, "Vehicle_1_Lights_Status", Player_Infos[playerid][pVehicle_1_Lights_Status]);
- dini_IntSet(Save_Account_File, "Vehicle_1_Tires_Status", Player_Infos[playerid][pVehicle_1_Tires_Status]);
- dini_FloatSet(Save_Account_File, "Vehicle_1_Health", Player_Infos[playerid][pVehicle_1_Health]);
- dini_IntSet(Save_Account_File, "Vehicle_1_Plate", Player_Infos[playerid][pVehicle_1_Plate]);
- dini_IntSet(Save_Account_File, "Vehicle_1_Fuel", Player_Infos[playerid][pVehicle_1_Fuel]);
- dini_IntSet(Save_Account_File, "Vehicle_2_Key", Player_Infos[playerid][pVehicle_2_Key]);
- dini_IntSet(Save_Account_File, "Vehicle_2_Color_1", Player_Infos[playerid][pVehicle_2_Color_1]);
- dini_IntSet(Save_Account_File, "Vehicle_2_Color_2", Player_Infos[playerid][pVehicle_2_Color_2]);
- dini_IntSet(Save_Account_File, "Vehicle_2_Panel_Status", Player_Infos[playerid][pVehicle_2_Panel_Status]);
- dini_IntSet(Save_Account_File, "Vehicle_2_Doors_Status", Player_Infos[playerid][pVehicle_2_Doors_Status]);
- dini_IntSet(Save_Account_File, "Vehicle_2_Lights_Status", Player_Infos[playerid][pVehicle_2_Lights_Status]);
- dini_IntSet(Save_Account_File, "Vehicle_2_Tires_Status", Player_Infos[playerid][pVehicle_2_Tires_Status]);
- dini_FloatSet(Save_Account_File, "Vehicle_2_Health", Player_Infos[playerid][pVehicle_2_Health]);
- dini_IntSet(Save_Account_File, "Vehicle_2_Plate", Player_Infos[playerid][pVehicle_2_Plate]);
- dini_IntSet(Save_Account_File, "Vehicle_2_Fuel", Player_Infos[playerid][pVehicle_2_Fuel]);
- dini_IntSet(Save_Account_File, "Vehicle_3_Key", Player_Infos[playerid][pVehicle_3_Key]);
- dini_IntSet(Save_Account_File, "Vehicle_3_Color_1", Player_Infos[playerid][pVehicle_3_Color_1]);
- dini_IntSet(Save_Account_File, "Vehicle_3_Color_2", Player_Infos[playerid][pVehicle_3_Color_2]);
- dini_IntSet(Save_Account_File, "Vehicle_3_Panel_Status", Player_Infos[playerid][pVehicle_3_Panel_Status]);
- dini_IntSet(Save_Account_File, "Vehicle_3_Doors_Status", Player_Infos[playerid][pVehicle_3_Doors_Status]);
- dini_IntSet(Save_Account_File, "Vehicle_3_Lights_Status", Player_Infos[playerid][pVehicle_3_Lights_Status]);
- dini_IntSet(Save_Account_File, "Vehicle_3_Tires_Status", Player_Infos[playerid][pVehicle_3_Tires_Status]);
- dini_FloatSet(Save_Account_File, "Vehicle_3_Health", Player_Infos[playerid][pVehicle_3_Health]);
- dini_IntSet(Save_Account_File, "Vehicle_3_Plate", Player_Infos[playerid][pVehicle_3_Plate]);
- dini_IntSet(Save_Account_File, "Vehicle_3_Fuel", Player_Infos[playerid][pVehicle_3_Fuel]);
- dini_FloatSet(Save_Account_File, "Park_X", Player_Infos[playerid][pPark_X]);
- dini_FloatSet(Save_Account_File, "Park_Y", Player_Infos[playerid][pPark_Y]);
- dini_FloatSet(Save_Account_File, "Park_Z", Player_Infos[playerid][pPark_Z]);
- dini_FloatSet(Save_Account_File, "Park_FA", Player_Infos[playerid][pPark_FA]);
- dini_FloatSet(Save_Account_File, "Spawn_X", Player_Infos[playerid][pSpawn_X]);
- dini_FloatSet(Save_Account_File, "Spawn_Y", Player_Infos[playerid][pSpawn_Y]);
- dini_FloatSet(Save_Account_File, "Spawn_Z", Player_Infos[playerid][pSpawn_Z]);
- dini_IntSet(Save_Account_File, "Weed", Player_Infos[playerid][pWeed]);
- dini_IntSet(Save_Account_File, "Coke", Player_Infos[playerid][pCoke]);
- dini_IntSet(Save_Account_File, "LSD", Player_Infos[playerid][pLSD]);
- dini_IntSet(Save_Account_File, "Job", Player_Infos[playerid][pJob]);
- dini_IntSet(Save_Account_File, "Weapon_1", Player_Infos[playerid][pWeapon_1]);
- dini_IntSet(Save_Account_File, "Weapon_1_Ammo", Player_Infos[playerid][pWeapon_1_Ammo]);
- dini_IntSet(Save_Account_File, "Weapon_2", Player_Infos[playerid][pWeapon_2]);
- dini_IntSet(Save_Account_File, "Weapon_2_Ammo", Player_Infos[playerid][pWeapon_2_Ammo]);
- dini_IntSet(Save_Account_File, "Weapon_3", Player_Infos[playerid][pWeapon_3]);
- dini_IntSet(Save_Account_File, "Weapon_3_Ammo", Player_Infos[playerid][pWeapon_3_Ammo]);
- dini_IntSet(Save_Account_File, "Weapon_4", Player_Infos[playerid][pWeapon_4]);
- dini_IntSet(Save_Account_File, "Weapon_4_Ammo", Player_Infos[playerid][pWeapon_4_Ammo]);
- dini_IntSet(Save_Account_File, "Weapon_5", Player_Infos[playerid][pWeapon_5]);
- dini_IntSet(Save_Account_File, "Weapon_5_Ammo", Player_Infos[playerid][pWeapon_5_Ammo]);
- dini_IntSet(Save_Account_File, "Weapon_6", Player_Infos[playerid][pWeapon_6]);
- dini_IntSet(Save_Account_File, "Weapon_6_Ammo", Player_Infos[playerid][pWeapon_6_Ammo]);
- dini_IntSet(Save_Account_File, "Weapon_7", Player_Infos[playerid][pWeapon_7]);
- dini_IntSet(Save_Account_File, "Weapon_7_Ammo", Player_Infos[playerid][pWeapon_7_Ammo]);
- dini_IntSet(Save_Account_File, "Weapon_8", Player_Infos[playerid][pWeapon_8]);
- dini_IntSet(Save_Account_File, "Weapon_8_Ammo", Player_Infos[playerid][pWeapon_8_Ammo]);
- dini_IntSet(Save_Account_File, "Weapon_9", Player_Infos[playerid][pWeapon_9]);
- dini_IntSet(Save_Account_File, "Weapon_9_Ammo", Player_Infos[playerid][pWeapon_9_Ammo]);
- dini_IntSet(Save_Account_File, "Weapon_10", Player_Infos[playerid][pWeapon_10]);
- dini_IntSet(Save_Account_File, "Weapon_10_Ammo", Player_Infos[playerid][pWeapon_10_Ammo]);
- dini_IntSet(Save_Account_File, "Weapon_11", Player_Infos[playerid][pWeapon_11]);
- dini_IntSet(Save_Account_File, "Weapon_11_Ammo", Player_Infos[playerid][pWeapon_11_Ammo]);
- dini_IntSet(Save_Account_File, "Weapon_12", Player_Infos[playerid][pWeapon_12]);
- dini_IntSet(Save_Account_File, "Weapon_12_Ammo", Player_Infos[playerid][pWeapon_12_Ammo]);
- dini_IntSet(Save_Account_File, "Weapon_13", Player_Infos[playerid][pWeapon_13]);
- dini_IntSet(Save_Account_File, "Weapon_13_Ammo", Player_Infos[playerid][pWeapon_13_Ammo]);
- dini_IntSet(Save_Account_File, "Mobile_Num", Player_Infos[playerid][pMobile_Num]);
- dini_IntSet(Save_Account_File, "Mobile_Tog", Player_Infos[playerid][pMobile_Tog]);
- if(crashed == 1){
- if(Player_Infos[playerid][pInObject] != -1){
- dini_IntSet(Save_Account_File, "Interior", 0);
- dini_FloatSet(Save_Account_File, "Crash_X", Player_Infos[playerid][pObjectEnterX]);
- dini_FloatSet(Save_Account_File, "Crash_Y", Player_Infos[playerid][pObjectEnterY]);
- dini_FloatSet(Save_Account_File, "Crash_Z", Player_Infos[playerid][pObjectEnterZ]);
- dini_FloatSet(Save_Account_File, "Crash_F", 0.0);
- }
- dini_IntSet(Save_Account_File, "Crashed", 1);
- }
- return 1;
- }
- stock IsPlayerNearPlayer(playerid, n_playerid, Float:radius){
- new Float:npx, Float:npy, Float:npz;
- GetPlayerPos(n_playerid, npx, npy, npz);
- if(IsPlayerInRangeOfPoint(playerid, radius, npx, npy, npz)){
- return true;
- }else{
- return false;
- }
- }
- stock ReloadHousesFile(){
- fremove("houses.txt");
- for(new i = 0; i < MAX_HOUSES; i++){
- if(strlen(HouseInfos[i][HouseName]) >= 5){
- CreateHouse(HouseInfos[i][HouseName], HouseInfos[i][OwnerName], HouseInfos[i][Price], HouseInfos[i][Locked], HouseInfos[i][OnSale], HouseInfos[i][HouseEnterX], HouseInfos[i][HouseEnterY], HouseInfos[i][HouseEnterZ], HouseInfos[i][HouseInteriorX], HouseInfos[i][HouseInteriorY], HouseInfos[i][HouseInteriorZ], HouseInfos[i][HouseInteriorID]);
- }
- }
- return 1;
- }
- public AddJob(const Job_Name[], Job_Type, Float:Job_X, Float:Job_Y, Float:Job_Z){
- new File:Job = fopen("jobs.txt", io_append);
- new jbString[128];
- format(jbString, sizeof(jbString), "%s,%d,%f,%f,%f\n", Job_Name, Job_Type, Job_X, Job_Y, Job_Z);
- fwrite(Job, jbString);
- fclose(Job);
- return 1;
- }
- public LoadJobs(){
- print("Loading jobs...");
- new LJ[12], LJS[128], LJSS[5][11];
- format(LJ, sizeof(LJ), "jobs.txt");
- if(!dini_Exists(LJ)){
- print("File jobs.txt does not exists");
- return 1;
- }
- new File:LoadJob = fopen(LJ, io_read);
- new jString[128];
- new ID = 0;
- while(fread(LoadJob, LJS)){
- split(LJS, LJSS, ',');
- format(Job_Infos[ID][jName], 64, "%s", LJSS[0]);
- Job_Infos[ID][jType] = strval(LJSS[1]);
- Job_Infos[ID][jPos_X] = floatstr(LJSS[2]);
- Job_Infos[ID][jPos_Y] = floatstr(LJSS[3]);
- Job_Infos[ID][jPos_Z] = floatstr(LJSS[4]);
- CreatePickupEx(1210, 1, Job_Infos[ID][jPos_X], Job_Infos[ID][jPos_Y], Job_Infos[ID][jPos_Z], 0);
- format(jString, sizeof(jString), "%s", Job_Infos[ID][jName]);
- Create3DTextLabel(jString, COLOR_RED, Job_Infos[ID][jPos_X], Job_Infos[ID][jPos_Y], Job_Infos[ID][jPos_Z], 20, 0, 0);
- format(jString, sizeof(jString), "Job: %s created", Job_Infos[ID][jName]);
- print(jString);
- ID++;
- }
- fclose(LoadJob);
- return 1;
- }
- public AntiCheatMoney(){
- new Money, ACM[256];
- for(new i = 0; i < MAX_PLAYERS; i++){
- if(IsPlayerConnected(i) && PlayerLogedIn[i] != 0){
- Money = GetPlayerMoney(i) - GetPlayerCash(i);
- if(Money >= 500){
- format(ACM, sizeof(ACM), "WARNING, Maybe money cheat player %s[%d], Server: %d$, Client %d$", Player_Infos[i][pName], i, GetPlayerMoney(i), GetPlayerCash(i));
- for(new ai = 0; ai < MAX_PLAYERS; ai++){
- if(IsPlayerConnected(ai) && Player_Infos[ai][pAdministrator] >= 1){
- SendClientMessage(ai, COLOR_RED, ACM);
- }
- }
- }
- ResetMoneyBar(i);
- UpdateMoneyBar(i,Player_Infos[i][pCash]);
- }
- }
- return 1;
- }
- public AntiCheatWeapon(){
- new weapon, string[128];
- for(new i = 0; i < MAX_PLAYERS; i++){
- if(IsPlayerConnected(i) && PlayerLogedIn[i] != 0){
- weapon = GetPlayerWeapon(i);
- if(weapon >= 2 && weapon <= 9){
- if(Player_Infos[i][pWeapon_1] != weapon){
- format(string, sizeof(string), "KICKED BY SYSTEM, Reason: weapon hack");
- SendClientMessage(i, COLOR_RED, string);
- Kick(i);
- }
- }else if(weapon >= 22 && weapon <= 24){
- if(Player_Infos[i][pWeapon_2] != weapon){
- format(string, sizeof(string), "KICKED BY SYSTEM, Reason: weapon hack");
- SendClientMessage(i, COLOR_RED, string);
- Kick(i);
- }
- }else if(weapon >= 25 && weapon <= 27){
- if(Player_Infos[i][pWeapon_3] != weapon){
- format(string, sizeof(string), "KICKED BY SYSTEM, Reason: weapon hack");
- SendClientMessage(i, COLOR_RED, string);
- Kick(i);
- }
- }else if(weapon >= 28 && weapon <= 29 || weapon == 32){
- if(Player_Infos[i][pWeapon_4] != weapon){
- format(string, sizeof(string), "KICKED BY SYSTEM, Reason: weapon hack");
- SendClientMessage(i, COLOR_RED, string);
- Kick(i);
- }
- }else if(weapon >= 30 && weapon <= 31){
- if(Player_Infos[i][pWeapon_5] != weapon){
- format(string, sizeof(string), "KICKED BY SYSTEM, Reason: weapon hack");
- SendClientMessage(i, COLOR_RED, string);
- Kick(i);
- }
- }else if(weapon >= 33 && weapon <= 34){
- if(Player_Infos[i][pWeapon_6] != weapon){
- format(string, sizeof(string), "KICKED BY SYSTEM, Reason: weapon hack");
- SendClientMessage(i, COLOR_RED, string);
- Kick(i);
- }
- }else if(weapon >= 35 && weapon <= 38){
- if(Player_Infos[i][pWeapon_7] != weapon){
- format(string, sizeof(string), "KICKED BY SYSTEM, Reason: weapon hack");
- SendClientMessage(i, COLOR_RED, string);
- Kick(i);
- }
- }else if(weapon == 39){
- if(Player_Infos[i][pWeapon_8] != weapon){
- format(string, sizeof(string), "KICKED BY SYSTEM, Reason: weapon hack");
- SendClientMessage(i, COLOR_RED, string);
- Kick(i);
- }
- }else if(weapon >= 41 && weapon <= 43){
- if(Player_Infos[i][pWeapon_9] != weapon){
- format(string, sizeof(string), "KICKED BY SYSTEM, Reason: weapon hack");
- SendClientMessage(i, COLOR_RED, string);
- Kick(i);
- }
- }else if(weapon >= 10 && weapon <= 15){
- if(Player_Infos[i][pWeapon_10] != weapon){
- format(string, sizeof(string), "KICKED BY SYSTEM, Reason: weapon hack");
- SendClientMessage(i, COLOR_RED, string);
- Kick(i);
- }
- }else if(weapon >= 44 && weapon <= 46){
- if(Player_Infos[i][pWeapon_11] != weapon){
- format(string, sizeof(string), "KICKED BY SYSTEM, Reason: weapon hack");
- SendClientMessage(i, COLOR_RED, string);
- Kick(i);
- }
- }else if(weapon == 40){
- if(Player_Infos[i][pWeapon_12] != weapon){
- format(string, sizeof(string), "KICKED BY SYSTEM, Reason: weapon hack");
- SendClientMessage(i, COLOR_RED, string);
- Kick(i);
- }
- }
- }
- }
- return 1;
- }
- stock GivePlayerGun(playerid, weapon, ammo){
- if(weapon >= 2 && weapon <= 9){
- Player_Infos[playerid][pWeapon_1] = weapon;
- Player_Infos[playerid][pWeapon_1_Ammo] = ammo;
- }else if(weapon >= 22 && weapon <= 24){
- Player_Infos[playerid][pWeapon_2] = weapon;
- Player_Infos[playerid][pWeapon_2_Ammo] = ammo;
- }else if(weapon >= 25 && weapon <= 27){
- Player_Infos[playerid][pWeapon_3] = weapon;
- Player_Infos[playerid][pWeapon_3_Ammo] = ammo;
- }else if(weapon >= 28 && weapon <= 29 || weapon == 32){
- Player_Infos[playerid][pWeapon_4] = weapon;
- Player_Infos[playerid][pWeapon_4_Ammo] = ammo;
- }else if(weapon >= 30 && weapon <= 31){
- Player_Infos[playerid][pWeapon_5] = weapon;
- Player_Infos[playerid][pWeapon_5_Ammo] = ammo;
- }else if(weapon >= 33 && weapon <= 34){
- Player_Infos[playerid][pWeapon_6] = weapon;
- Player_Infos[playerid][pWeapon_6_Ammo] = ammo;
- }else if(weapon >= 35 && weapon <= 38){
- Player_Infos[playerid][pWeapon_7] = weapon;
- Player_Infos[playerid][pWeapon_7_Ammo] = ammo;
- }else if(weapon == 39){
- Player_Infos[playerid][pWeapon_8] = weapon;
- Player_Infos[playerid][pWeapon_8_Ammo] = ammo;
- }else if(weapon >= 41 && weapon <= 43){
- Player_Infos[playerid][pWeapon_9] = weapon;
- Player_Infos[playerid][pWeapon_9_Ammo] = ammo;
- }else if(weapon >= 10 && weapon <= 15){
- Player_Infos[playerid][pWeapon_10] = weapon;
- Player_Infos[playerid][pWeapon_10_Ammo] = ammo;
- }else if(weapon >= 44 && weapon <= 46){
- Player_Infos[playerid][pWeapon_11] = weapon;
- Player_Infos[playerid][pWeapon_11_Ammo] = ammo;
- }else if(weapon == 40){
- Player_Infos[playerid][pWeapon_12] = weapon;
- Player_Infos[playerid][pWeapon_12_Ammo] = ammo;
- }
- GivePlayerWeapon(playerid, weapon, ammo);
- return 1;
- }
- stock GetPlayerSpeed(playerid,bool:kmh){
- new Float:Vx,Float:Vy,Float:Vz,Float:rtn;
- if(IsPlayerInAnyVehicle(playerid)) GetVehicleVelocity(GetPlayerVehicleID(playerid),Vx,Vy,Vz); else GetPlayerVelocity(playerid,Vx,Vy,Vz);
- rtn = floatsqroot(floatabs(floatpower(Vx + Vy + Vz,2)));
- return kmh?floatround(rtn * 100 * 1.61):floatround(rtn * 100);
- }
- public Speedo(playerid){
- new speedo_string[256];
- if(ShowSpeedo[playerid] != 0){
- if(GetEngineStatus(GetPlayerVehicleID(playerid))){
- format(speedo_string, sizeof(speedo_string), "~n~~n~~n~~n~~n~~n~~n~~>~~w~%d ~r~KM/h, ~r~Fuel: ~w~%d~<~",GetPlayerSpeed(playerid, true), VehicleFuel[GetPlayerVehicleID(playerid)]);
- GameTextForPlayer(playerid, speedo_string, 2000, 5);
- return 1;
- }
- }
- return 1;
- }
- public FuelSystem(){
- new Driver;
- new Speed;
- for(new i = 0; i < MAX_VEHICLES; i++){
- if(GetEngineStatus(i) && VehicleFuel[i] != 0){
- Driver = HasVehicleDriver(i);
- if(Driver){
- Speed = GetPlayerSpeed(Driver, true);
- if(Speed > 50 && Speed < 100){
- VehicleFuel[i] = VehicleFuel[i] - 2;
- }else if(Speed > 100){
- VehicleFuel[i] = VehicleFuel[i] - 4;
- }else{
- VehicleFuel[i]--;
- }
- }
- if(VehicleFuel[i] == 0){
- ToggleVehicleEngine(i, 0);
- }
- }
- }
- return 1;
- }
- stock HasVehicleDriver(vehicle_id){
- for(new i=0;i<MAX_PLAYERS;i++){
- if(IsPlayerInVehicle(i, vehicle_id)){
- new State = GetPlayerState(i);
- if(State == PLAYER_STATE_DRIVER){
- return i;
- }else{
- return false;
- }
- }
- }
- return true;
- }
- public Translate(playerid, color, const Message[], const Language[]){
- new Languages[256];
- new Translated_String[256];
- new New_String[256];
- format(Languages, sizeof(Languages), "languages/%s.ini", Language);
- if(dini_Exists(Languages)){
- format(New_String, sizeof(New_String), "%s", Message);
- format(Translated_String, sizeof(Translated_String), "%s", dini_Get(Languages, New_String));
- SendClientMessage(playerid, color, Translated_String);
- }else{
- SendClientMessage(playerid, color, Message);
- }
- }
- stock abs(value){
- return ((value < 0 ) ? (value * -1) : (value));
- }
- public BankSystem(const Option[], Amount, playerid, giveid){
- new String[256];
- abs(Amount);
- if(strcmp(Option, "balance", true) == 0){
- format(String, sizeof(String), "You have %d$ on your bank account.", Player_Infos[playerid][pBank]);
- ShowPlayerDialog(playerid, 6, DIALOG_STYLE_MSGBOX , "Bank account balance.", String, "", "Ok");
- return 1;
- }else if(strcmp(Option, "deposit", true) == 0){
- if(GetPlayerCash(playerid) >= Amount){
- Player_Infos[playerid][pBank] = Player_Infos[playerid][pBank] + Amount;
- GivePlayerCash(playerid, -Amount);
- return 1;
- }else{
- return false;
- }
- }else if(strcmp(Option, "withdraw", true) == 0){
- if(Player_Infos[playerid][pBank] >= Amount){
- Player_Infos[playerid][pBank] = Player_Infos[playerid][pBank] - Amount;
- GivePlayerCash(playerid, Amount);
- return 1;
- }else{
- return false;
- }
- }else if(strcmp(Option, "transfer", true) == 0){
- if(IsPlayerConnected(giveid)){
- if(Player_Infos[playerid][pBank] >= Amount){
- Player_Infos[giveid][pBank] = Player_Infos[giveid][pBank] + Amount;
- Player_Infos[playerid][pBank] = Player_Infos[playerid][pBank] - Amount;
- return 1;
- }else{
- return false;
- }
- }else{
- return 0;
- }
- }
- return 1;
- }
- public VehiclePlates(){
- new File:VehiclePlatesFile = fopen("vehicle_plates.txt", io_read);
- if(!dini_Exists("vehicle_plates.txt")){
- return 1;
- }
- new String[256];
- new plate = 0;
- while(fread(VehiclePlatesFile, String)){
- VehiclePlatesSys[plate][Number] = strval(String);
- plate++;
- }
- return 1;
- }
- public GenerateVehiclePlate(){
- new File:PlatesFile = fopen("vehicle_plates.txt", io_append);
- new Plate[6];
- for(new p=0;p<7;p++){
- format(Plate, sizeof(Plate), "%s%s", Plate, random(9));
- }
- for(new i=0;i<sizeof(VehiclePlatesSys);i++){
- if(VehiclePlatesSys[i][Number] == strval(Plate)){
- GenerateVehiclePlate();
- return 1;
- }
- }
- fwrite(PlatesFile, Plate);
- fclose(PlatesFile);
- return 1;
- }
- public AddAtm(playerid){
- new Float:X, Float:Y, Float:Z, Float:FA;
- GetPlayerPos(playerid, X, Y, Z);
- GetPlayerFacingAngle(playerid, FA);
- new File:ATMS = fopen("atms.txt", io_append);
- new Params[256];
- format(Params, sizeof(Params), "%f,%f,%f,%f\n\r", X, Y, Z, FA);
- fwrite(ATMS, Params);
- fclose(ATMS);
- return 1;
- }
- public LoadAtms(){
- if(!fexist("atms.txt")){
- return 1;
- }
- new File:LoadATMs = fopen("atms.txt", io_read);
- new ATMS[256], ATM_Params[5][20];
- for(new i = 0; i < sizeof(ATM_Infos); i++){
- DestroyObject(ATM_Infos[i][atm_objid]);
- }
- new atm = 0;
- while(fread(LoadATMs, ATMS)){
- split(ATMS, ATM_Params, ',');
- ATM_Infos[atm][atm_x] = floatstr(ATM_Params[0]);
- ATM_Infos[atm][atm_y] = floatstr(ATM_Params[1]);
- ATM_Infos[atm][atm_z] = floatstr(ATM_Params[2]);
- ATM_Infos[atm][atm_objid] = CreateObject(2942, floatstr(ATM_Params[0]), floatstr(ATM_Params[1]), floatstr(ATM_Params[2]) - 1, 0.0, 0.0, floatstr(ATM_Params[3]));
- atm++;
- }
- fclose(LoadATMs);
- return 1;
- }
- public AddUsableCommand(rank, type, const command[]){
- new Type[64];
- format(Type, sizeof(Type), "Commands/type_%d.txt", type);
- new File:CommandFile = fopen(Type, io_append);
- format(Type, sizeof(Type), "%s,%d\n", command, rank);
- fwrite(CommandFile, Type);
- fclose(CommandFile);
- return 1;
- }
- public LoadUsableCommands(type){
- new Type[64];
- format(Type, sizeof(Type), "Commands/type_%d.txt", type);
- if(!fexist(Type)){
- return 1;
- }
- new File:LoadCommands = fopen(Type, io_read);
- new Command[64], Command_Split[3][12];
- while(fread(LoadCommands, Command)){
- split(Command, Command_Split, ',');
- UsableCommands[GlobalType][uctype] = type;
- UsableCommands[GlobalType][ucrank] = strval(Command_Split[1]);
- format(UsableCommands[GlobalType][ucc], 64, "%s", Command_Split[0]);
- GlobalType++;
- }
- return 1;
- }
- public IsUsableCommand(rank, type, const command[]){
- for(new i = 0; i < GlobalType; i++){
- printf("%s = %s %d = %d %d = %d", UsableCommands[i][ucc], command, UsableCommands[i][uctype], type, UsableCommands[i][ucrank], rank);
- if(!strcmp(command, UsableCommands[i][ucc], true) && UsableCommands[i][uctype] == type && UsableCommands[i][ucrank] == rank){
- return 1;
- }
- }
- return 0;
- }
- public FixVehicle(playerid, vehicleid){
- ClearAnimations(playerid);
- GameTextForPlayer(playerid, "Vehicle fixed.", 3000, 3);
- if(vehicleid == Player_Infos[playerid][pSpawned_Vehicle]){
- switch(Player_Infos[playerid][pSpawned_Vehicle_Slot]){
- case 1:{
- GetVehicleDamageStatus(Player_Infos[playerid][pSpawned_Vehicle], Player_Infos[playerid][pVehicle_1_Panel_Status], Player_Infos[playerid][pVehicle_1_Doors_Status], Player_Infos[playerid][pVehicle_1_Lights_Status], Player_Infos[playerid][pVehicle_1_Tires_Status]);
- GetVehicleHealth(Player_Infos[playerid][pSpawned_Vehicle], Player_Infos[playerid][pVehicle_1_Health]);
- }
- case 2:{
- GetVehicleDamageStatus(Player_Infos[playerid][pSpawned_Vehicle], Player_Infos[playerid][pVehicle_2_Panel_Status], Player_Infos[playerid][pVehicle_2_Doors_Status], Player_Infos[playerid][pVehicle_2_Lights_Status], Player_Infos[playerid][pVehicle_2_Tires_Status]);
- GetVehicleHealth(Player_Infos[playerid][pSpawned_Vehicle], Player_Infos[playerid][pVehicle_2_Health]);
- }
- case 3:{
- GetVehicleDamageStatus(Player_Infos[playerid][pSpawned_Vehicle], Player_Infos[playerid][pVehicle_3_Panel_Status], Player_Infos[playerid][pVehicle_3_Doors_Status], Player_Infos[playerid][pVehicle_3_Lights_Status], Player_Infos[playerid][pVehicle_3_Tires_Status]);
- GetVehicleHealth(Player_Infos[playerid][pSpawned_Vehicle], Player_Infos[playerid][pVehicle_3_Health]);
- }
- }
- }
- RepairVehicle(vehicleid);
- return 1;
- }
- stock IsPlayerNearATM(playerid){
- for(new i = 0; i < sizeof(ATM_Infos);i++){
- if(IsPlayerInRangeOfPoint(playerid, 2.0, ATM_Infos[i][atm_x], ATM_Infos[i][atm_y], ATM_Infos[i][atm_z])){
- return 1;
- }
- }
- return false;
- }
- stock IsPlayerNearGasStation(playerid, &gsid){
- for(new i = 0; i < MAX_GASSTATIONS; i++){
- if(IsPlayerInRangeOfPoint(playerid, 10.0, GasStations[i][gssx], GasStations[i][gssy], GasStations[i][gssz])){
- gsid = i;
- return 1;
- }
- }
- return false;
- }
- stock IsPlayerNearJob(playerid, &jobid){
- for(new i = 0; i < MAX_JOBS; i++){
- if(IsPlayerInRangeOfPoint(playerid, 3.0, Job_Infos[i][jPos_X], Job_Infos[i][jPos_Y], Job_Infos[i][jPos_Z])){
- jobid = i;
- return 1;
- }
- }
- return 0;
- }
- stock GetNearestVehicleID(playerid, Float:range, &vehicleid){
- new Float:X, Float:Y, Float:Z;
- for(new i = 0; i < MAX_VEHICLES; i++){
- if(IsVehicleStreamedIn(i, playerid)){
- GetVehiclePos(i, X, Y, Z);
- if(IsPlayerInRangeOfPoint(playerid, range, X, Y, Z)){
- vehicleid = i;
- return 1;
- }
- }
- }
- return false;
- }
- stock GetJobType(playerid){
- if(Player_Infos[playerid][pJob] == 255){
- return 0;
- }else{
- return Job_Infos[Player_Infos[playerid][pJob]][jType];
- }
- }
- stock GetPlayerFactionInfos(playerid, &type, &rank){
- if(Player_Infos[playerid][pFaction] == 255){
- type = -1;
- rank = 0;
- return 1;
- }
- type = Faction_Infos[Player_Infos[playerid][pFaction]][fFaction_Type];
- rank = Player_Infos[playerid][pFaction_Rank];
- return 1;
- }
- public DragPlayer(playerid, id){
- new Float:X, Float:Y, Float:Z, Float:FA;
- GetPlayerPos(playerid, X, Y, Z);
- GetPlayerFacingAngle(playerid, FA);
- GetDirectedXY(1, playerid, X, Y, 2.0, 0);
- SetPlayerPos(id, X, Y, Z);
- SetPlayerFacingAngle(id, FA);
- return 1;
- }
- stock GetDirectedXY(type, id, &Float:x, &Float:y, Float:distance, Direction)
- {
- new Float:rx, Float:ry, Float:a;
- if(type == 1){
- GetPlayerFacingAngle(id, a);
- }else if(type == 2){
- GetObjectRot(id, rx, ry, a);
- }
- if(Direction <= 0){
- x -= (distance * floatsin(-a, degrees));
- y -= (distance * floatcos(-a, degrees));
- }else if(Direction >= 1){
- x += (distance * floatsin(-a, degrees));
- y += (distance * floatcos(-a, degrees));
- }
- }
- stock IsFreeSeat(vehicleid, seat){
- new SeatID;
- for(new i = 0; i < MAX_PLAYERS; i++){
- if(IsPlayerConnected(i) && IsPlayerInVehicle(i, vehicleid)){
- SeatID = GetPlayerVehicleSeat(i);
- if(SeatID == 128){
- IsFreeSeat(vehicleid, seat);
- }else if(SeatID == seat){
- return false;
- }
- }
- }
- return 1;
- }
- stock IsPlayerAdministrator(playerid, level){
- if(Player_Infos[playerid][pAdministrator] >= level){
- return true;
- }else{
- return false;
- }
- }
- stock IsPlayerNearObject(playerid, object, Float:radius, &objid){
- switch(object){
- case OBJ_HOUSE:{
- for(new i=0;i<MAX_HOUSES;i++){
- if(IsPlayerInRangeOfPoint(playerid, radius, HouseInfos[i][HouseEnterX], HouseInfos[i][HouseEnterY], HouseInfos[i][HouseEnterZ])){
- objid = i;
- return 1;
- }
- }
- }
- case OBJ_FACTION:{
- for(new fi = 0; fi < MAX_FACTIONS; fi++){
- if(IsPlayerInRangeOfPoint(playerid, 2,Faction_Infos[fi][fFaction_HQ_X], Faction_Infos[fi][fFaction_HQ_Y], Faction_Infos[fi][fFaction_HQ_Z])){
- objid = fi;
- return 1;
- }
- }
- }
- case OBJ_BUSINESS:{
- for(new bi = 0; bi < MAX_BUSINESS; bi++){
- if(IsPlayerInRangeOfPoint(playerid, 2, Business_Infos[bi][bizEntrance_X], Business_Infos[bi][bizEntrance_Y], Business_Infos[bi][bizEntrance_Z])){
- objid = bi;
- return 1;
- }
- }
- }
- case OBJ_STORE:{
- for(new si = 0; si < MAX_24_7_STORES; si++){
- if(IsPlayerInRangeOfPoint(playerid, 2, Stores_Infos[si][sEnter_X], Stores_Infos[si][sEnter_Y], Stores_Infos[si][sEnter_Z])){
- objid = si;
- return 1;
- }
- }
- }
- case OBJ_BANK:{
- for(new bnk = 0; bnk < MAX_BANKS; bnk++){
- if(IsPlayerInRangeOfPoint(playerid, 2, BankInfos[bnk][BankExitX], BankInfos[bnk][BankExitY], BankInfos[bnk][BankExitZ])){
- objid = bnk;
- return 1;
- }
- }
- }
- }
- return false;
- }
- stock PutPlayerInHouse(playerid, houseid){
- Player_Infos[playerid][pObjectEnterX] = HouseInfos[houseid][HouseEnterX];
- Player_Infos[playerid][pObjectEnterY] = HouseInfos[houseid][HouseEnterY];
- Player_Infos[playerid][pObjectEnterZ] = HouseInfos[houseid][HouseEnterZ];
- Player_Infos[playerid][pObjectExitX] = HouseInfos[houseid][HouseInteriorX];
- Player_Infos[playerid][pObjectExitY] = HouseInfos[houseid][HouseInteriorY];
- Player_Infos[playerid][pObjectExitZ] = HouseInfos[houseid][HouseInteriorZ];
- Player_Infos[playerid][pObjectInterior] = HouseInfos[houseid][HouseInteriorID];
- Player_Infos[playerid][pInObject] = houseid;
- Player_Infos[playerid][pObjectType] = OBJ_HOUSE;
- SetPlayerInterior(playerid, HouseInfos[houseid][HouseInteriorID]);
- SetPlayerPos(playerid, HouseInfos[houseid][HouseInteriorX], HouseInfos[houseid][HouseInteriorY], HouseInfos[houseid][HouseInteriorZ]);
- SetPlayerVirtualWorld(playerid, houseid);
- if(Player_Infos[playerid][pDraging] != -1){
- SetPlayerVirtualWorld(Player_Infos[playerid][pDraging], Player_Infos[playerid][pInObject]);
- SetPlayerInterior(Player_Infos[playerid][pDraging], Player_Infos[playerid][pObjectInterior]);
- }
- return 1;
- }
- stock PutPlayerInFaction(playerid, factionid){
- Player_Infos[playerid][pObjectEnterX] = Faction_Infos[factionid][fFaction_HQ_X];
- Player_Infos[playerid][pObjectEnterY] = Faction_Infos[factionid][fFaction_HQ_Y];
- Player_Infos[playerid][pObjectEnterZ] = Faction_Infos[factionid][fFaction_HQ_Z];
- Player_Infos[playerid][pObjectExitX] = Faction_Infos[factionid][fFaction_HQ_Inside_X];
- Player_Infos[playerid][pObjectExitY] = Faction_Infos[factionid][fFaction_HQ_Inside_Y];
- Player_Infos[playerid][pObjectExitZ] = Faction_Infos[factionid][fFaction_HQ_Inside_Z];
- Player_Infos[playerid][pObjectInterior] = Faction_Infos[factionid][fFaction_HQ_Inside_Interior];
- Player_Infos[playerid][pInObject] = factionid;
- Player_Infos[playerid][pObjectType] = OBJ_FACTION;
- SetPlayerInterior(playerid, Player_Infos[playerid][pObjectInterior]);
- SetPlayerPos(playerid, Faction_Infos[factionid][fFaction_HQ_Inside_X], Faction_Infos[factionid][fFaction_HQ_Inside_Y], Faction_Infos[factionid][fFaction_HQ_Inside_Z]);
- SetPlayerVirtualWorld(playerid, factionid);
- if(Player_Infos[playerid][pDraging] != -1){
- SetPlayerVirtualWorld(Player_Infos[playerid][pDraging], Player_Infos[playerid][pInObject]);
- SetPlayerInterior(Player_Infos[playerid][pDraging], Player_Infos[playerid][pObjectInterior]);
- }
- return 1;
- }
- stock PutPlayerInBusiness(playerid, businessid){
- if(GetPlayerCash(playerid) < Business_Infos[businessid][bizEnter_Fee]){
- SendClientMessage(playerid, COLOR_RED, "You need more money to enter this business.");
- return 1;
- }
- new tmpstr[128], amount, id;
- format(tmpstr, sizeof(tmpstr), "Players/%s.ini", Business_Infos[businessid][bizOwner_Name]);
- if(!dini_Exists(tmpstr)) return true;
- amount = dini_Int(tmpstr, "Bank");
- dini_IntSet(tmpstr, "Bank", amount+strval(Business_Infos[businessid][bizEnter_Fee]));
- GetPlayerIDByName(Business_Infos[businessid][bizOwner_Name], id);
- if(IsPlayerConnected(id)){
- Player_Infos[id][pBank] = amount+strval(Business_Infos[businessid][bizEnter_Fee]);
- format(tmpstr, sizeof(tmpstr), "%s entered to your business, your bank money rises from %d to %d", Player_Infos[playerid][pName], amount, Player_Infos[id][pBank]);
- SendClientMessage(id, COLOR_YELLOW, tmpstr);
- }
- Player_Infos[playerid][pObjectEnterX] = Business_Infos[businessid][bizEntrance_X];
- Player_Infos[playerid][pObjectEnterY] = Business_Infos[businessid][bizEntrance_Y];
- Player_Infos[playerid][pObjectEnterZ] = Business_Infos[businessid][bizEntrance_Z];
- Player_Infos[playerid][pObjectExitX] = Business_Infos[businessid][bizInterior_X];
- Player_Infos[playerid][pObjectExitY] = Business_Infos[businessid][bizInterior_Y];
- Player_Infos[playerid][pObjectExitZ] = Business_Infos[businessid][bizInterior_Z];
- Player_Infos[playerid][pObjectInterior] = Business_Infos[businessid][bizInterior];
- Player_Infos[playerid][pInObject] = businessid;
- Player_Infos[playerid][pObjectType] = OBJ_BUSINESS;
- SetPlayerInterior(playerid, Player_Infos[playerid][pObjectInterior]);
- SetPlayerPos(playerid, Business_Infos[businessid][bizInterior_X], Business_Infos[businessid][bizInterior_Y], Business_Infos[businessid][bizInterior_Z]);
- SetPlayerVirtualWorld(playerid, businessid);
- if(Player_Infos[playerid][pDraging] != -1){
- SetPlayerVirtualWorld(Player_Infos[playerid][pDraging], Player_Infos[playerid][pInObject]);
- SetPlayerInterior(Player_Infos[playerid][pDraging], Player_Infos[playerid][pObjectInterior]);
- }
- return 1;
- }
- stock PutPlayerInStore(playerid, storeid){
- Player_Infos[playerid][pObjectEnterX] = Stores_Infos[storeid][sEnter_X];
- Player_Infos[playerid][pObjectEnterY] = Stores_Infos[storeid][sEnter_Y];
- Player_Infos[playerid][pObjectEnterZ] = Stores_Infos[storeid][sEnter_Z];
- Player_Infos[playerid][pObjectExitX] = Stores_Infos[storeid][sInt_X];
- Player_Infos[playerid][pObjectExitY] = Stores_Infos[storeid][sInt_Y];
- Player_Infos[playerid][pObjectExitZ] = Stores_Infos[storeid][sInt_Z];
- Player_Infos[playerid][pObjectInterior] = Stores_Infos[storeid][sInt];
- Player_Infos[playerid][pInObject] = storeid;
- Player_Infos[playerid][pObjectType] = OBJ_STORE;
- SetPlayerInterior(playerid, Player_Infos[playerid][pObjectInterior]);
- SetPlayerPos(playerid, Stores_Infos[storeid][sInt_X], Stores_Infos[storeid][sInt_Y], Stores_Infos[storeid][sInt_Z]);
- SetPlayerVirtualWorld(playerid, storeid);
- if(Player_Infos[playerid][pDraging] != -1){
- SetPlayerVirtualWorld(Player_Infos[playerid][pDraging], Player_Infos[playerid][pInObject]);
- SetPlayerInterior(Player_Infos[playerid][pDraging], Player_Infos[playerid][pObjectInterior]);
- }
- return 1;
- }
- stock PutPlayerInBank(playerid, bankid){
- Player_Infos[playerid][pObjectEnterX] = BankInfos[bankid][BankExitX];
- Player_Infos[playerid][pObjectEnterY] = BankInfos[bankid][BankExitY];
- Player_Infos[playerid][pObjectEnterZ] = BankInfos[bankid][BankExitZ];
- Player_Infos[playerid][pObjectExitX] = BankInfos[bankid][BankEnterX];
- Player_Infos[playerid][pObjectExitY] = BankInfos[bankid][BankEnterY];
- Player_Infos[playerid][pObjectExitZ] = BankInfos[bankid][BankEnterZ];
- Player_Infos[playerid][pInObject] = bankid;
- Player_Infos[playerid][pObjectInterior] = BankInfos[bankid][BankInteriorID];
- Player_Infos[playerid][pObjectType] = OBJ_BANK;
- SetPlayerInterior(playerid, Player_Infos[playerid][pObjectInterior]);
- SetPlayerPos(playerid, BankInfos[bankid][BankEnterX], BankInfos[bankid][BankEnterY], BankInfos[bankid][BankEnterZ]);
- SetPlayerVirtualWorld(playerid, bankid);
- if(Player_Infos[playerid][pDraging] != -1){
- SetPlayerVirtualWorld(Player_Infos[playerid][pDraging], Player_Infos[playerid][pInObject]);
- SetPlayerInterior(Player_Infos[playerid][pDraging], Player_Infos[playerid][pObjectInterior]);
- }
- return 1;
- }
- stock PutPlayerInObject(playerid){
- new ID;
- if(IsPlayerNearObject(playerid, OBJ_HOUSE, 2.0, ID)){
- if(HouseInfos[ID][Locked] == 1){
- GameTextForPlayer(playerid, "~r~This house is locked", 3000, 6);
- return 1;
- }
- PutPlayerInHouse(playerid, ID);
- return 1;
- }else if(IsPlayerNearObject(playerid, OBJ_FACTION, 2.0, ID)){
- PutPlayerInFaction(playerid, ID);
- return 1;
- }else if(IsPlayerNearObject(playerid, OBJ_BUSINESS, 2.0, ID)){
- if(Business_Infos[ID][bizLocked] == 1){
- GameTextForPlayer(playerid, "~r~This business is locked", 3000, 6);
- return 1;
- }
- PutPlayerInBusiness(playerid, ID);
- return 1;
- }else if(IsPlayerNearObject(playerid, OBJ_STORE, 2.0, ID)){
- PutPlayerInStore(playerid, ID);
- return 1;
- }else if(IsPlayerNearObject(playerid, OBJ_BANK, 2.0, ID)){
- PutPlayerInBank(playerid, ID);
- return 1;
- }else{
- return 1;
- }
- }
- stock RemovePlayerFromObject(playerid){
- if(Player_Infos[playerid][pInObject] != -1){
- if(IsPlayerInRangeOfPoint(playerid, 2, Player_Infos[playerid][pObjectExitX], Player_Infos[playerid][pObjectExitY], Player_Infos[playerid][pObjectExitZ])){
- Player_Infos[playerid][pInObject] = -1;
- Player_Infos[playerid][pObjectType] = 0;
- SetPlayerPos(playerid, Player_Infos[playerid][pObjectEnterX], Player_Infos[playerid][pObjectEnterY], Player_Infos[playerid][pObjectEnterZ]);
- SetPlayerInterior(playerid, 0);
- SetPlayerVirtualWorld(playerid, 0);
- if(Player_Infos[playerid][pDraging] != -1){
- SetPlayerVirtualWorld(Player_Infos[playerid][pDraging], Player_Infos[playerid][pInObject]);
- SetPlayerInterior(Player_Infos[playerid][pDraging], Player_Infos[playerid][pObjectInterior]);
- }
- }
- }
- }
- public TazePlayer(playerid){
- TogglePlayerControllable(playerid, 1);
- Player_Infos[playerid][pTazed] = 0;
- return 1;
- }
- public StealVehicle(playerid, vehicleid){
- PutPlayerInVehicle(playerid, vehicleid, 0);
- TogglePlayerControllable(playerid, 1);
- Player_Infos[playerid][pStealing] = 0;
- GameTextForPlayer(playerid, "~g~Engine started", 3000, 6);
- ToggleVehicleEngine(vehicleid, 1);
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement