Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define INDICATORS_OFF (0) // Defining INDICATORS_OFF to 0. 0 being the player variable value for off however this is more friendly for us to understand.
- #define INDICATORS_LEFT (1) // Defining INDICATORS_LEFT to 1. 1 being the player variable value for left however this is more friendly for us to understand.
- #define INDICATORS_RIGHT (2) // Defining INDICATORS_RIGHT to 2. 2 being the player variable value for right however this is more friendly for us to understand.
- new gIndicator1[MAX_PLAYERS][MAX_VEHICLES]; // Global object variable which gets assigned to a player id and vehicle id.
- new gIndicator2[MAX_PLAYERS][MAX_VEHICLES]; // Same as above.
- new Float:IndiPos[][] = {
- //Mapped by ChainsBoy aka Lars
- // LandStalker 400
- { -0.974999, 2.025000, -0.075000, -0.899999, -2.250000, -0.075000, 0.974999, 2.025000, -0.075000, 0.974999, -2.250000, -0.075000 },
- // Bravura 401
- { -1.049999, 2.475000, 0.000000, -0.974999, -2.325000, 0.000000, 0.974999, 2.400000, 0.000000, 0.974999, -2.250000, 0.000000 },
- // Buffalo 402
- { -0.899999, 2.400000, -0.075000, -0.899999, -2.475000, 0.000000, 0.824999, -2.550000, -0.000000, 0.824999, 2.550000, -0.075000 },
- // Linerunner 403
- { -1.049999, 4.425000, -0.824999, -0.300000, -4.050001, -0.749999, 0.974999, 4.500000, -0.824999, 0.374999, -3.975001, -0.749999 },
- // Perenail 404
- { -0.7270, 2.1308, -0.0489, -0.8383, -2.7254, 0.0729, 0.7395, 2.1308, -0.0489, 0.8287, -2.7254, 0.0729 },
- // Sentinel 405
- { -0.9022, 2.3059, -0.0527, -0.8636, -2.6895, -0.0367, 0.8987, 2.3059, -0.0527, 0.8437, -2.6895, -0.0367 },
- // Dumper 406
- { -2.2322, 4.9625, -0.0476, -0.6632, -2.7090, -0.5157, 1.8983, 4.9675, -0.0459, 0.6598, -2.7090, -0.5082},
- // Firetruck 407
- { -0.7506, 4.1338, 0.0677, -1.0294, -3.4542, 0.0677, 0.7975, 4.1298, 0.0677, 1.0265, -3.4542, 0.0677},
- // Trashmaster 408
- { -0.9510, 4.8348, -0.1488, -0.8585, -4.0835, -0.4754, 0.9511, 4.8348, -0.1488, 0.8551, -4.0855, -0.4754},
- // Stretch 409
- { -0.8595, 3.5853, 0.0352, -0.9038, -3.8908, -0.0656, 0.8601, 3.5853, 0.0352, 0.9115, -3.8908, -0.0656},
- // Manana 410
- { -0.8052, 2.1498, 0.0397, -0.8408, -2.2167, 0.1030, 0.8051, 2.1498, 0.0397, 0.8413, -2.2167, 0.1030},
- // Infernus 411
- { -0.9298, 2.6942, -0.1782, -0.9247, -2.4527, 0.0607, 0.9309, 2.6942, -0.1985, 0.9044, -2.4547, 0.0607},
- // Voodoo 412
- { -0.6170, 2.7062, -0.0695, -0.9577, -3.5227, -0.1489, 0.6168, 2.7069, -0.0694, 0.9591, -3.5211, -0.1506},
- //Pony 413
- { -0.9280, 2.5719, -0.0993, -0.8872, -2.6251, 0.2943, 0.9294, 2.5719, -0.0993, 0.8985, -2.6251, 0.2943}
- }; // 2 Dimensional array for the object mappings. Goes in this relative order: TOPLEFT, BACKLEFT, TOPRIGHT, BACKRIGHT.
- public OnPlayerDisconnect(playerid, reason)
- {
- DeletePVar(playerid, "IndicatorStatus"); // Removing the variable for that player slot.
- for(new i; i<MAX_VEHICLES; i++) // Looping through the vehicle ids to unassign and destroy the object from that variable.
- {
- DestroyObject(gIndicator1[playerid][i]);
- DestroyObject(gIndicator2[playerid][i]);
- }
- return 1;
- }
- public OnPlayerDeath(playerid, killerid, reason)
- {
- for(new i; i<MAX_VEHICLES; i++) // Looping through the vehicle ids to unassign and destroy the object from that variable.
- {
- DestroyObject(gIndicator1[playerid][i]);
- DestroyObject(gIndicator2[playerid][i]);
- }
- return 1;
- }
- public OnVehicleDeath(vehicleid, killerid)
- {
- for(new i; i<MAX_PLAYERS; i++) // Looping through the player ids to unassign and destroy the object from that variable.
- {
- DestroyObject(gIndicator1[i][vehicleid]);
- DestroyObject(gIndicator2[i][vehicleid]);
- }
- return 1;
- }
- public OnPlayerExitVehicle(playerid, vehicleid)
- {
- DeletePVar(playerid, "IndicatorStatus"); // Removing the player variable from that id.
- DestroyObject(gIndicator1[playerid][vehicleid]);
- DestroyObject(gIndicator2[playerid][vehicleid]);
- return 1;
- }
- public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
- {
- if(IsPlayerInAnyVehicle(playerid))
- {
- new iStatus = GetPVarInt(playerid, "IndicatorStatus"); // Getting the player variable and storing it into a local one.
- new vehid = GetPlayerVehicleID(playerid); // Getting the players vehicle id and storing it into a local variable.
- new model = GetVehicleModel(vehid); // Getting the vehicle model and storing it into the model variable.
- new arraynum = CarModelToArray(model); // Getting the array number of the vehicle.
- if(newkeys & KEY_LOOK_LEFT)
- {
- if(iStatus == INDICATORS_OFF)
- {
- // Turn indicators left...
- SetPVarInt(playerid, "IndicatorStatus", 1); // Setting the variable of indicators left.
- gIndicator1[playerid][vehid] = CreateObject(19294,0,0,-1000,0,0,0,100); // Creating the object and assigning it.
- gIndicator2[playerid][vehid] = CreateObject(19294,0,0,-1000,0,0,0,100); // Creating the object and assigning it.
- AttachObjectToVehicle(gIndicator1[playerid][vehid], GetPlayerVehicleID(playerid), IndiPos[arraynum][0], IndiPos[arraynum][1], IndiPos[arraynum][2], 0.0, 0.0, 0.0); // Attaching it
- AttachObjectToVehicle(gIndicator2[playerid][vehid], GetPlayerVehicleID(playerid), IndiPos[arraynum][3], IndiPos[arraynum][4], IndiPos[arraynum][5], 0.0, 0.0, 0.0); // Attaching it
- }
- else if(iStatus == INDICATORS_RIGHT)
- {
- // Turn indicators off...
- SetPVarInt(playerid, "IndicatorStatus", 0);
- DestroyObject(gIndicator1[playerid][vehid]);
- DestroyObject(gIndicator2[playerid][vehid]);
- }
- }
- else if(newkeys & KEY_LOOK_RIGHT)
- {
- if(iStatus == INDICATORS_OFF)
- {
- // Turn indicators right...
- SetPVarInt(playerid, "IndicatorStatus", 2);
- gIndicator1[playerid][vehid] = CreateObject(19294,0,0,-1000,0,0,0,100);
- gIndicator2[playerid][vehid] = CreateObject(19294,0,0,-1000,0,0,0,100);
- AttachObjectToVehicle(gIndicator1[playerid][vehid], GetPlayerVehicleID(playerid), IndiPos[arraynum][6], IndiPos[arraynum][7], IndiPos[arraynum][8], 0.0, 0.0, 0.0);
- AttachObjectToVehicle(gIndicator2[playerid][vehid], GetPlayerVehicleID(playerid), IndiPos[arraynum][9], IndiPos[arraynum][10], IndiPos[arraynum][11], 0.0, 0.0, 0.0);
- }
- else if(iStatus == INDICATORS_LEFT)
- {
- // Turn indicators off...
- SetPVarInt(playerid, "IndicatorStatus", 0); // Setting the variable to 0.
- DestroyObject(gIndicator1[playerid][vehid]); // Destroying the object
- DestroyObject(gIndicator2[playerid][vehid]); // Destroying the object
- }
- }
- }
- return 1;
- }
- stock CarModelToArray(modelid) // Getting the array number of the vehicle from the modelid.
- {
- new arraynum = modelid - 400; // modelid - 400. 400 being the starting number of the modelid's.
- return arraynum; // Returning the value.
- }
Advertisement
Add Comment
Please, Sign In to add comment