Advertisement
Dayrion

Untitled

May 7th, 2016
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 6.38 KB | None | 0 0
  1.  
  2. #define DIALOG_PRENDRE_MOTO 283
  3. #define DIALOG_PRENDRE_VOITURE 284
  4. #define DIALOG_PRENDRE_CAMION 285
  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.                 SCM(playerid, -1, "Voici le contenu de votre coffre:");
  36.                 format(string, sizeof(string), "Slot 1: %s - (Munitions: %d)", GunName[vInfo[closestveh][Slot1]], vInfo[closestveh][Muni1]);
  37.                 SCM(playerid, -1, string);
  38.                 return 1;
  39.             }
  40.             if(Voiture(veh))
  41.             {
  42.                 SCM(playerid, -1, "Voici le contenu de votre coffre:");
  43.                 format(string, sizeof(string), "Slot 1: %s - (Munitions: %d)", GunName[vInfo[closestveh][Slot1]], vInfo[closestveh][Muni1]);
  44.                 SCM(playerid, -1, string);
  45.                 format(string, sizeof(string), "Slot 2: %s - (Munitions: %d)", GunName[vInfo[closestveh][Slot2]], vInfo[closestveh][Muni2]);
  46.                 SCM(playerid, -1, string);
  47.                 format(string, sizeof(string), "Slot 3: %s - (Munitions: %d)", GunName[vInfo[closestveh][Slot3]], vInfo[closestveh][Muni3]);
  48.                 SCM(playerid, -1, string);
  49.                 format(string, sizeof(string), "Cannabis: %d Coke: %d Matos: %d", vInfo[closestveh][Cannabis], vInfo[closestveh][Cocaine], vInfo[closestveh][Matos]);
  50.                 SCM(playerid, -1, string);
  51.                 return 1;
  52.             }
  53.             if(Camion(veh))
  54.             {
  55.                 SCM(playerid, -1, "Voici le contenu de votre coffre:");
  56.                 format(string, sizeof(string), "Slot 1: %s - (Munitions: %d)", GunName[vInfo[closestveh][Slot1]], vInfo[closestveh][Muni1]);
  57.                 SCM(playerid, -1, string);
  58.                 format(string, sizeof(string), "Slot 2: %s - (Munitions: %d)", GunName[vInfo[closestveh][Slot2]], vInfo[closestveh][Muni2]);
  59.                 SCM(playerid, -1, string);
  60.                 format(string, sizeof(string), "Slot 3: %s - (Munitions: %d)", GunName[vInfo[closestveh][Slot3]], vInfo[closestveh][Muni3]);
  61.                 SCM(playerid, -1, string);
  62.                 format(string, sizeof(string), "Slot 4: %s - (Munitions: %d)", GunName[vInfo[closestveh][Slot4]], vInfo[closestveh][Muni4]);
  63.                 SCM(playerid, -1, string);
  64.                 format(string, sizeof(string), "Slot 5: %s - (Munitions: %d)", GunName[vInfo[closestveh][Slot5]], vInfo[closestveh][Muni5]);
  65.                 SCM(playerid, -1, string);
  66.                 format(string, sizeof(string), "Cannabis: %d Coke: %d Matos: %d", vInfo[closestveh][Cannabis], vInfo[closestveh][Cocaine], vInfo[closestveh][Matos]);
  67.                 SCM(playerid, -1, string);
  68.                 return 1;
  69.             }
  70.         if(strcmp(faire, "prendrearme", true) == 0)
  71.         {
  72.             if(Moto(veh))
  73.             {
  74.                 ShowPlayerDialog(playerid, DIALOG_PRENDRE_MOTO, DIALOG_STYLE_LIST, "Prendre une arme",
  75.                 "Arme emplacement 1\n\
  76.                 Arme emplacement 2\n\
  77.                 Arme emplacement 3", "Ok", "Quitter");
  78.             }
  79.             if(Voiture(veh))
  80.             {
  81.                 ShowPlayerDialog(playerid, DIALOG_PRENDRE_VOITURE, DIALOG_STYLE_LIST, "Prendre une arme",
  82.                 "Arme emplacement 1\n\
  83.                 Arme emplacement 2\n\
  84.                 Arme emplacement 3", "Ok", "Quitter");
  85.             }
  86.             if(Camion(veh))
  87.             {
  88.                 ShowPlayerDialog(playerid, DIALOG_PRENDRE_CAMION, DIALOG_STYLE_LIST, "Prendre une arme",
  89.                 "Arme emplacement 1\n\
  90.                 Arme emplacement 2\n\
  91.                 Arme emplacement 3\n\
  92.                 Arme emplacement 4\n\
  93.                 Arme emplacement 5", "Ok", "Quitter");
  94.             }
  95.         }
  96.     }
  97.     else SCM(playerid, -1, ""ROUGEC"> Erreur:"BLANC" Le véhicule ne vous appartient pas.");
  98.     return 1;
  99. }
  100.  
  101. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  102. {
  103.     if(dialogid==DIALOG_PRENDRE_VOITURE)
  104.     {
  105.         if(response == 1)
  106.         {
  107.             switch(listitem)
  108.             {
  109.                 case 0: GivePlayerWeapon(playerid, GunName[vInfo[closestveh][Slot1]], vInfo[closestveh][Muni1]);
  110.                 case 1: GivePlayerWeapon(playerid, GunName[vInfo[closestveh][Slot2]], vInfo[closestveh][Muni2]);
  111.                 case 2: GivePlayerWeapon(playerid, GunName[vInfo[closestveh][Slot3]], vInfo[closestveh][Muni3]);
  112.             }
  113.         }
  114.     }
  115.     if(dialogid==DIALOG_PRENDRE_CAMION)
  116.     {
  117.         if(response == 1)
  118.         {
  119.             switch(listitem)
  120.             {
  121.                 case 0: GivePlayerWeapon(playerid, GunName[vInfo[closestveh][Slot1]], vInfo[closestveh][Muni1]);
  122.                 case 1: GivePlayerWeapon(playerid, GunName[vInfo[closestveh][Slot2]], vInfo[closestveh][Muni2]);
  123.                 case 2: GivePlayerWeapon(playerid, GunName[vInfo[closestveh][Slot3]], vInfo[closestveh][Muni3]);
  124.                 case 1: GivePlayerWeapon(playerid, GunName[vInfo[closestveh][Slot4]], vInfo[closestveh][Muni4]);
  125.                 case 2: GivePlayerWeapon(playerid, GunName[vInfo[closestveh][Slot5]], vInfo[closestveh][Muni5]);
  126.             }
  127.         }
  128.     }
  129.     if(dialogid==DIALOG_PRENDRE_MOTO)
  130.     {
  131.         if(response == 1)
  132.         {
  133.             switch(listitem)
  134.             {
  135.                 case 0: GivePlayerWeapon(playerid, GunName[vInfo[closestveh][Slot1]], vInfo[closestveh][Muni1]);
  136.             }
  137.         }
  138.     }
  139.     return 1;
  140. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement