Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #define DIALOGUE_CLIGNOTANT 1
- new Indicators_xqz[6], ClignotantsID[6], bool:Indicators[2][MAX_VEHICLES];
- public OnPlayerCommandText(playerid, cmdtext[]) {
- if(!strcmp(cmdtext, "/clignotant", true)) ShowPlayerDialog(playerid, DIALOGUE_CLIGNOTANT, DIALOG_STYLE_LIST, "Couleur des clignotants", "Orange\nBlanc\nRouge\nVert\nBleu\nGyrophare", "Valider", "Annuler");
- if(!strcmp(cmdtext, "/t", true)) SetWeather(2);
- return 0;
- }
- public OnPlayerKeyStateChange(playerid,newkeys, oldkeys) {
- if(IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == 2) {
- new vehicleid = GetPlayerVehicleID(playerid);
- switch(newkeys) {
- case KEY_LOOK_LEFT: {
- switch(Indicators[0][vehicleid]) {
- case false: {
- Indicators[0][vehicleid] = true;
- new Float:_vX[2], Float:_vY[2], Float:_vZ[2];
- switch(ClignotantsID[vehicleid]) {
- case 0: {
- Indicators_xqz[2] = CreateObject(19294, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0);
- Indicators_xqz[3] = CreateObject(19294, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0);
- Indicators_xqz[5] = CreateObject(19294, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0);
- }
- case 1: {
- Indicators_xqz[2] = CreateObject(19289, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0);
- Indicators_xqz[3] = CreateObject(19289, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0);
- Indicators_xqz[5] = CreateObject(19289, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0);
- }
- case 2: {
- Indicators_xqz[2] = CreateObject(19290, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0);
- Indicators_xqz[3] = CreateObject(19290, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0);
- Indicators_xqz[5] = CreateObject(19290, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0);
- }
- case 3: {
- Indicators_xqz[2] = CreateObject(19291, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0);
- Indicators_xqz[3] = CreateObject(19291, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0);
- Indicators_xqz[5] = CreateObject(19291, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0);
- }
- case 4: {
- Indicators_xqz[2] = CreateObject(19292, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0);
- Indicators_xqz[3] = CreateObject(19292, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0);
- Indicators_xqz[5] = CreateObject(19292, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0);
- }
- case 5: {
- Indicators_xqz[2] = CreateObject(19293, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0);
- Indicators_xqz[3] = CreateObject(19293, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0);
- Indicators_xqz[5] = CreateObject(19293, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0);
- }
- }
- if(IsTrailerAttachedToVehicle(vehicleid)) {
- new omg = GetVehicleModel(GetVehicleTrailer(vehicleid));
- GetVehicleModelInfo(omg, VEHICLE_MODEL_INFO_SIZE, _vX[0], _vY[0], _vZ[0]);
- AttachObjectToVehicle(Indicators_xqz[5], GetVehicleTrailer(vehicleid), -_vX[0]/2.4, -_vY[0]/3.35, -1.0 ,0,0,0);
- }
- GetVehicleModelInfo(GetVehicleModel(vehicleid), VEHICLE_MODEL_INFO_SIZE, _vX[0], _vY[0], _vZ[0]);
- AttachObjectToVehicle(Indicators_xqz[2], vehicleid, -_vX[0]/2.23, _vY[0]/2.23, 0.1 ,0,0,0);
- AttachObjectToVehicle(Indicators_xqz[3], vehicleid, -_vX[0]/2.23, -_vY[0]/2.23, 0.1 ,0,0,0);
- return 1;
- }
- case 1: {
- Indicators[0][vehicleid] = false;
- DestroyObject(Indicators_xqz[2]);
- DestroyObject(Indicators_xqz[3]);
- DestroyObject(Indicators_xqz[5]);
- return 1;
- }
- }
- }
- case KEY_LOOK_RIGHT: {
- switch(Indicators[1][vehicleid]) {
- case false: {
- Indicators[1][vehicleid] = true;
- new Float:_vX[2], Float:_vY[2], Float:_vZ[2];
- switch(ClignotantsID[vehicleid]) {
- case 0: {
- Indicators_xqz[1] = CreateObject(19294, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0);
- Indicators_xqz[0] = CreateObject(19294, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0);
- Indicators_xqz[4] = CreateObject(19294, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0);
- }
- case 1: {
- Indicators_xqz[1] = CreateObject(19289, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0);
- Indicators_xqz[0] = CreateObject(19289, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0);
- Indicators_xqz[4] = CreateObject(19289, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0);
- }
- case 2: {
- Indicators_xqz[1] = CreateObject(19290, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0);
- Indicators_xqz[0] = CreateObject(19290, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0);
- Indicators_xqz[4] = CreateObject(19290, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0);
- }
- case 3: {
- Indicators_xqz[1] = CreateObject(19291, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0);
- Indicators_xqz[0] = CreateObject(19291, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0);
- Indicators_xqz[4] = CreateObject(19291, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0);
- }
- case 4: {
- Indicators_xqz[1] = CreateObject(19292, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0);
- Indicators_xqz[0] = CreateObject(19292, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0);
- Indicators_xqz[4] = CreateObject(19292, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0);
- }
- case 5: {
- Indicators_xqz[1] = CreateObject(19293, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0);
- Indicators_xqz[0] = CreateObject(19293, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0);
- Indicators_xqz[4] = CreateObject(19293, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0);
- }
- }
- if(IsTrailerAttachedToVehicle(vehicleid)) {
- new omg = GetVehicleModel(GetVehicleTrailer(vehicleid));
- GetVehicleModelInfo(omg, VEHICLE_MODEL_INFO_SIZE, _vX[0], _vY[0], _vZ[0]);
- AttachObjectToVehicle(Indicators_xqz[4], GetVehicleTrailer(vehicleid), _vX[0]/2.4, -_vY[0]/3.35, -1.0 ,0,0,0);
- }
- GetVehicleModelInfo(GetVehicleModel(vehicleid), VEHICLE_MODEL_INFO_SIZE, _vX[0], _vY[0], _vZ[0]);
- AttachObjectToVehicle(Indicators_xqz[0], vehicleid, _vX[0]/2.23, _vY[0]/2.23, 0.1 ,0,0,0);
- AttachObjectToVehicle(Indicators_xqz[1], vehicleid, _vX[0]/2.23, -_vY[0]/2.23, 0.1 ,0,0,0);
- return 1;
- }
- case 1: {
- Indicators[1][vehicleid] = false;
- DestroyObject(Indicators_xqz[0]);
- DestroyObject(Indicators_xqz[1]);
- DestroyObject(Indicators_xqz[4]);
- return 1;
- }
- }
- }
- }
- }
- return 0;
- }
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) {
- switch(dialogid) {
- case DIALOGUE_CLIGNOTANT: {
- new vehicleid = GetPlayerVehicleID(playerid);
- switch(listitem) {
- case 0: ClignotantsID[vehicleid] = 0;
- case 1: ClignotantsID[vehicleid] = 1;
- case 2: ClignotantsID[vehicleid] = 2;
- case 3: ClignotantsID[vehicleid] = 3;
- case 4: ClignotantsID[vehicleid] = 4;
- case 5: ClignotantsID[vehicleid] = 5;
- }
- }
- }
- return 0;
- }
- #error Un merci ne fait pas de mal. 1 point de réputation non plus.
Advertisement
Add Comment
Please, Sign In to add comment