Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define MAX_FACTIONS 10
- new FactionCar[MAX_VEHICLES][MAX_FACTIONS];
- public OnGameModeInit()
- {
- for(new f = 1; f < MAX_FACTIONS; f++)
- {
- new cars[17]; format(cars, sizeof(cars), "/cars/factions/%d", f); // Looping factions
- if(dini_Exists(cars)) // if the faction exists
- {
- new fcar[21];
- for(new c = 1; c < 10; c++) // looping car (max 10 faction cars per faction)
- {
- new vehid;
- format(fcar, sizeof(fcar), "/cars/factions/%d/%d", f, c); // formating values
- FactionCar[vehid][f] = AddStaticVehicleEx(dini_Int(fcar, "Model"), dini_Float(fcar, "SpawnX"), dini_Float(fcar, "SpawnY"), dini_Float(fcar, "SpawnZ"), dini_Float(fcar, "SpawnA"), dini_Int(fcar, "Color1"), dini_Int(fcar, "Color2"), 99999);
- }
- }
- }
- CMD:engine(playerid, input[])
- {
- if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, RED, " You are not in any vehicle!");
- new vehicleid = GetPlayerVehicleID(playerid);
- new engine, lights, alarm, doors, bonnet, boot, objective;
- GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
- new fac;
- if(FactionCar[vehicleid][fac] == Faction[playerid])
- {
- if(!engine)
- {
- SendMeWrap(playerid, "starts the engine of the vehicle");
- SetVehicleParamsEx(vehicleid, 1, 1, alarm, doors, bonnet, boot, objective);
- GameTextForPlayer(playerid, "~g~Engine on!", 3000, 4);
- }
- else
- {
- SendMeWrap(playerid, "shuts off the engine of the vehicle");
- SetVehicleParamsEx(vehicleid, 0, 0, alarm, doors, bonnet, boot, objective);
- GameTextForPlayer(playerid, "~r~Engine off!", 3000, 4);
- }
- return 1;
- }
Add Comment
Please, Sign In to add comment