Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // (C) BY [DT]SNIPER from sa-mp.de edit by StreetGT
- // Never remove credits!
- #include <a_samp>
- #include <utils>
- // Functions:
- #define MaxVeh 2 // Vehicle a person can own.
- new Srt_OtherVehicle = 1; // set 0 if you don't want see categorie Cheap Cars open
- new Srt_LockOnSpawn = 0; // set to 1 if cars get after logging, etc. are to locked/unlocked
- new Srt_LiveView = 0; // Live view on, or off ( 0 )
- new Float:ParkPos_Autos[3][4] = {
- {974.7033, -925.4849, 45.7656, 90.0},
- {974.7033, -920.4849, 45.7656, 90.0},
- {974.7033, -915.4849, 45.7656, 90.0}
- };
- new Float:ParkPos_Bikes[4][4] = {
- {955.1473, -936.0457, 42.3294, 0.0},
- {955.0228, -931.0831, 42.3255, 0.0},
- {953.8707, -937.0492, 42.7656, 0.0},
- {953.7427, -934.3327, 42.7656, 0.0}
- };
- new Float:SrtOthers[5][4] = {
- {951.7833, -933.9078, 42.5685, 353.4855}, // Limo ParkPos
- {952.8622,-910.6187,45.7656, 0.0}, // Info Zeichen etc.
- {959.2946, -905.6293, 45.7656, 184.6502}, // Others ParkPos
- {943.9965, -934.0697, 61.2627, 261.1646}, // LiveView Car
- {940.2521, -939.5271, 60.7009, 0.0} // LiveView Cam
- };
- new CatName[][] =
- {
- "Bikes", "Cheap Vehicles", "Normal Vehicles", "Fast Vehicle", "Other Vehicles"
- };
- new RadVehicle[8][2] = {
- {462,1000}, // Faggio ($1000)
- {586,1700}, // Wayfarer ($1700)
- {521,2500}, // FCR-900($2500)
- {461,3100}, // PCJ-600 ($3100)
- {463,3800}, // Freeway ($3800)
- {468,4200}, // Sanchez ($4200)
- {581,4900}, // BF-400 ($4900)
- {522,6000} // NRG-500 ($6000)
- };
- new FastVehicle[10][2] = {
- {558,20000}, // Uranus ($20000)
- {560,22500}, // Sultan ($22500)
- {603,24000}, // Phoenix ($24000)
- {506,26200}, // Super GT ($26200)
- {562,28800}, // Elegy ($28800)
- {541,30000}, // Bullet ($30000)
- {415,31500}, // Cheetah ($31500)
- {451,33200}, // Turismo ($33200)
- {429,35000}, // Banshee ($35000)
- {411,40000} // Infernus ($40000)
- };
- new NormVehicle[9][2] = {
- {529,11000}, // Willard ($11000)
- {492,11800}, // Greenwood ($11800)
- {475,12500}, // Subre ($12500)
- {436,13200}, // Previon ($13200)
- {405,14000}, // Sentinel ($14000)
- {401,14900}, // Bravura ($14900)
- {589,15800}, // Club ($15800)
- {458,16500}, // Solair ($16500)
- {559,17000} // Jester ($17000)
- };
- new CheapVehicle[8][2] = {
- {605,5000}, // 1. Gebrauchtwagen ($5000)
- {604,5900}, // 2. Gebrauchtwagen ($5900)
- {418,6200}, // Moonbeam ($6200)
- {467,7100}, // Oceanic ($7100)
- {422,7600}, // Bobcat ($7600)
- {527,8300}, // Cadrona ($8300)
- {496,8900}, // Blista Compact ($8900)
- {500,9400} // Mesa ($9400)
- };
- new OtherVehicle[5][2] = {
- {409,15000}, // Stretch ($15000)
- {471,7000}, // Quad ($7000)
- {457,2500}, // Caddy ($2500)
- {572,900}, // Mower ($900)
- {424,45000} // BF-Injection ($45000)
- };
- // Functions
- #define COLOR_YELLOW 0xFFFF00AA
- #define COLOR_WHITE 0xFFFFFFFF
- #define COLOR_GREY 0xAFAFAFAA
- #define COLOR_LIGHTBLUE 0x33CCFFAA
- forward OnPlayerBuyCar(playerid,Model,Price);
- forward SetParkPos(playerid,Model);
- forward OnPlayerCarLogin(playerid);
- forward OnPlayerCarUpdate(playerid);
- forward PlayerCarSpawn(playerid,Slot);
- forward ini_GetKey( line[] );
- forward ini_GetValue( line[] );
- forward PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z);
- forward IsAWheel(componentid);
- forward IsAExhaust(componentid);
- forward IsASideR(componentid);
- forward IsASideL(componentid);
- forward IsAFB(componentid);
- forward IsARB(componentid);
- forward IsASpoiler(componentid);
- forward IsARoof(componentid);
- forward Srt_LockCar(carid);
- forward Srt_UnLockCar(carid);
- forward CarTuning(playerid,slot);
- forward LetDoorsLocked();
- forward IsASrtcar(car);
- new SideL, SideR, Srt_Info;
- new Menu: Srt_HauptMenu, Menu: Srt_2RadMenu, Menu: Srt_FastMenu, Menu: Srt_NormMenu, Menu: Srt_CheapMenu, Menu: Srt_OtherMenu;
- new Srt_PlayerHaveCar[MAX_PLAYERS][MaxVeh];
- new Srt_PlayerKey[MAX_PLAYERS];
- new Srt_CarKey[MAX_PLAYERS];
- new Srt_ParkRights[MAX_PLAYERS];
- new RadZahl = 0, CarZahl = 0;
- new Srt_Carlock[700];
- new Text: CarKauf[MAX_PLAYERS];
- new Srt_CarownerCar[MAX_PLAYERS],Srt_CarownerCat[MAX_PLAYERS],Srt_CarownerSCar[MAX_PLAYERS];
- enum Srt_PlayerCar
- {
- CarId,
- CarModel,
- Float:CarPos_x,
- Float:CarPos_y,
- Float:CarPos_z,
- Float:CarRotate,
- CarNitro,
- CarHyd,
- CarWheel,
- CarAusp,
- CarSideL,
- CarSideR,
- CarFB,
- CarRB,
- CarSpoiler,
- CarRoof,
- CarHood,
- CarVents,
- CarLamps,
- CarPJ,
- CarC1,
- CarC2,
- CarPrice,
- };
- new PlayerCar[MAX_PLAYERS][MaxVeh][Srt_PlayerCar];
- new CarName[][] =
- {
- "Landstalker", "Bravura", "Buffalo", "Linerunner", "Perrenial", "Sentinel",
- "Dumper", "Firetruck", "Trashmaster", "Stretch", "Manana", "Infernus",
- "Voodoo", "Pony", "Mule", "Cheetah", "Ambulance", "Leviathan", "Moonbeam",
- "Esperanto", "Taxi", "Washington", "Bobcat", "Whoopee", "BF Injection",
- "Hunter", "Premier", "Enforcer", "Securicar", "Banshee", "Predator", "Bus",
- "Rhino", "Barracks", "Hotknife", "Trailer", "Previon", "Coach", "Cabbie",
- "Stallion", "Rumpo", "RC Bandit", "Romero", "Packer", "Monster", "Admiral",
- "Squalo", "Seasparrow", "Pizzaboy", "Tram", "Trailer", "Turismo", "Speeder",
- "Reefer", "Tropic", "Flatbed", "Yankee", "Caddy", "Solair", "Berkley's RC Van",
- "Skimmer", "PCJ-600", "Faggio", "Freeway", "RC Baron", "RC Raider", "Glendale",
- "Oceanic","Sanchez", "Sparrow", "Patriot", "Quad", "Coastguard", "Dinghy",
- "Hermes", "Sabre", "Rustler", "ZR-350", "Walton", "Regina", "Comet", "BMX",
- "Burrito", "Camper", "Marquis", "Baggage", "Dozer", "Maverick", "News Chopper",
- "Rancher", "FBI Rancher", "Virgo", "Greenwood", "Jetmax", "Hotring", "Sandking",
- "Blista Compact", "Police Maverick", "Boxvillde", "Benson", "Mesa", "RC Goblin",
- "Hotring Racer A", "Hotring Racer B", "Bloodring Banger", "Rancher", "Super GT",
- "Elegant", "Journey", "Bike", "Mountain Bike", "Beagle", "Cropduster", "Stunt",
- "Tanker", "Roadtrain", "Nebula", "Majestic", "Buccaneer", "Shamal", "Hydra",
- "FCR-900", "NRG-500", "HPV1000", "Cement Truck", "Tow Truck", "Fortune",
- "Cadrona", "FBI Truck", "Willard", "Forklift", "Tractor", "Combine", "Feltzer",
- "Remington", "Slamvan", "Blade", "Freight", "Streak", "Vortex", "Vincent",
- "Bullet", "Clover", "Sadler", "Firetruck", "Hustler", "Intruder", "Primo",
- "Cargobob", "Tampa", "Sunrise", "Merit", "Utility", "Nevada", "Yosemite",
- "Windsor", "Monster", "Monster", "Uranus", "Jester", "Sultan", "Stratum",
- "Elegy", "Raindance", "RC Tiger", "Flash", "Tahoma", "Savanna", "Bandito",
- "Freight Flat", "Streak Carriage", "Kart", "Mower", "Dune", "Sweeper",
- "Broadway", "Tornado", "AT-400", "DFT-30", "Huntley", "Stafford", "BF-400",
- "News Van", "Tug", "Trailer", "Emperor", "Wayfarer", "Euros", "Hotdog", "Club",
- "Freight Box", "Trailer", "Andromada", "Dodo", "RC Cam", "Launch", "Police Car",
- "Police Car", "Police Car", "Police Ranger", "Picador", "S.W.A.T", "Alpha",
- "Phoenix", "2. Gebrauchtwagen", "1. Gebrauchtwagen", "Luggage", "Luggage", "Stairs", "Boxville",
- "Tiller", "Utility Trailer"
- };
- public OnFilterScriptInit()
- {
- print("\n--------------------------------------");
- print(" SRT_Car edited by StreetGT ");
- print("--------------------------------------\n");
- Srt_Info = CreatePickup(1239, 2, SrtOthers[1][0],SrtOthers[1][1],SrtOthers[1][2],-1);
- if(!Srt_LiveView)
- {
- //Hauptmenu
- Srt_HauptMenu = CreateMenu("LS CarOwner",2,200,100,150,75);
- SetMenuColumnHeader(Srt_HauptMenu, 0, "LS CarOwner");
- AddMenuItem(Srt_HauptMenu, 0, "Fast Vehicle");
- AddMenuItem(Srt_HauptMenu, 0, "Normal Vehicles");
- AddMenuItem(Srt_HauptMenu, 0, "Cheap Vehicles");
- AddMenuItem(Srt_HauptMenu, 0, "Bikes");
- if(Srt_OtherVehicle){ AddMenuItem(Srt_HauptMenu, 0, "Others"); }
- AddMenuItem(Srt_HauptMenu, 0, "Exit");
- //2RadMenu
- Srt_2RadMenu = CreateMenu("Bikes",2,200,100,150,75);
- SetMenuColumnHeader(Srt_2RadMenu, 0, "Bikes");
- for(new x=0; x < sizeof(RadVehicle); x++) {
- new string[128];
- format(string, sizeof(string), "%s ($%d)",CarName[RadVehicle[x][0]-400],RadVehicle[x][1]);
- AddMenuItem(Srt_2RadMenu, 0, string);
- }
- //FastMenu
- Srt_FastMenu = CreateMenu("Fast Vehicle",2,200,100,150,75);
- SetMenuColumnHeader(Srt_FastMenu, 0, "Fast Vehicle");
- for(new x=0; x < sizeof(FastVehicle); x++) {
- new string[128];
- format(string, sizeof(string), "%s ($%d)",CarName[FastVehicle[x][0]-400],FastVehicle[x][1]);
- AddMenuItem(Srt_FastMenu, 0, string);
- }
- //NormMenu
- Srt_NormMenu = CreateMenu("Cheap Vehicles",2,200,100,150,75);
- SetMenuColumnHeader(Srt_NormMenu, 0, "Normal Vehicles");
- for(new x=0; x < sizeof(NormVehicle); x++) {
- new string[128];
- format(string, sizeof(string), "%s ($%d)",CarName[NormVehicle[x][0]-400],NormVehicle[x][1]);
- AddMenuItem(Srt_NormMenu, 0, string);
- }
- //CheapMenu
- Srt_CheapMenu = CreateMenu("Cheap Vehicles",2,200,100,150,75);
- SetMenuColumnHeader(Srt_CheapMenu, 0, "Cheap Vehicles");
- for(new x=0; x < sizeof(CheapVehicle); x++) {
- new string[128];
- format(string, sizeof(string), "%s ($%d)",CarName[CheapVehicle[x][0]-400],CheapVehicle[x][1]);
- AddMenuItem(Srt_CheapMenu, 0, string);
- }
- //OtherMenu
- Srt_OtherMenu = CreateMenu("Others",2,200,100,150,75);
- SetMenuColumnHeader(Srt_OtherMenu, 0, "Others");
- for(new x=0; x < sizeof(OtherVehicle); x++) {
- new string[128];
- format(string, sizeof(string), "%s ($%d)",CarName[OtherVehicle[x][0]-400],OtherVehicle[x][1]);
- AddMenuItem(Srt_OtherMenu, 0, string);
- }
- }
- SetTimer("LetDoorsLocked", 1000, 1);
- return 1;
- }
- public OnFilterScriptExit()
- {
- for(new i = 0; i < MAX_PLAYERS; i++)
- {
- OnPlayerCarUpdate(i);
- }
- DestroyPickup(Srt_Info);
- return 1;
- }
- main()
- {
- print("\n----------------------------------");
- print(" DT_Car by [DT]Sniper and www.darkTnetwork.de");
- print("----------------------------------\n");
- }
- public SetParkPos(playerid,Model)
- {
- if(IsPlayerConnected(playerid) && !Srt_PlayerHaveCar[playerid][Srt_PlayerKey[playerid]])
- {
- for(new x=0; x < sizeof(RadVehicle); x++) {
- if(Model == RadVehicle[x][0])
- {
- PlayerCar[playerid][Srt_PlayerKey[playerid]][CarPos_x] = ParkPos_Bikes[RadZahl][0];
- PlayerCar[playerid][Srt_PlayerKey[playerid]][CarPos_y] = ParkPos_Bikes[RadZahl][1];
- PlayerCar[playerid][Srt_PlayerKey[playerid]][CarPos_z] = ParkPos_Bikes[RadZahl][2];
- PlayerCar[playerid][Srt_PlayerKey[playerid]][CarRotate] = ParkPos_Bikes[RadZahl][3];
- RadZahl += 1;
- if(RadZahl == 4)
- {
- RadZahl = 0;
- }
- }
- }
- for(new x=0; x < sizeof(FastVehicle); x++) {
- if(Model == FastVehicle[x][0])
- {
- PlayerCar[playerid][Srt_PlayerKey[playerid]][CarPos_x] = ParkPos_Autos[CarZahl][0];
- PlayerCar[playerid][Srt_PlayerKey[playerid]][CarPos_y] = ParkPos_Autos[CarZahl][1];
- PlayerCar[playerid][Srt_PlayerKey[playerid]][CarPos_z] = ParkPos_Autos[CarZahl][2];
- PlayerCar[playerid][Srt_PlayerKey[playerid]][CarRotate] = ParkPos_Autos[CarZahl][3];
- CarZahl += 1;
- if(CarZahl == 3)
- {
- CarZahl = 0;
- }
- }
- }
- for(new x=0; x < sizeof(NormVehicle); x++) {
- if(Model == NormVehicle[x][0])
- {
- PlayerCar[playerid][Srt_PlayerKey[playerid]][CarPos_x] = ParkPos_Autos[CarZahl][0];
- PlayerCar[playerid][Srt_PlayerKey[playerid]][CarPos_y] = ParkPos_Autos[CarZahl][1];
- PlayerCar[playerid][Srt_PlayerKey[playerid]][CarPos_z] = ParkPos_Autos[CarZahl][2];
- PlayerCar[playerid][Srt_PlayerKey[playerid]][CarRotate] = ParkPos_Autos[CarZahl][3];
- CarZahl += 1;
- if(CarZahl == 3)
- {
- CarZahl = 0;
- }
- }
- }
- for(new x=0; x < sizeof(CheapVehicle); x++) {
- if(Model == CheapVehicle[x][0])
- {
- PlayerCar[playerid][Srt_PlayerKey[playerid]][CarPos_x] = ParkPos_Autos[CarZahl][0];
- PlayerCar[playerid][Srt_PlayerKey[playerid]][CarPos_y] = ParkPos_Autos[CarZahl][1];
- PlayerCar[playerid][Srt_PlayerKey[playerid]][CarPos_z] = ParkPos_Autos[CarZahl][2];
- PlayerCar[playerid][Srt_PlayerKey[playerid]][CarRotate] = ParkPos_Autos[CarZahl][3];
- CarZahl += 1;
- if(CarZahl == 3)
- {
- CarZahl = 0;
- }
- }
- }
- for(new x=0; x < sizeof(OtherVehicle); x++) {
- if(Model == OtherVehicle[x][0])
- {
- PlayerCar[playerid][Srt_PlayerKey[playerid]][CarPos_x] = SrtOthers[2][0];
- PlayerCar[playerid][Srt_PlayerKey[playerid]][CarPos_y] = SrtOthers[2][1];
- PlayerCar[playerid][Srt_PlayerKey[playerid]][CarPos_z] = SrtOthers[2][2];
- PlayerCar[playerid][Srt_PlayerKey[playerid]][CarRotate] = SrtOthers[2][3];
- }
- }
- if(Model == 409)
- {
- PlayerCar[playerid][Srt_PlayerKey[playerid]][CarPos_x] = SrtOthers[0][0];
- PlayerCar[playerid][Srt_PlayerKey[playerid]][CarPos_y] = SrtOthers[0][1];
- PlayerCar[playerid][Srt_PlayerKey[playerid]][CarPos_z] = SrtOthers[0][2];
- PlayerCar[playerid][Srt_PlayerKey[playerid]][CarRotate] = SrtOthers[0][3];
- }
- }
- }
- public OnPlayerBuyCar(playerid,Model,Price)
- {
- if(IsPlayerConnected(playerid) && !Srt_PlayerHaveCar[playerid][Srt_PlayerKey[playerid]])
- {
- GivePlayerMoney(playerid, -Price);
- SetParkPos(playerid,Model);
- new name[MAX_PLAYER_NAME], str[128];
- GetPlayerName(playerid, name, sizeof name);
- format(str, sizeof str, "/SRT_Cars/%s%d.Srtcar", name,Srt_PlayerKey[playerid]);
- new File: hFile = fopen(str, io_write);
- if (hFile)
- {
- new var[32];
- format(var, 32, "CarId=0\n");fwrite(hFile, var);
- format(var, 32, "CarModel=%d\n",Model);fwrite(hFile, var);
- format(var, 32, "CarPos_x=%.3f\n",PlayerCar[playerid][Srt_PlayerKey[playerid]][CarPos_x]);fwrite(hFile, var);
- format(var, 32, "CarPos_y=%.3f\n",PlayerCar[playerid][Srt_PlayerKey[playerid]][CarPos_y]);fwrite(hFile, var);
- format(var, 32, "CarPos_z=%.3f\n",PlayerCar[playerid][Srt_PlayerKey[playerid]][CarPos_z]);fwrite(hFile, var);
- format(var, 32, "CarRotate=%.3f\n",PlayerCar[playerid][Srt_PlayerKey[playerid]][CarRotate]);fwrite(hFile, var);
- format(var, 32, "CarNitro=0\n");fwrite(hFile, var);
- format(var, 32, "CarHyd=0\n");fwrite(hFile, var);
- format(var, 32, "CarWheel=0\n");fwrite(hFile, var);
- format(var, 32, "CarAusp=0\n");fwrite(hFile, var);
- format(var, 32, "CarSideL=0\n");fwrite(hFile, var);
- format(var, 32, "CarSideR=0\n");fwrite(hFile, var);
- format(var, 32, "CarFB=0\n");fwrite(hFile, var);
- format(var, 32, "CarRB=0\n");fwrite(hFile, var);
- format(var, 32, "CarSpoiler=0\n");fwrite(hFile, var);
- format(var, 32, "CarRoof=0\n");fwrite(hFile, var);
- format(var, 32, "CarHood=0\n");fwrite(hFile, var);
- format(var, 32, "CarVents=0\n");fwrite(hFile, var);
- format(var, 32, "CarLamps=0\n");fwrite(hFile, var);
- format(var, 32, "CarPJ=-1\n");fwrite(hFile, var);
- format(var, 32, "CarC1=-1\n");fwrite(hFile, var);
- format(var, 32, "CarC2=-1\n");fwrite(hFile, var);
- format(var, 32, "Price=%d\n",Price);fwrite(hFile, var);
- fclose(hFile);
- }
- OnPlayerCarLogin(playerid);
- }
- }
- public OnPlayerCarLogin(playerid)
- {
- for(new x = 0; x < MaxVeh; x++)
- {
- if(!Srt_PlayerHaveCar[playerid][x])
- {
- new string2[128];
- new playername2[MAX_PLAYER_NAME];
- GetPlayerName(playerid, playername2, sizeof(playername2));
- format(string2, sizeof(string2), "/SRT_Cars/%s%d.Srtcar", playername2,x);
- new File: UserFile = fopen(string2, io_read);
- if (UserFile)
- {
- Srt_PlayerHaveCar[playerid][x] = 1;
- new key[ 256 ] , val[ 256 ];
- new Data[ 256 ];
- while ( fread( UserFile , Data , sizeof( Data ) ) )
- {
- key = ini_GetKey( Data );
- if( strcmp( key , "CarId" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarId] = strval( val ); }
- if( strcmp( key , "CarModel" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarModel] = strval( val ); }
- if( strcmp( key , "CarPos_x" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarPos_x] = floatstr( val ); }
- if( strcmp( key , "CarPos_y" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarPos_y] = floatstr( val ); }
- if( strcmp( key , "CarPos_z" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarPos_z] = floatstr( val ); }
- if( strcmp( key , "CarRotate" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarRotate] = floatstr( val ); }
- if( strcmp( key , "CarNitro" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarNitro] = strval( val ); }
- if( strcmp( key , "CarHyd" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarHyd] = strval( val ); }
- if( strcmp( key , "CarWheel" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarWheel] = strval( val ); }
- if( strcmp( key , "CarAusp" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarAusp] = strval( val ); }
- if( strcmp( key , "CarSideL" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarSideL] = strval( val ); }
- if( strcmp( key , "CarSideR" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarSideR] = strval( val ); }
- if( strcmp( key , "CarFB" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarFB] = strval( val ); }
- if( strcmp( key , "CarRB" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarRB] = strval( val ); }
- if( strcmp( key , "CarSpoiler" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarSpoiler] = strval( val ); }
- if( strcmp( key , "CarRoof" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarRoof] = strval( val ); }
- if( strcmp( key , "CarHood" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarHood] = strval( val ); }
- if( strcmp( key , "CarVents" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarVents] = strval( val ); }
- if( strcmp( key , "CarLamps" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarLamps] = strval( val ); }
- if( strcmp( key , "CarPJ" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarPJ] = strval( val ); }
- if( strcmp( key , "CarC1" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarC1] = strval( val ); }
- if( strcmp( key , "CarC2" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarC2] = strval( val ); }
- if( strcmp( key , "Price" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarPrice] = strval( val ); }
- }
- fclose(UserFile);
- PlayerCarSpawn(playerid,x);
- }
- }
- }
- }
- public PlayerCarSpawn(playerid,Slot)
- {
- if(IsPlayerConnected(playerid))
- {
- if(Srt_PlayerHaveCar[playerid][Slot])
- {
- PlayerCar[playerid][Slot][CarId] = CreateVehicle(PlayerCar[playerid][Slot][CarModel],PlayerCar[playerid][Slot][CarPos_x],PlayerCar[playerid][Slot][CarPos_y],PlayerCar[playerid][Slot][CarPos_z],PlayerCar[playerid][Slot][CarRotate],PlayerCar[playerid][Slot][CarC1],PlayerCar[playerid][Slot][CarC2], 60000);/*vehicle spawn*/
- ChangeVehicleColor(PlayerCar[playerid][Slot][CarId],PlayerCar[playerid][Slot][CarC1],PlayerCar[playerid][Slot][CarC2]);
- if(PlayerCar[playerid][Slot][CarPJ] >= 0) {ChangeVehiclePaintjob(PlayerCar[playerid][Slot][CarId],PlayerCar[playerid][Slot][CarPJ]);}
- if(PlayerCar[playerid][Slot][CarNitro] != 0) {AddVehicleComponent(PlayerCar[playerid][Slot][CarId],PlayerCar[playerid][Slot][CarNitro]);}
- if(PlayerCar[playerid][Slot][CarHyd] != 0) {AddVehicleComponent(PlayerCar[playerid][Slot][CarId],PlayerCar[playerid][Slot][CarHyd]);}
- if(PlayerCar[playerid][Slot][CarWheel] != 0) {AddVehicleComponent(PlayerCar[playerid][Slot][CarId],PlayerCar[playerid][Slot][CarWheel]);}
- if(PlayerCar[playerid][Slot][CarAusp] != 0) {AddVehicleComponent(PlayerCar[playerid][Slot][CarId],PlayerCar[playerid][Slot][CarAusp]);}
- if(PlayerCar[playerid][Slot][CarSideL] != 0) {AddVehicleComponent(PlayerCar[playerid][Slot][CarId],PlayerCar[playerid][Slot][CarSideL]);}
- if(PlayerCar[playerid][Slot][CarSideR] != 0) {AddVehicleComponent(PlayerCar[playerid][Slot][CarId],PlayerCar[playerid][Slot][CarSideR]);}
- if(PlayerCar[playerid][Slot][CarFB] != 0) {AddVehicleComponent(PlayerCar[playerid][Slot][CarId],PlayerCar[playerid][Slot][CarFB]);}
- if(PlayerCar[playerid][Slot][CarRB] != 0) {AddVehicleComponent(PlayerCar[playerid][Slot][CarId],PlayerCar[playerid][Slot][CarRB]);}
- if(PlayerCar[playerid][Slot][CarSpoiler] != 0) {AddVehicleComponent(PlayerCar[playerid][Slot][CarId],PlayerCar[playerid][Slot][CarSpoiler]);}
- if(PlayerCar[playerid][Slot][CarRoof] != 0) {AddVehicleComponent(PlayerCar[playerid][Slot][CarId],PlayerCar[playerid][Slot][CarRoof]);}
- if(PlayerCar[playerid][Slot][CarHood] != 0) {AddVehicleComponent(PlayerCar[playerid][Slot][CarId],PlayerCar[playerid][Slot][CarHood]);}
- if(PlayerCar[playerid][Slot][CarVents] != 0) {AddVehicleComponent(PlayerCar[playerid][Slot][CarId],PlayerCar[playerid][Slot][CarVents]);}
- if(PlayerCar[playerid][Slot][CarLamps] != 0) {AddVehicleComponent(PlayerCar[playerid][Slot][CarId],PlayerCar[playerid][Slot][CarLamps]);}
- if(Srt_LockOnSpawn)
- {
- Srt_Carlock[PlayerCar[playerid][Slot][CarId]] = 1;
- Srt_LockCar(PlayerCar[playerid][Slot][CarId]);
- }
- }
- }
- }
- public OnPlayerCarUpdate(playerid)
- {
- if(IsPlayerConnected(playerid))
- {
- for(new x = 0; x < MaxVeh; x++)
- {
- if(Srt_PlayerHaveCar[playerid][x])
- {
- DestroyVehicle(PlayerCar[playerid][x][CarId]);
- Srt_Carlock[PlayerCar[playerid][x][CarId]] = 0;
- Srt_LockCar(PlayerCar[playerid][x][CarId]);
- new string3[128];
- new playername3[MAX_PLAYER_NAME];
- GetPlayerName(playerid, playername3, sizeof(playername3));
- format(string3, sizeof(string3), "/SRT_Cars/%s%d.Srtcar", playername3,x);
- new File: hFile = fopen(string3, io_write);
- if (hFile)
- {
- new var[32];
- format(var, 32, "CarId=%d\n",PlayerCar[playerid][x][CarId]);fwrite(hFile, var);
- format(var, 32, "CarModel=%d\n",PlayerCar[playerid][x][CarModel]);fwrite(hFile, var);
- format(var, 32, "CarPos_x=%.3f\n",PlayerCar[playerid][x][CarPos_x]);fwrite(hFile, var);
- format(var, 32, "CarPos_y=%.3f\n",PlayerCar[playerid][x][CarPos_y]);fwrite(hFile, var);
- format(var, 32, "CarPos_z=%.3f\n",PlayerCar[playerid][x][CarPos_z]);fwrite(hFile, var);
- format(var, 32, "CarRotate=%.3f\n",PlayerCar[playerid][x][CarRotate]);fwrite(hFile, var);
- format(var, 32, "CarNitro=%d\n",PlayerCar[playerid][x][CarNitro]);fwrite(hFile, var);
- format(var, 32, "CarHyd=%d\n",PlayerCar[playerid][x][CarHyd]);fwrite(hFile, var);
- format(var, 32, "CarWheel=%d\n",PlayerCar[playerid][x][CarWheel]);fwrite(hFile, var);
- format(var, 32, "CarAusp=%d\n",PlayerCar[playerid][x][CarAusp]);fwrite(hFile, var);
- format(var, 32, "CarSideL=%d\n",PlayerCar[playerid][x][CarSideL]);fwrite(hFile, var);
- format(var, 32, "CarSideR=%d\n",PlayerCar[playerid][x][CarSideR]);fwrite(hFile, var);
- format(var, 32, "CarFB=%d\n",PlayerCar[playerid][x][CarFB]);fwrite(hFile, var);
- format(var, 32, "CarRB=%d\n",PlayerCar[playerid][x][CarRB]);fwrite(hFile, var);
- format(var, 32, "CarSpoiler=%d\n",PlayerCar[playerid][x][CarSpoiler]);fwrite(hFile, var);
- format(var, 32, "CarRoof=%d\n",PlayerCar[playerid][x][CarRoof]);fwrite(hFile, var);
- format(var, 32, "CarHood=%d\n",PlayerCar[playerid][x][CarHood]);fwrite(hFile, var);
- format(var, 32, "CarVents=%d\n",PlayerCar[playerid][x][CarVents]);fwrite(hFile, var);
- format(var, 32, "CarLamps=%d\n",PlayerCar[playerid][x][CarLamps]);fwrite(hFile, var);
- format(var, 32, "CarPJ=%d\n",PlayerCar[playerid][x][CarPJ]);fwrite(hFile, var);
- format(var, 32, "CarC1=%d\n",PlayerCar[playerid][x][CarC1]);fwrite(hFile, var);
- format(var, 32, "CarC2=%d\n",PlayerCar[playerid][x][CarC2]);fwrite(hFile, var);
- format(var, 32, "Price=%d\n",PlayerCar[playerid][x][CarPrice]);fwrite(hFile, var);
- fclose(hFile);
- }
- }
- }
- }
- }
- public OnPlayerConnect(playerid)
- {
- Srt_CarownerCar[playerid] = 0;
- Srt_CarownerCat[playerid] = 0;
- Srt_CarownerSCar[playerid] = 0;
- Srt_PlayerKey[playerid] = 0;
- Srt_CarKey[playerid] = 0;
- Srt_ParkRights[playerid] = 0;
- for(new i = 0; i < MaxVeh; i++)
- {
- Srt_PlayerHaveCar[playerid][i] = 0;
- }
- OnPlayerCarLogin(playerid);
- for(new i = 0; i < 700; i++)
- {
- if(Srt_Carlock[i])
- {
- SetVehicleParamsForPlayer(i,playerid,0,1);
- }
- }
- return 1;
- }
- public OnPlayerSpawn(playerid)
- {
- SetPlayerMapIcon(playerid, 30, SrtOthers[1][0],SrtOthers[1][1],SrtOthers[1][2], 55, COLOR_YELLOW);
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- OnPlayerCarUpdate(playerid);
- return 1;
- }
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- new idx, cmd[256], tmp[256], string[126];
- cmd = strtok(cmdtext, idx);
- if (strcmp("/carhelp", cmdtext, true, 10) == 0)
- {
- SendClientMessage(playerid, COLOR_LIGHTBLUE," ----------------[CARHELP]----------------");
- SendClientMessage(playerid, COLOR_WHITE, " | COMMANDS | /park /carlock /carkey /carsell");
- SendClientMessage(playerid, COLOR_WHITE, " | COMMANDS | /giveparkrights /givecarkey /carkeylock");
- SendClientMessage(playerid, COLOR_LIGHTBLUE," -----------------------------------------");
- return 1;
- }
- if (strcmp("/carsell", cmdtext, true, 10) == 0)
- {
- if(Srt_PlayerHaveCar[playerid][Srt_PlayerKey[playerid]])
- {
- GivePlayerMoney(playerid,PlayerCar[playerid][Srt_PlayerKey[playerid]][CarPrice] / 2);
- Srt_Carlock[PlayerCar[playerid][Srt_PlayerKey[playerid]][CarId]] = 0;
- Srt_UnLockCar(PlayerCar[playerid][Srt_PlayerKey[playerid]][CarId]);
- DestroyVehicle(PlayerCar[playerid][Srt_PlayerKey[playerid]][CarId]);
- new string3[32];
- new playername3[MAX_PLAYER_NAME];
- GetPlayerName(playerid, playername3, sizeof(playername3));
- format(string3, sizeof(string3), "/SRT_Cars/%s%d.Srtcar", playername3,Srt_PlayerKey[playerid]);
- fremove(string3);
- Srt_PlayerHaveCar[playerid][Srt_PlayerKey[playerid]] = 0;
- SendClientMessage(playerid, COLOR_YELLOW, " You sold your vehicle sucefully!");
- }
- else
- {
- SendClientMessage(playerid, COLOR_GREY, " You don't have the right key to use this command!");
- return 1;
- }
- return 1;
- }
- if (strcmp("/park", cmdtext, true, 10) == 0)
- {
- if(Srt_PlayerHaveCar[playerid][Srt_PlayerKey[playerid]])
- {
- new newcar = GetPlayerVehicleID(playerid);
- if (newcar == PlayerCar[playerid][Srt_PlayerKey[playerid]][CarId])
- {
- new Float:X,Float:Y,Float:Z;
- new Float:z_rot;
- GetPlayerPos(playerid, X,Y,Z);
- GetVehicleZAngle(newcar, z_rot);
- PlayerCar[playerid][Srt_PlayerKey[playerid]][CarPos_x] = X;
- PlayerCar[playerid][Srt_PlayerKey[playerid]][CarPos_y] = Y;
- PlayerCar[playerid][Srt_PlayerKey[playerid]][CarPos_z] = Z;
- PlayerCar[playerid][Srt_PlayerKey[playerid]][CarRotate] = z_rot;
- SendClientMessage(playerid, COLOR_YELLOW, " You parked your vehicle, you can find them here now!");
- }
- else if (newcar == Srt_ParkRights[playerid])
- {
- new Float:X,Float:Y,Float:Z;
- new Float:z_rot;
- GetPlayerPos(playerid, X,Y,Z);
- GetVehicleZAngle(newcar, z_rot);
- PlayerCar[playerid][Srt_PlayerKey[playerid]][CarPos_x] = X;
- PlayerCar[playerid][Srt_PlayerKey[playerid]][CarPos_y] = Y;
- PlayerCar[playerid][Srt_PlayerKey[playerid]][CarPos_z] = Z;
- PlayerCar[playerid][Srt_PlayerKey[playerid]][CarRotate] = z_rot;
- SendClientMessage(playerid, COLOR_YELLOW, " You parked your vehicle, you can find them here now!");
- }
- else
- {
- SendClientMessage(playerid,COLOR_GREY," You are not in your vehicle or you don't have the right keys!");
- return 1;
- }
- }
- else if (Srt_ParkRights[playerid] != 0)
- {
- new newcar = GetPlayerVehicleID(playerid);
- if (newcar == Srt_ParkRights[playerid])
- {
- new Float:X,Float:Y,Float:Z;
- new Float:z_rot;
- GetPlayerPos(playerid, X,Y,Z);
- GetVehicleZAngle(newcar, z_rot);
- PlayerCar[playerid][Srt_PlayerKey[playerid]][CarPos_x] = X;
- PlayerCar[playerid][Srt_PlayerKey[playerid]][CarPos_y] = Y;
- PlayerCar[playerid][Srt_PlayerKey[playerid]][CarPos_z] = Z;
- PlayerCar[playerid][Srt_PlayerKey[playerid]][CarRotate] = z_rot;
- SendClientMessage(playerid, COLOR_YELLOW, " You parked your vehicle, you can find them here now!");
- }
- }
- else
- {
- SendClientMessage(playerid, COLOR_GREY, " You are not in your vehicle or you don't have the right keys!");
- return 1;
- }
- return 1;
- }
- if (strcmp("/carlock", cmdtext, true, 10) == 0)
- {
- if(Srt_PlayerHaveCar[playerid][Srt_PlayerKey[playerid]])
- {
- new Status = Srt_Carlock[PlayerCar[playerid][Srt_PlayerKey[playerid]][CarId]];
- switch (Status)
- {
- case 0:
- {
- GameTextForPlayer(playerid, "~w~Vehicle ~r~closed", 5000, 6);
- PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
- Srt_Carlock[PlayerCar[playerid][Srt_PlayerKey[playerid]][CarId]] = 1;
- Srt_LockCar(PlayerCar[playerid][Srt_PlayerKey[playerid]][CarId]);
- }
- case 1:
- {
- GameTextForPlayer(playerid, "~w~Vehicle ~g~open", 5000, 6);
- PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
- Srt_Carlock[PlayerCar[playerid][Srt_PlayerKey[playerid]][CarId]] = 0;
- Srt_UnLockCar(PlayerCar[playerid][Srt_PlayerKey[playerid]][CarId]);
- }
- }
- }
- else
- {
- SendClientMessage(playerid, COLOR_GREY, " You are not in your vehicle or you don't have the right keys!");
- return 1;
- }
- return 1;
- }
- if (strcmp("/carkeylock", cmdtext, true, 10) == 0)
- {
- if(Srt_ParkRights[playerid] != 0)
- {
- new Status = Srt_Carlock[Srt_ParkRights[playerid]];
- switch (Status)
- {
- case 0:
- {
- GameTextForPlayer(playerid, "~w~Vehicle ~r~closed", 5000, 6);
- PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
- Srt_Carlock[Srt_ParkRights[playerid]] = 1;
- Srt_LockCar(Srt_ParkRights[playerid]);
- }
- case 1:
- {
- GameTextForPlayer(playerid, "~w~Vehicle ~g~open", 5000, 6);
- PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
- Srt_Carlock[Srt_ParkRights[playerid]] = 0;
- Srt_UnLockCar(Srt_ParkRights[playerid]);
- }
- }
- }
- else
- {
- SendClientMessage(playerid, COLOR_GREY, " You don't have the right key to use this command!");
- return 1;
- }
- return 1;
- }
- if (strcmp("/carkey", cmdtext, true, 10) == 0)
- {
- new mv = MaxVeh;
- if(mv > 1)
- {
- Srt_PlayerKey[playerid] += 1;
- if(Srt_PlayerKey[playerid] == MaxVeh)
- {
- Srt_PlayerKey[playerid] = 0;
- }
- if(Srt_PlayerHaveCar[playerid][Srt_PlayerKey[playerid]])
- {
- format(string, sizeof(string), "You change your %dth key , to vehicle %s!",Srt_PlayerKey[playerid]+1,CarName[PlayerCar[playerid][Srt_PlayerKey[playerid]][CarModel]-400]);
- }
- else
- {
- format(string, sizeof(string), "You have now key %dth",Srt_PlayerKey[playerid]+1);
- }
- SendClientMessage(playerid,COLOR_YELLOW,string);
- }
- return 1;
- }
- if (strcmp("/parkrights", cmd, true, 10) == 0)
- {
- if(Srt_PlayerHaveCar[playerid][Srt_PlayerKey[playerid]])
- {
- tmp = strtok(cmdtext, idx);
- if(!strlen(tmp))
- {
- SendClientMessage(playerid, COLOR_GREY, "USAGE: /giveparkrights [playerid]");
- return 1;
- }
- new Srt_giveplayerid = ReturnUser(tmp);
- if(IsPlayerConnected(Srt_giveplayerid))
- {
- if(Srt_giveplayerid != INVALID_PLAYER_ID)
- {
- new Srt_giveplayer[MAX_PLAYER_NAME];
- new Srt_sendername[MAX_PLAYER_NAME];
- GetPlayerName(Srt_giveplayerid, Srt_giveplayer, sizeof(Srt_giveplayer));
- GetPlayerName(playerid, Srt_sendername, sizeof(Srt_sendername));
- Srt_ParkRights[Srt_giveplayerid] = PlayerCar[playerid][Srt_PlayerKey[playerid]][CarId];
- format(string, sizeof(string), "You gived to %s vehicle park rights!",Srt_giveplayer);
- SendClientMessage(playerid,COLOR_YELLOW,string);
- format(string, sizeof(string), "%s give you to vehicle park rights!",Srt_sendername);
- SendClientMessage(Srt_giveplayerid,COLOR_YELLOW,string);
- }
- }
- else
- {
- SendClientMessage(playerid, COLOR_GREY, " The player is offline");
- return 1;
- }
- }
- else
- {
- SendClientMessage(playerid, COLOR_GREY, " You don't have the right key to use this command!");
- return 1;
- }
- return 1;
- }
- if (strcmp("/givecarkey", cmd, true, 10) == 0)
- {
- if(Srt_PlayerHaveCar[playerid][Srt_PlayerKey[playerid]])
- {
- tmp = strtok(cmdtext, idx);
- if(!strlen(tmp))
- {
- SendClientMessage(playerid, COLOR_GREY, "USAGE: /givecarkey [playerid]");
- return 1;
- }
- new Srt_giveplayerid = ReturnUser(tmp);
- if(IsPlayerConnected(Srt_giveplayerid))
- {
- if(Srt_giveplayerid != INVALID_PLAYER_ID)
- {
- new Srt_giveplayer[MAX_PLAYER_NAME];
- new Srt_sendername[MAX_PLAYER_NAME];
- GetPlayerName(Srt_giveplayerid, Srt_giveplayer, sizeof(Srt_giveplayer));
- GetPlayerName(playerid, Srt_sendername, sizeof(Srt_sendername));
- Srt_CarKey[Srt_giveplayerid] = PlayerCar[playerid][Srt_PlayerKey[playerid]][CarId];
- format(string, sizeof(string), "You gived to %s your vehicle key!",Srt_giveplayer);
- SendClientMessage(playerid,COLOR_YELLOW,string);
- format(string, sizeof(string), "%s gived you a vehicle key",Srt_sendername);
- SendClientMessage(Srt_giveplayerid,COLOR_YELLOW,string);
- }
- }
- else
- {
- SendClientMessage(playerid, COLOR_GREY, " The player is offline");
- return 1;
- }
- }
- else
- {
- SendClientMessage(playerid, COLOR_GREY, " You don't have the right key to use this command!");
- return 1;
- }
- return 1;
- }
- return 0;
- }
- public OnVehicleSpawn(vehicleid)
- {
- for(new playerid = 0; playerid < MAX_PLAYERS; playerid++)
- {
- for(new x = 0; x < MaxVeh; x++)
- {
- if(IsPlayerConnected(playerid) && Srt_PlayerHaveCar[playerid][x])
- {
- if (vehicleid == PlayerCar[playerid][x][CarId])
- {
- SetTimerEx("CarTuning",700,0,"ii",playerid,x);
- }
- }
- }
- }
- }
- public OnVehicleDeath(vehicleid,killerid)
- {
- for(new playerid = 0; playerid < MAX_PLAYERS; playerid++)
- {
- for(new x = 0; x < MaxVeh; x++)
- {
- if(IsPlayerConnected(playerid) && Srt_PlayerHaveCar[playerid][x])
- {
- if (vehicleid == PlayerCar[playerid][x][CarId])
- {
- DestroyVehicle(PlayerCar[playerid][x][CarId]);
- PlayerCarSpawn(playerid,x);
- }
- }
- }
- }
- }
- public LetDoorsLocked()
- {
- for(new playerid = 0; playerid < MAX_PLAYERS; playerid++)
- {
- if(IsPlayerConnected(playerid))
- {
- for(new i = 0; i < 700; i++)
- {
- if(Srt_Carlock[i])
- {
- SetVehicleParamsForPlayer(i,playerid,0,1);
- }
- }
- }
- }
- }
- public CarTuning(playerid,slot)
- {
- ChangeVehicleColor(PlayerCar[playerid][slot][CarId],PlayerCar[playerid][slot][CarC1],PlayerCar[playerid][slot][CarC2]);
- if(PlayerCar[playerid][slot][CarPJ] >= 0) {ChangeVehiclePaintjob(PlayerCar[playerid][slot][CarId],PlayerCar[playerid][slot][CarPJ]);}
- if(PlayerCar[playerid][slot][CarNitro] != 0) {AddVehicleComponent(PlayerCar[playerid][slot][CarId],PlayerCar[playerid][slot][CarNitro]);}
- if(PlayerCar[playerid][slot][CarHyd] != 0) {AddVehicleComponent(PlayerCar[playerid][slot][CarId],PlayerCar[playerid][slot][CarHyd]);}
- if(PlayerCar[playerid][slot][CarWheel] != 0) {AddVehicleComponent(PlayerCar[playerid][slot][CarId],PlayerCar[playerid][slot][CarWheel]);}
- if(PlayerCar[playerid][slot][CarAusp] != 0) {AddVehicleComponent(PlayerCar[playerid][slot][CarId],PlayerCar[playerid][slot][CarAusp]);}
- if(PlayerCar[playerid][slot][CarSideL] != 0) {AddVehicleComponent(PlayerCar[playerid][slot][CarId],PlayerCar[playerid][slot][CarSideL]);}
- if(PlayerCar[playerid][slot][CarSideR] != 0) {AddVehicleComponent(PlayerCar[playerid][slot][CarId],PlayerCar[playerid][slot][CarSideR]);}
- if(PlayerCar[playerid][slot][CarFB] != 0) {AddVehicleComponent(PlayerCar[playerid][slot][CarId],PlayerCar[playerid][slot][CarFB]);}
- if(PlayerCar[playerid][slot][CarRB] != 0) {AddVehicleComponent(PlayerCar[playerid][slot][CarId],PlayerCar[playerid][slot][CarRB]);}
- if(PlayerCar[playerid][slot][CarSpoiler] != 0) {AddVehicleComponent(PlayerCar[playerid][slot][CarId],PlayerCar[playerid][slot][CarSpoiler]);}
- if(PlayerCar[playerid][slot][CarRoof] != 0) {AddVehicleComponent(PlayerCar[playerid][slot][CarId],PlayerCar[playerid][slot][CarRoof]);}
- if(PlayerCar[playerid][slot][CarHood] != 0) {AddVehicleComponent(PlayerCar[playerid][slot][CarId],PlayerCar[playerid][slot][CarHood]);}
- if(PlayerCar[playerid][slot][CarVents] != 0) {AddVehicleComponent(PlayerCar[playerid][slot][CarId],PlayerCar[playerid][slot][CarVents]);}
- if(PlayerCar[playerid][slot][CarLamps] != 0) {AddVehicleComponent(PlayerCar[playerid][slot][CarId],PlayerCar[playerid][slot][CarLamps]);}
- if(Srt_LockOnSpawn)
- {
- Srt_Carlock[PlayerCar[playerid][slot][CarId]] = 1;
- Srt_LockCar(PlayerCar[playerid][slot][CarId]);
- }
- }
- public OnVehiclePaintjob(playerid,vehicleid,paintjobid)
- {
- for(new x = 0; x < MaxVeh; x++)
- {
- if (vehicleid == PlayerCar[playerid][x][CarId] && Srt_PlayerHaveCar[playerid][x])
- {
- PlayerCar[playerid][x][CarPJ] = paintjobid;
- PlayerCar[playerid][x][CarC1] = 1;
- PlayerCar[playerid][x][CarC2] = 1;
- }
- }
- return 1;
- }
- public OnVehicleRespray(playerid,vehicleid,color1,color2)
- {
- for(new x = 0; x < MaxVeh; x++)
- {
- if (vehicleid == PlayerCar[playerid][x][CarId] && Srt_PlayerHaveCar[playerid][x])
- {
- PlayerCar[playerid][x][CarC1] = color1;
- PlayerCar[playerid][x][CarC2] = color2;
- }
- }
- return 1;
- }
- public OnVehicleMod(playerid,vehicleid,componentid)
- {
- for(new x = 0; x < MaxVeh; x++)
- {
- if (vehicleid == PlayerCar[playerid][x][CarId] && Srt_PlayerHaveCar[playerid][x])
- {
- if((componentid >= 1008) && (componentid <= 1010)) {PlayerCar[playerid][x][CarNitro] = componentid;}
- if((componentid >= 1142) && (componentid <= 1145)) {PlayerCar[playerid][x][CarVents] = componentid;}
- if((componentid == 1013) || (componentid == 1024)) {PlayerCar[playerid][x][CarLamps] = componentid;}
- if((componentid >= 1004) && (componentid <= 1005)||(componentid >= 1011) && (componentid <= 1012)) {PlayerCar[playerid][x][CarHood] = componentid;}
- if(componentid == 1087) {PlayerCar[playerid][x][CarHyd] = componentid;}
- if(componentid == 1086) {PlayerCar[playerid][x][CarHyd] = componentid;}
- if(IsAWheel(componentid)) {PlayerCar[playerid][x][CarWheel] = componentid;}
- if(IsAExhaust(componentid)) {PlayerCar[playerid][x][CarAusp] = componentid;}
- if(IsASideL(componentid)) {PlayerCar[playerid][x][CarSideL] = componentid; PlayerCar[playerid][x][CarSideR] = SideR;}
- if(IsASideR(componentid)) {PlayerCar[playerid][x][CarSideR] = componentid; PlayerCar[playerid][x][CarSideL] = SideL;}
- if(IsAFB(componentid)) {PlayerCar[playerid][x][CarFB] = componentid;}
- if(IsARB(componentid)) {PlayerCar[playerid][x][CarRB] = componentid;}
- if(IsASpoiler(componentid)) {PlayerCar[playerid][x][CarSpoiler] = componentid;}
- if(IsARoof(componentid)) {PlayerCar[playerid][x][CarRoof] = componentid;}
- }
- }
- return 1;
- }
- public OnPlayerPickUpPickup(playerid, pickupid)
- {
- if(!Srt_LiveView)
- {
- if(PlayerToPoint(1.5, playerid, SrtOthers[1][0],SrtOthers[1][1],SrtOthers[1][2]) && !Srt_PlayerHaveCar[playerid][Srt_PlayerKey[playerid]] || pickupid == Srt_Info && !Srt_PlayerHaveCar[playerid][Srt_PlayerKey[playerid]])
- {
- TogglePlayerControllable(playerid, 0);
- ShowMenuForPlayer(Srt_HauptMenu, playerid);
- }
- else if(PlayerToPoint(1.5, playerid, SrtOthers[1][0],SrtOthers[1][1],SrtOthers[1][2]) && Srt_PlayerHaveCar[playerid][Srt_PlayerKey[playerid]] || pickupid == Srt_Info && Srt_PlayerHaveCar[playerid][Srt_PlayerKey[playerid]])
- {
- new mv = MaxVeh;
- if(mv > 1)
- {
- SendClientMessage(playerid, COLOR_GREY, " You have now your car key!");
- SendClientMessage(playerid, COLOR_GREY, " Sell your car with /carsell or change to your vehicle key!");
- }
- else
- {
- SendClientMessage(playerid, COLOR_GREY, " You already own a Owner Car! Sell it with /carsell");
- }
- }
- }
- if(Srt_LiveView)
- {
- if(PlayerToPoint(1.5, playerid, SrtOthers[1][0],SrtOthers[1][1],SrtOthers[1][2]) && !Srt_PlayerHaveCar[playerid][Srt_PlayerKey[playerid]] || pickupid == Srt_Info && !Srt_PlayerHaveCar[playerid][Srt_PlayerKey[playerid]])
- {
- TogglePlayerControllable(playerid, 0);
- SetPlayerVirtualWorld(playerid,55+playerid);
- new string[246];
- Srt_CarownerCar[playerid] = 0;
- Srt_CarownerCat[playerid] = 1;
- new c1 = random(120);
- new c2 = random(120);
- new car = RadVehicle[0][0];
- new Price = RadVehicle[0][1];
- SetPlayerCameraPos(playerid, SrtOthers[4][0], SrtOthers[4][1], SrtOthers[4][2]+2);
- SetPlayerCameraLookAt(playerid, SrtOthers[3][0], SrtOthers[3][1], SrtOthers[3][2]);
- Srt_CarownerSCar[playerid] = CreateVehicle(car, SrtOthers[3][0], SrtOthers[3][1], SrtOthers[3][2], SrtOthers[3][3],c1,c2,-1);
- SetVehicleVirtualWorld(Srt_CarownerSCar[playerid],55+playerid);
- format(string,sizeof(string),"~r~---------- CAROWNER ----------~n~~g~Categorie: ~w~%s~n~~g~Vehicle: ~w~%s~n~~g~Price: ~w~$%d~n~~n~~b~Auswaehlen mit Hilfe~n~von Numpad 4 und 6~n~und der Entertaste!~n~Abbrechen mit TAB!",CatName[Srt_CarownerCat[playerid]-1],CarName[car-400],Price);
- if(!CarKauf[playerid])
- {
- CarKauf[playerid] = TextDrawCreate(200,310,string);
- TextDrawAlignment(CarKauf[playerid],1);
- TextDrawUseBox(CarKauf[playerid],1);
- TextDrawBoxColor(CarKauf[playerid],0x000000FF);
- TextDrawSetOutline(CarKauf[playerid],1);
- TextDrawBackgroundColor(CarKauf[playerid],COLOR_GREY);
- TextDrawFont(CarKauf[playerid], 2);
- TextDrawSetProportional(CarKauf[playerid], 2);
- TextDrawTextSize(CarKauf[playerid],450,410);
- TextDrawShowForPlayer(playerid,CarKauf[playerid]);
- }
- else
- {
- TextDrawHideForPlayer(playerid,CarKauf[playerid]);
- TextDrawSetString(CarKauf[playerid],string);
- TextDrawShowForPlayer(playerid,CarKauf[playerid]);
- }
- }
- else if(PlayerToPoint(1.5, playerid, SrtOthers[1][0],SrtOthers[1][1],SrtOthers[1][2]) && Srt_PlayerHaveCar[playerid][Srt_PlayerKey[playerid]] || pickupid == Srt_Info && Srt_PlayerHaveCar[playerid][Srt_PlayerKey[playerid]])
- {
- new mv = MaxVeh;
- if(mv > 1)
- {
- SendClientMessage(playerid, COLOR_GREY, " You have now your car key!");
- SendClientMessage(playerid, COLOR_GREY, " Sell your car with /carsell or change to your vehicle key!");
- }
- else
- {
- SendClientMessage(playerid, COLOR_GREY, " You already own a Owner Car! Sell it with /carsell");
- }
- }
- }
- return 1;
- }
- public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
- {
- if(Srt_CarownerCat[playerid] != 0 && Srt_LiveView)
- {
- if(newkeys == KEY_ANALOG_RIGHT || newkeys == KEY_LOOK_RIGHT) //right (6 Numpad/e)
- {
- new carid = Srt_CarownerCar[playerid] +1;
- new car,Price;
- if(Srt_CarownerCat[playerid] == 1)
- {
- if(carid >= sizeof(RadVehicle))
- {
- carid = 0;
- Srt_CarownerCat[playerid] =2;
- }
- }
- else if(Srt_CarownerCat[playerid] == 2)
- {
- if(carid >= sizeof(CheapVehicle))
- {
- carid = 0;
- Srt_CarownerCat[playerid] =3;
- }
- }
- else if(Srt_CarownerCat[playerid] == 3)
- {
- if(carid >= sizeof(NormVehicle))
- {
- carid = 0;
- Srt_CarownerCat[playerid] =4;
- }
- }
- else if(Srt_CarownerCat[playerid] == 4)
- {
- if(carid >= sizeof(FastVehicle))
- {
- carid = 0;
- if(Srt_OtherVehicle){Srt_CarownerCat[playerid] =5;} else {Srt_CarownerCat[playerid] =1;}
- }
- }
- else if(Srt_CarownerCat[playerid] == 5 && Srt_OtherVehicle)
- {
- if(carid >= sizeof(OtherVehicle))
- {
- carid = 0;
- Srt_CarownerCat[playerid] =1;
- }
- }
- if(Srt_CarownerCat[playerid] == 1){car = RadVehicle[carid][0]; Price = RadVehicle[carid][1];}
- if(Srt_CarownerCat[playerid] == 2){car = CheapVehicle[carid][0]; Price = CheapVehicle[carid][1];}
- if(Srt_CarownerCat[playerid] == 3){car = NormVehicle[carid][0]; Price = NormVehicle[carid][1];}
- if(Srt_CarownerCat[playerid] == 4){car = FastVehicle[carid][0]; Price = FastVehicle[carid][1];}
- if(Srt_CarownerCat[playerid] == 5){car = OtherVehicle[carid][0]; Price = OtherVehicle[carid][1];}
- Srt_CarownerCar[playerid] = carid;
- new c1 = random(120);
- new c2 = random(120);
- DestroyVehicle(Srt_CarownerSCar[playerid]);
- Srt_CarownerSCar[playerid] = CreateVehicle(car, SrtOthers[3][0], SrtOthers[3][1], SrtOthers[3][2], SrtOthers[3][3],c1,c2,-1);
- SetVehicleVirtualWorld(Srt_CarownerSCar[playerid],55+playerid);
- new string[246];
- format(string,sizeof(string),"~r~---------- CAROWNER ----------~n~~g~Categorie: ~w~%s~n~~g~Vehicle: ~w~%s~n~~g~Price: ~w~$%d~n~~n~~b~Auswaehlen mit Hilfe~n~von Numpad 4 und 6~n~und der Entertaste!~n~Abbrechen mit TAB!",CatName[Srt_CarownerCat[playerid]-1],CarName[car-400],Price);
- TextDrawHideForPlayer(playerid,CarKauf[playerid]);
- TextDrawSetString(CarKauf[playerid],string);
- TextDrawShowForPlayer(playerid,CarKauf[playerid]);
- }
- if(newkeys == KEY_ANALOG_LEFT || newkeys == KEY_LOOK_LEFT) //left (4 Numpad/q)
- {
- new carid = Srt_CarownerCar[playerid] -1;
- new car,Price;
- if(Srt_CarownerCat[playerid] == 1)
- {
- if(carid < 0)
- {
- if(Srt_OtherVehicle){carid = sizeof(OtherVehicle)-1;} else {carid = sizeof(FastVehicle)-1;}
- if(Srt_OtherVehicle){Srt_CarownerCat[playerid] =5;} else {Srt_CarownerCat[playerid] =4;}
- }
- }
- else if(Srt_CarownerCat[playerid] == 2)
- {
- if(carid < 0)
- {
- carid = sizeof(RadVehicle)-1;
- Srt_CarownerCat[playerid] =1;
- }
- }
- else if(Srt_CarownerCat[playerid] == 3)
- {
- if(carid < 0)
- {
- carid = sizeof(CheapVehicle)-1;
- Srt_CarownerCat[playerid] =2;
- }
- }
- else if(Srt_CarownerCat[playerid] == 4)
- {
- if(carid < 0)
- {
- carid = sizeof(NormVehicle)-1;
- Srt_CarownerCat[playerid] =3;
- }
- }
- else if(Srt_CarownerCat[playerid] == 5 && Srt_OtherVehicle)
- {
- if(carid < 0)
- {
- carid = sizeof(FastVehicle)-1;
- Srt_CarownerCat[playerid] =4;
- }
- }
- if(Srt_CarownerCat[playerid] == 1){car = RadVehicle[carid][0]; Price = RadVehicle[carid][1];}
- if(Srt_CarownerCat[playerid] == 2){car = CheapVehicle[carid][0]; Price = CheapVehicle[carid][1];}
- if(Srt_CarownerCat[playerid] == 3){car = NormVehicle[carid][0]; Price = NormVehicle[carid][1];}
- if(Srt_CarownerCat[playerid] == 4){car = FastVehicle[carid][0]; Price = FastVehicle[carid][1];}
- if(Srt_CarownerCat[playerid] == 5){car = OtherVehicle[carid][0]; Price = OtherVehicle[carid][1];}
- Srt_CarownerCar[playerid] = carid;
- new c1 = random(120);
- new c2 = random(120);
- DestroyVehicle(Srt_CarownerSCar[playerid]);
- Srt_CarownerSCar[playerid] = CreateVehicle(car, SrtOthers[3][0], SrtOthers[3][1], SrtOthers[3][2], SrtOthers[3][3],c1,c2,-1);
- SetVehicleVirtualWorld(Srt_CarownerSCar[playerid],55+playerid);
- new string[246];
- format(string,sizeof(string),"~r~---------- CAROWNER ----------~n~~g~Categorie: ~w~%s~n~~g~Vehicle: ~w~%s~n~~g~Price: ~w~$%d~n~~n~~b~Auswaehlen mit Hilfe~n~von Numpad 4 und 6~n~und der Entertaste!~n~Abbrechen mit TAB!",CatName[Srt_CarownerCat[playerid]-1],CarName[car-400],Price);
- TextDrawHideForPlayer(playerid,CarKauf[playerid]);
- TextDrawSetString(CarKauf[playerid],string);
- TextDrawShowForPlayer(playerid,CarKauf[playerid]);
- }
- if(newkeys == 16)//Enter
- {
- //"Bikes", "Cheap Vehicles", "Normal Vehicles", "Fast Vehicle", "Other Vehicles"
- switch(Srt_CarownerCat[playerid])
- {
- case 1:
- {
- if(GetPlayerMoney(playerid) < RadVehicle[Srt_CarownerCar[playerid]][1])
- {
- new string[128];
- format(string, sizeof(string), " You don't have $%d !", RadVehicle[Srt_CarownerCar[playerid]][1]);
- SendClientMessage(playerid, COLOR_GREY, string);
- return 0;
- }
- OnPlayerBuyCar(playerid,RadVehicle[Srt_CarownerCar[playerid]][0],RadVehicle[Srt_CarownerCar[playerid]][1]);
- }
- case 2:
- {
- if(GetPlayerMoney(playerid) < CheapVehicle[Srt_CarownerCar[playerid]][1])
- {
- new string[128];
- format(string, sizeof(string), " You don't have $%d !", CheapVehicle[Srt_CarownerCar[playerid]][1]);
- SendClientMessage(playerid, COLOR_GREY, string);
- return 0;
- }
- OnPlayerBuyCar(playerid,CheapVehicle[Srt_CarownerCar[playerid]][0],CheapVehicle[Srt_CarownerCar[playerid]][1]);
- }
- case 3:
- {
- if(GetPlayerMoney(playerid) < NormVehicle[Srt_CarownerCar[playerid]][1])
- {
- new string[128];
- format(string, sizeof(string), " You don't have $%d !", NormVehicle[Srt_CarownerCar[playerid]][1]);
- SendClientMessage(playerid, COLOR_GREY, string);
- return 0;
- }
- OnPlayerBuyCar(playerid,NormVehicle[Srt_CarownerCar[playerid]][0],NormVehicle[Srt_CarownerCar[playerid]][1]);
- }
- case 4:
- {
- if(GetPlayerMoney(playerid) < FastVehicle[Srt_CarownerCar[playerid]][1])
- {
- new string[128];
- format(string, sizeof(string), " You don't have $%d !", FastVehicle[Srt_CarownerCar[playerid]][1]);
- SendClientMessage(playerid, COLOR_GREY, string);
- return 0;
- }
- OnPlayerBuyCar(playerid,FastVehicle[Srt_CarownerCar[playerid]][0],FastVehicle[Srt_CarownerCar[playerid]][1]);
- }
- case 5:
- {
- if(GetPlayerMoney(playerid) < OtherVehicle[Srt_CarownerCar[playerid]][1])
- {
- new string[128];
- format(string, sizeof(string), " You don't have $%d !", OtherVehicle[Srt_CarownerCar[playerid]][1]);
- SendClientMessage(playerid, COLOR_GREY, string);
- return 0;
- }
- OnPlayerBuyCar(playerid,OtherVehicle[Srt_CarownerCar[playerid]][0],OtherVehicle[Srt_CarownerCar[playerid]][1]);
- }
- }
- //ResetPlayer
- SetCameraBehindPlayer(playerid);
- DestroyVehicle(Srt_CarownerSCar[playerid]);
- Srt_CarownerCar[playerid] = 0;
- Srt_CarownerCat[playerid] = 0;
- SetPlayerVirtualWorld(playerid,0);
- TextDrawHideForPlayer(playerid,CarKauf[playerid]);
- TogglePlayerControllable(playerid,1);
- }
- if(newkeys == KEY_ACTION) //Tab
- {
- //ResetPlayer
- SetCameraBehindPlayer(playerid);
- DestroyVehicle(Srt_CarownerSCar[playerid]);
- Srt_CarownerCar[playerid] = 0;
- Srt_CarownerCat[playerid] = 0;
- SetPlayerVirtualWorld(playerid,0);
- TextDrawHideForPlayer(playerid,CarKauf[playerid]);
- TogglePlayerControllable(playerid,1);
- }
- }
- return 1;
- }
- public PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z)
- {
- if(IsPlayerConnected(playerid))
- {
- new Float:oldposx, Float:oldposy, Float:oldposz;
- new Float:tempposx, Float:tempposy, Float:tempposz;
- GetPlayerPos(playerid, oldposx, oldposy, oldposz);
- tempposx = (oldposx -x);
- tempposy = (oldposy -y);
- tempposz = (oldposz -z);
- //printf("DEBUG: X:%f Y:%f Z:%f",posx,posy,posz);
- if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
- {
- return 1;
- }
- }
- return 0;
- }
- public OnPlayerSelectedMenuRow(playerid, row)
- {
- new Menu:CurrentMenu = GetPlayerMenu(playerid);
- if(CurrentMenu == Srt_HauptMenu && Srt_OtherVehicle)
- {
- switch(row)
- {
- case 0: // Fast
- {
- HideMenuForPlayer(Srt_HauptMenu,playerid);
- ShowMenuForPlayer(Srt_FastMenu,playerid);
- }
- case 1: // Normal
- {
- HideMenuForPlayer(Srt_HauptMenu,playerid);
- ShowMenuForPlayer(Srt_NormMenu,playerid);
- }
- case 2: // Cheap
- {
- HideMenuForPlayer(Srt_HauptMenu,playerid);
- ShowMenuForPlayer(Srt_CheapMenu,playerid);
- }
- case 3: // 2R?der
- {
- HideMenuForPlayer(Srt_HauptMenu,playerid);
- ShowMenuForPlayer(Srt_2RadMenu,playerid);
- }
- case 4: // Others
- {
- HideMenuForPlayer(Srt_HauptMenu,playerid);
- ShowMenuForPlayer(Srt_OtherMenu,playerid);
- }
- case 5: // Exit
- {
- TogglePlayerControllable(playerid, 0);
- HideMenuForPlayer(Srt_HauptMenu,playerid);
- }
- }
- }
- if(CurrentMenu == Srt_HauptMenu && !Srt_OtherVehicle)
- {
- switch(row)
- {
- case 0: // Fast
- {
- HideMenuForPlayer(Srt_HauptMenu,playerid);
- ShowMenuForPlayer(Srt_FastMenu,playerid);
- }
- case 1: // Normale
- {
- HideMenuForPlayer(Srt_HauptMenu,playerid);
- ShowMenuForPlayer(Srt_NormMenu,playerid);
- }
- case 2: // Cheap
- {
- HideMenuForPlayer(Srt_HauptMenu,playerid);
- ShowMenuForPlayer(Srt_CheapMenu,playerid);
- }
- case 3: // 2R?der
- {
- HideMenuForPlayer(Srt_HauptMenu,playerid);
- ShowMenuForPlayer(Srt_2RadMenu,playerid);
- }
- case 4: // Others
- {
- HideMenuForPlayer(Srt_HauptMenu,playerid);
- ShowMenuForPlayer(Srt_OtherMenu,playerid);
- }
- case 5: // Exit
- {
- TogglePlayerControllable(playerid, 0);
- HideMenuForPlayer(Srt_HauptMenu,playerid);
- }
- }
- }
- if(CurrentMenu == Srt_2RadMenu) // 2Rad Menu
- {
- HideMenuForPlayer(Srt_2RadMenu,playerid);
- TogglePlayerControllable(playerid, 1);
- if(GetPlayerMoney(playerid) < RadVehicle[row][1])
- {
- new string[128];
- format(string, sizeof(string), " You don't have $%d !", RadVehicle[row][1]);
- SendClientMessage(playerid, COLOR_GREY, string);
- return 1;
- }
- OnPlayerBuyCar(playerid,RadVehicle[row][0],RadVehicle[row][1]);
- }
- if(CurrentMenu == Srt_OtherMenu) // Other Menu
- {
- HideMenuForPlayer(Srt_OtherMenu,playerid);
- TogglePlayerControllable(playerid, 1);
- if(GetPlayerMoney(playerid) < OtherVehicle[row][1])
- {
- new string[128];
- format(string, sizeof(string), " You don't have $%d !", OtherVehicle[row][1]);
- SendClientMessage(playerid, COLOR_GREY, string);
- return 1;
- }
- OnPlayerBuyCar(playerid,OtherVehicle[row][0],OtherVehicle[row][1]);
- }
- if(CurrentMenu == Srt_CheapMenu) // Cheap Menu
- {
- HideMenuForPlayer(Srt_CheapMenu,playerid);
- TogglePlayerControllable(playerid, 1);
- if(GetPlayerMoney(playerid) < CheapVehicle[row][1])
- {
- new string[128];
- format(string, sizeof(string), " You don't have $%d !", CheapVehicle[row][1]);
- SendClientMessage(playerid, COLOR_GREY, string);
- return 1;
- }
- OnPlayerBuyCar(playerid,CheapVehicle[row][0],CheapVehicle[row][1]);
- }
- if(CurrentMenu == Srt_NormMenu) // Norm Menu
- {
- HideMenuForPlayer(Srt_NormMenu,playerid);
- TogglePlayerControllable(playerid, 1);
- if(GetPlayerMoney(playerid) < NormVehicle[row][1])
- {
- new string[128];
- format(string, sizeof(string), " You don't have $%d !", NormVehicle[row][1]);
- SendClientMessage(playerid, COLOR_GREY, string);
- return 1;
- }
- OnPlayerBuyCar(playerid,NormVehicle[row][0],NormVehicle[row][1]);
- }
- if(CurrentMenu == Srt_FastMenu) // Fast Menu
- {
- HideMenuForPlayer(Srt_FastMenu,playerid);
- TogglePlayerControllable(playerid, 1);
- if(GetPlayerMoney(playerid) < FastVehicle[row][1])
- {
- new string[128];
- format(string, sizeof(string), " You don't have $%d !", FastVehicle[row][1]);
- SendClientMessage(playerid, COLOR_GREY, string);
- return 1;
- }
- OnPlayerBuyCar(playerid,FastVehicle[row][0],FastVehicle[row][1]);
- }
- return 1;
- }
- public OnPlayerExitedMenu(playerid)
- {
- TogglePlayerControllable(playerid, 1);
- return 1;
- }
- public IsASideR(componentid)
- {
- if(componentid == 1007)
- {
- SideL = 1017;
- return 1;
- }
- if(componentid == 1026)
- {
- SideL = 1027;
- return 1;
- }
- if(componentid == 1030)
- {
- SideL = 1031;
- return 1;
- }
- if(componentid == 1040)
- {
- SideL = 1036;
- return 1;
- }
- if(componentid == 1041)
- {
- SideL = 1039;
- return 1;
- }
- if(componentid == 1042)
- {
- SideL = 1099;
- return 1;
- }
- if(componentid == 1051)
- {
- SideL = 1047;
- return 1;
- }
- if(componentid == 1048)
- {
- SideL = 1052;
- return 1;
- }
- if(componentid == 1056)
- {
- SideL = 1062;
- return 1;
- }
- if(componentid == 1063)
- {
- SideL = 1057;
- return 1;
- }
- if(componentid == 1069)
- {
- SideL = 1071;
- return 1;
- }
- if(componentid == 1072)
- {
- SideL = 1070;
- return 1;
- }
- if(componentid == 1094)
- {
- SideL = 1090;
- return 1;
- }
- if(componentid == 1093)
- {
- SideL = 1095;
- return 1;
- }
- if(componentid == 1122)
- {
- SideL = 1101;
- return 1;
- }
- if(componentid == 1102)
- {
- SideL = 1133;
- return 1;
- }
- if(componentid == 1124)
- {
- SideL = 1106;
- return 1;
- }
- if(componentid == 1107)
- {
- SideL = 1108;
- return 1;
- }
- if(componentid == 1118)
- {
- SideL = 1120;
- return 1;
- }
- if(componentid == 1137)
- {
- SideL = 1134;
- return 1;
- }
- return 0;
- }
- public IsASideL(componentid)
- {
- if(componentid == 1134)
- {
- SideR = 1137;
- return 1;
- }
- if(componentid == 1119)
- {
- SideR = 1121;
- return 1;
- }
- if(componentid == 1120)
- {
- SideR = 1118;
- return 1;
- }
- if(componentid == 1108)
- {
- SideR = 1107;
- return 1;
- }
- if(componentid == 1017)
- {
- SideR = 1007;
- return 1;
- }
- if(componentid == 1027)
- {
- SideR = 1026;
- return 1;
- }
- if(componentid == 1031)
- {
- SideR = 1030;
- return 1;
- }
- if(componentid == 1036)
- {
- SideR = 1040;
- return 1;
- }
- if(componentid == 1039)
- {
- SideR = 1041;
- return 1;
- }
- if(componentid == 1099)
- {
- SideR = 1042;
- return 1;
- }
- if(componentid == 1047)
- {
- SideR = 1051;
- return 1;
- }
- if(componentid == 1052)
- {
- SideR = 1048;
- return 1;
- }
- if(componentid == 1062)
- {
- SideR = 1056;
- return 1;
- }
- if(componentid == 1057)
- {
- SideR = 1063;
- return 1;
- }
- if(componentid == 1071)
- {
- SideR = 1069;
- return 1;
- }
- if(componentid == 1070)
- {
- SideR = 1072;
- return 1;
- }
- if(componentid == 1090)
- {
- SideR = 1094;
- return 1;
- }
- if(componentid == 1095)
- {
- SideR = 1093;
- return 1;
- }
- if(componentid == 1095)
- {
- SideR = 1093;
- return 1;
- }
- if(componentid == 1101)
- {
- SideR = 1122;
- return 1;
- }
- if(componentid == 1133)
- {
- SideR = 1102;
- return 1;
- }
- if(componentid == 1106)
- {
- SideR = 1124;
- return 1;
- }
- return 0;
- }
- public IsAFB(componentid)
- {
- if(componentid >= 1152 && componentid <= 1153 || componentid >= 1165 && componentid <= 1166)
- {
- return 1;
- }
- if(componentid == 1155 || componentid == 1157 || componentid == 1160 || componentid == 1176 || componentid == 1179 || componentid == 1185)
- {
- return 1;
- }
- if(componentid >= 1169 && componentid <= 1174 || componentid >= 1181 && componentid <= 1182)
- {
- return 1;
- }
- if(componentid >= 1188 && componentid <= 1191)
- {
- return 1;
- }
- return 0;
- }
- public IsARB(componentid)
- {
- if(componentid >= 1140 && componentid <= 1141 || componentid >= 1148 && componentid <= 1151)
- {
- return 1;
- }
- if(componentid == 1154 || componentid == 1156 || componentid == 1159 || componentid == 1161 || componentid == 1175 || componentid == 1180)
- {
- return 1;
- }
- if(componentid >= 1167 && componentid <= 1168 || componentid >= 1177 && componentid <= 1178)
- {
- return 1;
- }
- if(componentid >= 1183 && componentid <= 1184 || componentid >= 1186 && componentid <= 1187)
- {
- return 1;
- }
- if(componentid >= 1192 && componentid <= 1193)
- {
- return 1;
- }
- return 0;
- }
- public IsASpoiler(componentid)
- {
- if(componentid >= 1000 && componentid <= 1003 || componentid >= 1014 && componentid <= 1016)
- {
- return 1;
- }
- if(componentid == 1023 || componentid == 1058 || componentid == 1158)
- {
- return 1;
- }
- if(componentid >= 1049 && componentid <= 1050 || componentid >= 1138 && componentid <= 1139)
- {
- return 1;
- }
- if(componentid >= 1146 && componentid <= 1147 || componentid >= 1162 && componentid <= 1164)
- {
- return 1;
- }
- return 0;
- }
- public IsARoof(componentid)
- {
- if(componentid >= 1032 && componentid <= 1033 || componentid >= 1053 && componentid <= 1055)
- {
- return 1;
- }
- if(componentid == 1035 || componentid == 1038 || componentid == 1061 || componentid == 1088 || componentid == 1091)
- {
- return 1;
- }
- if(componentid == 1103 || componentid == 1128)
- {
- return 1;
- }
- if(componentid >= 1067 && componentid <= 1068 || componentid >= 1130 && componentid <= 1131)
- {
- return 1;
- }
- return 0;
- }
- public IsAExhaust(componentid)
- {
- if(componentid >= 1018 && componentid <= 1022)
- {
- return 1;
- }
- if(componentid >= 1028 && componentid <= 1029)
- {
- return 1;
- }
- if(componentid == 1037 || componentid == 1059 || componentid == 1089 || componentid == 1092 || componentid == 1132)
- {
- return 1;
- }
- if(componentid == 1104 || componentid == 1105 || componentid == 1113 || componentid == 1114 || componentid == 1129)
- {
- return 1;
- }
- if(componentid == 1135 || componentid == 1136)
- {
- return 1;
- }
- if(componentid >= 1043 && componentid <= 1046)
- {
- return 1;
- }
- if(componentid >= 1126 && componentid <= 1127)
- {
- return 1;
- }
- if(componentid >= 1064 && componentid <= 1066)
- {
- return 1;
- }
- return 0;
- }
- public IsAWheel(componentid)
- {
- if(componentid >= 1073 && componentid <= 1085)
- {
- return 1;
- }
- if(componentid >= 1096 && componentid <= 1098)
- {
- return 1;
- }
- if(componentid == 1025)
- {
- return 1;
- }
- return 0;
- }
- stock ini_GetKey( line[] )
- {
- new keyRes[256];
- keyRes[0] = 0;
- if ( strfind( line , "=" , true ) == -1 ) return keyRes;
- strmid( keyRes , line , 0 , strfind( line , "=" , true ) , sizeof( keyRes) );
- return keyRes;
- }
- stock ini_GetValue( line[] )
- {
- new valRes[256];
- valRes[0]=0;
- if ( strfind( line , "=" , true ) == -1 ) return valRes;
- strmid( valRes , line , strfind( line , "=" , true )+1 , strlen( line ) , sizeof( valRes ) );
- return valRes;
- }
- public Srt_LockCar(carid)
- {
- for(new i = 0; i < MAX_PLAYERS; i++)
- {
- if(IsPlayerConnected(i))
- {
- SetVehicleParamsForPlayer(carid,i,0,1);
- }
- }
- }
- public Srt_UnLockCar(carid)
- {
- for(new i = 0; i < MAX_PLAYERS; i++)
- {
- if(IsPlayerConnected(i))
- {
- SetVehicleParamsForPlayer(carid,i,0,0);
- }
- }
- }
- public IsASrtcar(car) //!CallRemoteFunction("IsASrtcar","i",c)
- {
- for(new playerid = 0; playerid < MAX_PLAYERS; playerid++)
- {
- for(new x = 0; x < MaxVeh; x++)
- {
- if(IsPlayerConnected(playerid) && Srt_PlayerHaveCar[playerid][x])
- {
- if (car == PlayerCar[playerid][x][CarId])
- {
- return 1;
- }
- }
- }
- }
- return 0;
- }
- 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;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement