Advertisement
Dayrion

Untitled

May 7th, 2016
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 8.10 KB | None | 0 0
  1. #define DIALOG_PRENDRE_MOTO 283
  2. #define DIALOG_PRENDRE_VOITURE 284
  3. #define DIALOG_PRENDRE_CAMION 285
  4.  
  5. CMD:coffre(playerid, params[])
  6. {
  7.     new veh = GetPlayerVehicleID(playerid), pname[MPN],
  8.     Float:x, Float:y, Float:z, Float:dist, Float:closedist=4, closestveh;
  9.     GetPlayerName(playerid, pname, sizeof(pname));
  10.    
  11.     static faire[25];
  12.    
  13.     if(pInfo[playerid][VehicleOwner] == 9999 && pInfo[playerid][VehicleOwner2] == 9999 && pInfo[playerid][VehicleOwner3] == 9999) return SCM(playerid, -1, ROUGEC"> Erreur:"BLANC" Vous n'avez pas de véhicule.");
  14.     for(new i=1; i < MAX_CARS; i++)
  15.     {
  16.         if(i != veh && GetVehiclePos(i, x, y, z))
  17.         {
  18.             dist = GetPlayerDistanceFromPoint(playerid, x, y, z);
  19.             if(dist < closedist)
  20.             {
  21.                 closedist = dist;
  22.                 closestveh = i;
  23.             }
  24.         }
  25.     }
  26.     if(pInfo[playerid][VehicleOwner] == closestveh || pInfo[playerid][VehicleOwner2] == closestveh || pInfo[playerid][VehicleOwner3] == closestveh || pInfo[playerid][Admin] > 5)
  27.     {
  28.         new string[1032];
  29.         if(sscanf(params, "s[20]", faire)) return SCM(playerid, -1, BLEUC"> Utilisation:"BLANC" /coffre [(p)rendre(a)rme ; (d)eposer(a)rme ; (p)rendre(ca)nnabis ; (d)eposer(ca)nnabis]");
  30.         if(strcmp(faire, "info", true) == 0)
  31.         {
  32.             if(vTrunk[closestveh] == 0) return SCM(playerid, -1, ROUGEC"> Erreur:"BLANC" Le coffre n'est pas ouvert.");
  33.             if(Moto(veh))
  34.             {
  35.                 new stringPrendreArme[300];
  36.                 SCM(playerid, -1, "Voici le contenu de votre coffre:");
  37.                 format(string, sizeof(string), "Slot 1: %s - (Munitions: %d)\n", GunName[vInfo[closestveh][Slot1]], vInfo[closestveh][Muni1]);
  38.                 strcat(stringPrendreArmeVeh, string);
  39.                 SCM(playerid, -1, string);
  40.                 return 1;
  41.             }
  42.             if(Voiture(veh))
  43.             {
  44.                 new stringPrendreArme[300];
  45.                 SCM(playerid, -1, "Voici le contenu de votre coffre:");
  46.                 format(string, sizeof(string), "Slot 1: %s - (Munitions: %d)\n", GunName[vInfo[closestveh][Slot1]], vInfo[closestveh][Muni1]);
  47.                 SCM(playerid, -1, string);
  48.                 strcat(stringPrendreArmeVeh, string);
  49.                 format(string, sizeof(string), "Slot 2: %s - (Munitions: %d)\n", GunName[vInfo[closestveh][Slot2]], vInfo[closestveh][Muni2]);
  50.                 SCM(playerid, -1, string);
  51.                 strcat(stringPrendreArmeVeh, string);
  52.                 format(string, sizeof(string), "Slot 3: %s - (Munitions: %d)\n", GunName[vInfo[closestveh][Slot3]], vInfo[closestveh][Muni3]);
  53.                 SCM(playerid, -1, string);
  54.                 strcat(stringPrendreArmeVeh, string);
  55.                 format(string, sizeof(string), "Cannabis: %d Coke: %d Matos: %d\n", vInfo[closestveh][Cannabis], vInfo[closestveh][Cocaine], vInfo[closestveh][Matos]);
  56.                 SCM(playerid, -1, string);
  57.                 return 1;
  58.             }
  59.             if(Camion(veh))
  60.             {
  61.                 new stringPrendreArme[300];
  62.                 SCM(playerid, -1, "Voici le contenu de votre coffre:");
  63.                 format(string, sizeof(string), "Slot 1: %s - (Munitions: %d)\n", GunName[vInfo[closestveh][Slot1]], vInfo[closestveh][Muni1]);
  64.                 SCM(playerid, -1, string);
  65.                 strcat(stringPrendreArmeVeh, string);
  66.                 format(string, sizeof(string), "Slot 2: %s - (Munitions: %d)\n", GunName[vInfo[closestveh][Slot2]], vInfo[closestveh][Muni2]);
  67.                 SCM(playerid, -1, string);
  68.                 strcat(stringPrendreArmeVeh, string);
  69.                 format(string, sizeof(string), "Slot 3: %s - (Munitions: %d)\n", GunName[vInfo[closestveh][Slot3]], vInfo[closestveh][Muni3]);
  70.                 SCM(playerid, -1, string);
  71.                 strcat(stringPrendreArmeVeh, string);
  72.                 format(string, sizeof(string), "Slot 4: %s - (Munitions: %d)\n", GunName[vInfo[closestveh][Slot4]], vInfo[closestveh][Muni4]);
  73.                 SCM(playerid, -1, string);
  74.                 strcat(stringPrendreArmeVeh, string);
  75.                 format(string, sizeof(string), "Slot 5: %s - (Munitions: %d)\n", GunName[vInfo[closestveh][Slot5]], vInfo[closestveh][Muni5]);
  76.                 SCM(playerid, -1, string);
  77.                 strcat(stringPrendreArmeVeh, string);
  78.                 format(string, sizeof(string), "Cannabis: %d Coke: %d Matos: %d\n", vInfo[closestveh][Cannabis], vInfo[closestveh][Cocaine], vInfo[closestveh][Matos]);
  79.                 SCM(playerid, -1, string);
  80.                 strcat(stringPrendreArmeVeh, string);
  81.                 return 1;
  82.             }
  83.         if(strcmp(faire, "prendrearme", true) == 0)
  84.         {
  85.             if(Moto(veh))
  86.             {
  87.                 ShowPlayerDialog(playerid, DIALOG_PRENDRE_MOTO, DIALOG_STYLE_LIST, "Prendre une arme", stringPrendreArmeVeh, "Ok", "Quitter");
  88.             }
  89.             if(Voiture(veh))
  90.             {
  91.                 ShowPlayerDialog(playerid, DIALOG_PRENDRE_VOITURE, DIALOG_STYLE_LIST, "Prendre une arme", stringPrendreArmeVeh, "Ok", "Quitter");
  92.             }
  93.             if(Camion(veh))
  94.             {
  95.                 ShowPlayerDialog(playerid, DIALOG_PRENDRE_CAMION, DIALOG_STYLE_LIST, "Prendre une arme", stringPrendreArmeVeh, "Ok", "Quitter");
  96.             }
  97.         }
  98.     }
  99.     else SCM(playerid, -1, ROUGEC"> Erreur:"BLANC" Le véhicule ne vous appartient pas.");
  100.     return 1;
  101. }
  102.  
  103. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  104. {
  105.     if(dialogid==DIALOG_PRENDRE_VOITURE)
  106.     {
  107.         if(response == 1)
  108.         {
  109.             new Float:x, Float:y, Float:z, Float:dist, Float:closedist=4, closestveh;
  110.             for(new i=1; i < MAX_CARS; i++)
  111.             {
  112.                 if(i != veh && GetVehiclePos(i, x, y, z))
  113.                 {
  114.                     dist = GetPlayerDistanceFromPoint(playerid, x, y, z);
  115.                     if(dist < closedist)
  116.                     {
  117.                         closedist = dist;
  118.                         closestveh = i;
  119.                     }
  120.                 }
  121.             }
  122.             switch(listitem)
  123.             {
  124.                 case 0: GivePlayerWeapon(playerid, GunName[vInfo[closestveh][Slot1]], vInfo[closestveh][Muni1]);
  125.                 case 1: GivePlayerWeapon(playerid, GunName[vInfo[closestveh][Slot2]], vInfo[closestveh][Muni2]);
  126.                 case 2: GivePlayerWeapon(playerid, GunName[vInfo[closestveh][Slot3]], vInfo[closestveh][Muni3]);
  127.             }
  128.         }
  129.     }
  130.     if(dialogid==DIALOG_PRENDRE_CAMION)
  131.     {
  132.         if(response == 1)
  133.         {
  134.             new Float:x, Float:y, Float:z, Float:dist, Float:closedist=4, closestveh;
  135.             for(new i=1; i < MAX_CARS; i++)
  136.             {
  137.                 if(i != veh && GetVehiclePos(i, x, y, z))
  138.                 {
  139.                     dist = GetPlayerDistanceFromPoint(playerid, x, y, z);
  140.                     if(dist < closedist)
  141.                     {
  142.                         closedist = dist;
  143.                         closestveh = i;
  144.                     }
  145.                 }
  146.             }
  147.             switch(listitem)
  148.             {
  149.                 case 0: GivePlayerWeapon(playerid, GunName[vInfo[closestveh][Slot1]], vInfo[closestveh][Muni1]);
  150.                 case 1: GivePlayerWeapon(playerid, GunName[vInfo[closestveh][Slot2]], vInfo[closestveh][Muni2]);
  151.                 case 2: GivePlayerWeapon(playerid, GunName[vInfo[closestveh][Slot3]], vInfo[closestveh][Muni3]);
  152.                 case 1: GivePlayerWeapon(playerid, GunName[vInfo[closestveh][Slot4]], vInfo[closestveh][Muni4]);
  153.                 case 2: GivePlayerWeapon(playerid, GunName[vInfo[closestveh][Slot5]], vInfo[closestveh][Muni5]);
  154.             }
  155.         }
  156.     }
  157.     if(dialogid==DIALOG_PRENDRE_MOTO)
  158.     {
  159.         if(response == 1)
  160.         {
  161.             new Float:x, Float:y, Float:z, Float:dist, Float:closedist=4, closestveh;
  162.             for(new i=1; i < MAX_CARS; i++)
  163.             {
  164.                 if(i != veh && GetVehiclePos(i, x, y, z))
  165.                 {
  166.                     dist = GetPlayerDistanceFromPoint(playerid, x, y, z);
  167.                     if(dist < closedist)
  168.                     {
  169.                         closedist = dist;
  170.                         closestveh = i;
  171.                     }
  172.                 }
  173.             }
  174.             switch(listitem)
  175.             {
  176.                 case 0: GivePlayerWeapon(playerid, GunName[vInfo[closestveh][Slot1]], vInfo[closestveh][Muni1]);
  177.             }
  178.         }
  179.     }
  180.     return 1;
  181. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement