Chris53340

Clignotants

Jan 22nd, 2015
335
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 6.67 KB | None | 0 0
  1. #include <a_samp>
  2.  
  3. #define DIALOGUE_CLIGNOTANT 1
  4.  
  5. new Indicators_xqz[6], ClignotantsID[6], bool:Indicators[2][MAX_VEHICLES];
  6.  
  7. public OnPlayerCommandText(playerid, cmdtext[]) {
  8.     if(!strcmp(cmdtext, "/clignotant", true)) ShowPlayerDialog(playerid, DIALOGUE_CLIGNOTANT, DIALOG_STYLE_LIST, "Couleur des clignotants", "Orange\nBlanc\nRouge\nVert\nBleu\nGyrophare", "Valider", "Annuler");
  9.     if(!strcmp(cmdtext, "/t", true)) SetWeather(2);
  10.     return 0;
  11. }
  12. public OnPlayerKeyStateChange(playerid,newkeys, oldkeys) {
  13.     if(IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == 2) {
  14.         new vehicleid = GetPlayerVehicleID(playerid);
  15.         switch(newkeys) {
  16.             case KEY_LOOK_LEFT: {
  17.                 switch(Indicators[0][vehicleid]) {
  18.                     case false: {
  19.                         Indicators[0][vehicleid] = true;
  20.                         new Float:_vX[2], Float:_vY[2], Float:_vZ[2];
  21.                         switch(ClignotantsID[vehicleid]) {
  22.                             case 0: {
  23.                                 Indicators_xqz[2] = CreateObject(19294, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0);
  24.                                 Indicators_xqz[3] = CreateObject(19294, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0);
  25.                                 Indicators_xqz[5] = CreateObject(19294, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0);
  26.                             }
  27.                             case 1: {
  28.                                 Indicators_xqz[2] = CreateObject(19289, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0);
  29.                                 Indicators_xqz[3] = CreateObject(19289, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0);
  30.                                 Indicators_xqz[5] = CreateObject(19289, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0);
  31.                             }
  32.                             case 2: {
  33.                                 Indicators_xqz[2] = CreateObject(19290, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0);
  34.                                 Indicators_xqz[3] = CreateObject(19290, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0);
  35.                                 Indicators_xqz[5] = CreateObject(19290, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0);
  36.                             }
  37.                             case 3: {
  38.                                 Indicators_xqz[2] = CreateObject(19291, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0);
  39.                                 Indicators_xqz[3] = CreateObject(19291, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0);
  40.                                 Indicators_xqz[5] = CreateObject(19291, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0);
  41.                             }
  42.                             case 4: {
  43.                                 Indicators_xqz[2] = CreateObject(19292, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0);
  44.                                 Indicators_xqz[3] = CreateObject(19292, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0);
  45.                                 Indicators_xqz[5] = CreateObject(19292, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0);
  46.                             }
  47.                             case 5: {
  48.                                 Indicators_xqz[2] = CreateObject(19293, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0);
  49.                                 Indicators_xqz[3] = CreateObject(19293, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0);
  50.                                 Indicators_xqz[5] = CreateObject(19293, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0);
  51.                             }
  52.                         }
  53.                         if(IsTrailerAttachedToVehicle(vehicleid)) {
  54.                             new omg = GetVehicleModel(GetVehicleTrailer(vehicleid));
  55.                             GetVehicleModelInfo(omg, VEHICLE_MODEL_INFO_SIZE, _vX[0], _vY[0], _vZ[0]);
  56.                             AttachObjectToVehicle(Indicators_xqz[5], GetVehicleTrailer(vehicleid),  -_vX[0]/2.4, -_vY[0]/3.35, -1.0 ,0,0,0);
  57.                         }
  58.                         GetVehicleModelInfo(GetVehicleModel(vehicleid), VEHICLE_MODEL_INFO_SIZE, _vX[0], _vY[0], _vZ[0]);
  59.                         AttachObjectToVehicle(Indicators_xqz[2], vehicleid,  -_vX[0]/2.23, _vY[0]/2.23, 0.1 ,0,0,0);
  60.                         AttachObjectToVehicle(Indicators_xqz[3], vehicleid,  -_vX[0]/2.23, -_vY[0]/2.23, 0.1 ,0,0,0);
  61.                         return 1;
  62.                     }
  63.                     case 1: {
  64.                         Indicators[0][vehicleid] = false;
  65.                         DestroyObject(Indicators_xqz[2]);
  66.                         DestroyObject(Indicators_xqz[3]);
  67.                         DestroyObject(Indicators_xqz[5]);
  68.                         return 1;
  69.                     }
  70.                 }
  71.             }
  72.             case KEY_LOOK_RIGHT: {
  73.                 switch(Indicators[1][vehicleid]) {
  74.                     case false: {
  75.                         Indicators[1][vehicleid] = true;
  76.                         new Float:_vX[2], Float:_vY[2], Float:_vZ[2];
  77.                         switch(ClignotantsID[vehicleid]) {
  78.                             case 0: {
  79.                                 Indicators_xqz[1] = CreateObject(19294, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0);
  80.                                 Indicators_xqz[0] = CreateObject(19294, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0);
  81.                                 Indicators_xqz[4] = CreateObject(19294, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0);
  82.                             }
  83.                             case 1: {
  84.                                 Indicators_xqz[1] = CreateObject(19289, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0);
  85.                                 Indicators_xqz[0] = CreateObject(19289, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0);
  86.                                 Indicators_xqz[4] = CreateObject(19289, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0);
  87.                             }
  88.                             case 2: {
  89.                                 Indicators_xqz[1] = CreateObject(19290, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0);
  90.                                 Indicators_xqz[0] = CreateObject(19290, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0);
  91.                                 Indicators_xqz[4] = CreateObject(19290, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0);
  92.                             }
  93.                             case 3: {
  94.                                 Indicators_xqz[1] = CreateObject(19291, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0);
  95.                                 Indicators_xqz[0] = CreateObject(19291, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0);
  96.                                 Indicators_xqz[4] = CreateObject(19291, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0);
  97.                             }
  98.                             case 4: {
  99.                                 Indicators_xqz[1] = CreateObject(19292, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0);
  100.                                 Indicators_xqz[0] = CreateObject(19292, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0);
  101.                                 Indicators_xqz[4] = CreateObject(19292, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0);
  102.                             }
  103.                             case 5: {
  104.                                 Indicators_xqz[1] = CreateObject(19293, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0);
  105.                                 Indicators_xqz[0] = CreateObject(19293, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0);
  106.                                 Indicators_xqz[4] = CreateObject(19293, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0);
  107.                             }
  108.                         }
  109.                         if(IsTrailerAttachedToVehicle(vehicleid)) {
  110.                             new omg = GetVehicleModel(GetVehicleTrailer(vehicleid));
  111.                             GetVehicleModelInfo(omg, VEHICLE_MODEL_INFO_SIZE, _vX[0], _vY[0], _vZ[0]);
  112.                             AttachObjectToVehicle(Indicators_xqz[4], GetVehicleTrailer(vehicleid),  _vX[0]/2.4, -_vY[0]/3.35, -1.0 ,0,0,0);
  113.                         }
  114.                         GetVehicleModelInfo(GetVehicleModel(vehicleid), VEHICLE_MODEL_INFO_SIZE, _vX[0], _vY[0], _vZ[0]);
  115.                         AttachObjectToVehicle(Indicators_xqz[0], vehicleid,  _vX[0]/2.23, _vY[0]/2.23, 0.1 ,0,0,0);
  116.                         AttachObjectToVehicle(Indicators_xqz[1], vehicleid,  _vX[0]/2.23, -_vY[0]/2.23, 0.1 ,0,0,0);
  117.                         return 1;
  118.                     }
  119.                     case 1: {
  120.                         Indicators[1][vehicleid] = false;
  121.                         DestroyObject(Indicators_xqz[0]);
  122.                         DestroyObject(Indicators_xqz[1]);
  123.                         DestroyObject(Indicators_xqz[4]);
  124.                         return 1;
  125.                     }
  126.                 }
  127.             }
  128.         }
  129.     }
  130.     return 0;
  131. }
  132. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) {
  133.     switch(dialogid) {
  134.         case DIALOGUE_CLIGNOTANT: {
  135.             new vehicleid = GetPlayerVehicleID(playerid);
  136.             switch(listitem) {
  137.                 case 0: ClignotantsID[vehicleid] = 0;
  138.                 case 1: ClignotantsID[vehicleid] = 1;
  139.                 case 2: ClignotantsID[vehicleid] = 2;
  140.                 case 3: ClignotantsID[vehicleid] = 3;
  141.                 case 4: ClignotantsID[vehicleid] = 4;
  142.                 case 5: ClignotantsID[vehicleid] = 5;
  143.             }
  144.         }
  145.     }
  146.     return 0;
  147. }
  148. #error Un merci ne fait pas de mal. 1 point de réputation non plus.
Advertisement
Add Comment
Please, Sign In to add comment