Advertisement
Dayrion

Untitled

May 7th, 2016
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 6.33 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.                 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", "Ok", "Quitter");
  76.             }
  77.             if(Voiture(veh))
  78.             {
  79.                 ShowPlayerDialog(playerid, DIALOG_PRENDRE_VOITURE, DIALOG_STYLE_LIST, "Prendre une arme",
  80.                 "Arme emplacement 1\n\
  81.                 Arme emplacement 2\n\
  82.                 Arme emplacement 3", "Ok", "Quitter");
  83.             }
  84.             if(Camion(veh))
  85.             {
  86.                 ShowPlayerDialog(playerid, DIALOG_PRENDRE_CAMION, DIALOG_STYLE_LIST, "Prendre une arme",
  87.                 "Arme emplacement 1\n\
  88.                 Arme emplacement 2\n\
  89.                 Arme emplacement 3\n\
  90.                 Arme emplacement 4\n\
  91.                 Arme emplacement 5", "Ok", "Quitter");
  92.             }
  93.         }
  94.     }
  95.     else SCM(playerid, -1, ""ROUGEC"> Erreur:"BLANC" Le véhicule ne vous appartient pas.");
  96.     return 1;
  97. }
  98.  
  99. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  100. {
  101.     if(dialogid==DIALOG_PRENDRE_MOTO)
  102.     {
  103.         if(response == 1)
  104.         {
  105.             switch(listitem)
  106.             {
  107.                 case 0: GivePlayerWeapon(playerid, GunName[vInfo[closestveh][Slot1]], vInfo[closestveh][Muni1]);
  108.             }
  109.         }
  110.     }
  111.     if(dialogid==DIALOG_PRENDRE_VOITURE)
  112.     {
  113.         if(response == 1)
  114.         {
  115.             switch(listitem)
  116.             {
  117.                 case 0: GivePlayerWeapon(playerid, GunName[vInfo[closestveh][Slot1]], vInfo[closestveh][Muni1]);
  118.                 case 1: GivePlayerWeapon(playerid, GunName[vInfo[closestveh][Slot2]], vInfo[closestveh][Muni2]);
  119.                 case 2: GivePlayerWeapon(playerid, GunName[vInfo[closestveh][Slot3]], vInfo[closestveh][Muni3]);
  120.             }
  121.         }
  122.     }
  123.     if(dialogid==DIALOG_PRENDRE_CAMION)
  124.     {
  125.         if(response == 1)
  126.         {
  127.             switch(listitem)
  128.             {
  129.                 case 0: GivePlayerWeapon(playerid, GunName[vInfo[closestveh][Slot1]], vInfo[closestveh][Muni1]);
  130.                 case 1: GivePlayerWeapon(playerid, GunName[vInfo[closestveh][Slot2]], vInfo[closestveh][Muni2]);
  131.                 case 2: GivePlayerWeapon(playerid, GunName[vInfo[closestveh][Slot3]], vInfo[closestveh][Muni3]);
  132.                 case 3: GivePlayerWeapon(playerid, GunName[vInfo[closestveh][Slot4]], vInfo[closestveh][Muni4]);
  133.                 case 4: GivePlayerWeapon(playerid, GunName[vInfo[closestveh][Slot5]], vInfo[closestveh][Muni5]);
  134.             }
  135.         }
  136.     }
  137.     return 1;
  138. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement