Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define DIALOG_PRENDRE_MOTO 283
- #define DIALOG_PRENDRE_VOITURE 284
- #define DIALOG_PRENDRE_CAMION 285
- CMD:coffre(playerid, params[])
- {
- new veh = GetPlayerVehicleID(playerid), pname[MPN],
- Float:x, Float:y, Float:z, Float:dist, Float:closedist=4, closestveh;
- GetPlayerName(playerid, pname, sizeof(pname));
- static faire[25];
- 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.");
- for(new i=1; i < MAX_CARS; i++)
- {
- if(i != veh && GetVehiclePos(i, x, y, z))
- {
- dist = GetPlayerDistanceFromPoint(playerid, x, y, z);
- if(dist < closedist)
- {
- closedist = dist;
- closestveh = i;
- }
- }
- }
- if(pInfo[playerid][VehicleOwner] == closestveh || pInfo[playerid][VehicleOwner2] == closestveh || pInfo[playerid][VehicleOwner3] == closestveh || pInfo[playerid][Admin] > 5)
- {
- new string[1032];
- 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]");
- if(strcmp(faire, "info", true) == 0)
- {
- if(vTrunk[closestveh] == 0) return SCM(playerid, -1, ""ROUGEC"> Erreur:"BLANC" Le coffre n'est pas ouvert.");
- if(Moto(veh))
- {
- SCM(playerid, -1, "Voici le contenu de votre coffre:");
- format(string, sizeof(string), "Slot 1: %s - (Munitions: %d)", GunName[vInfo[closestveh][Slot1]], vInfo[closestveh][Muni1]);
- SCM(playerid, -1, string);
- return 1;
- }
- if(Voiture(veh))
- {
- SCM(playerid, -1, "Voici le contenu de votre coffre:");
- format(string, sizeof(string), "Slot 1: %s - (Munitions: %d)", GunName[vInfo[closestveh][Slot1]], vInfo[closestveh][Muni1]);
- SCM(playerid, -1, string);
- format(string, sizeof(string), "Slot 2: %s - (Munitions: %d)", GunName[vInfo[closestveh][Slot2]], vInfo[closestveh][Muni2]);
- SCM(playerid, -1, string);
- format(string, sizeof(string), "Slot 3: %s - (Munitions: %d)", GunName[vInfo[closestveh][Slot3]], vInfo[closestveh][Muni3]);
- SCM(playerid, -1, string);
- format(string, sizeof(string), "Cannabis: %d Coke: %d Matos: %d", vInfo[closestveh][Cannabis], vInfo[closestveh][Cocaine], vInfo[closestveh][Matos]);
- SCM(playerid, -1, string);
- return 1;
- }
- if(Camion(veh))
- {
- SCM(playerid, -1, "Voici le contenu de votre coffre:");
- format(string, sizeof(string), "Slot 1: %s - (Munitions: %d)", GunName[vInfo[closestveh][Slot1]], vInfo[closestveh][Muni1]);
- SCM(playerid, -1, string);
- format(string, sizeof(string), "Slot 2: %s - (Munitions: %d)", GunName[vInfo[closestveh][Slot2]], vInfo[closestveh][Muni2]);
- SCM(playerid, -1, string);
- format(string, sizeof(string), "Slot 3: %s - (Munitions: %d)", GunName[vInfo[closestveh][Slot3]], vInfo[closestveh][Muni3]);
- SCM(playerid, -1, string);
- format(string, sizeof(string), "Slot 4: %s - (Munitions: %d)", GunName[vInfo[closestveh][Slot4]], vInfo[closestveh][Muni4]);
- SCM(playerid, -1, string);
- format(string, sizeof(string), "Slot 5: %s - (Munitions: %d)", GunName[vInfo[closestveh][Slot5]], vInfo[closestveh][Muni5]);
- SCM(playerid, -1, string);
- format(string, sizeof(string), "Cannabis: %d Coke: %d Matos: %d", vInfo[closestveh][Cannabis], vInfo[closestveh][Cocaine], vInfo[closestveh][Matos]);
- SCM(playerid, -1, string);
- return 1;
- }
- if(strcmp(faire, "prendrearme", true) == 0)
- {
- if(Moto(veh))
- {
- ShowPlayerDialog(playerid, DIALOG_PRENDRE_MOTO, DIALOG_STYLE_LIST, "Prendre une arme",
- "Arme emplacement 1", "Ok", "Quitter");
- }
- if(Voiture(veh))
- {
- ShowPlayerDialog(playerid, DIALOG_PRENDRE_VOITURE, DIALOG_STYLE_LIST, "Prendre une arme",
- "Arme emplacement 1\n\
- Arme emplacement 2\n\
- Arme emplacement 3", "Ok", "Quitter");
- }
- if(Camion(veh))
- {
- ShowPlayerDialog(playerid, DIALOG_PRENDRE_CAMION, DIALOG_STYLE_LIST, "Prendre une arme",
- "Arme emplacement 1\n\
- Arme emplacement 2\n\
- Arme emplacement 3\n\
- Arme emplacement 4\n\
- Arme emplacement 5", "Ok", "Quitter");
- }
- }
- }
- else SCM(playerid, -1, ""ROUGEC"> Erreur:"BLANC" Le véhicule ne vous appartient pas.");
- return 1;
- }
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
- {
- if(dialogid==DIALOG_PRENDRE_MOTO)
- {
- if(response == 1)
- {
- switch(listitem)
- {
- case 0: GivePlayerWeapon(playerid, GunName[vInfo[closestveh][Slot1]], vInfo[closestveh][Muni1]);
- }
- }
- }
- if(dialogid==DIALOG_PRENDRE_VOITURE)
- {
- if(response == 1)
- {
- switch(listitem)
- {
- case 0: GivePlayerWeapon(playerid, GunName[vInfo[closestveh][Slot1]], vInfo[closestveh][Muni1]);
- case 1: GivePlayerWeapon(playerid, GunName[vInfo[closestveh][Slot2]], vInfo[closestveh][Muni2]);
- case 2: GivePlayerWeapon(playerid, GunName[vInfo[closestveh][Slot3]], vInfo[closestveh][Muni3]);
- }
- }
- }
- if(dialogid==DIALOG_PRENDRE_CAMION)
- {
- if(response == 1)
- {
- switch(listitem)
- {
- case 0: GivePlayerWeapon(playerid, GunName[vInfo[closestveh][Slot1]], vInfo[closestveh][Muni1]);
- case 1: GivePlayerWeapon(playerid, GunName[vInfo[closestveh][Slot2]], vInfo[closestveh][Muni2]);
- case 2: GivePlayerWeapon(playerid, GunName[vInfo[closestveh][Slot3]], vInfo[closestveh][Muni3]);
- case 3: GivePlayerWeapon(playerid, GunName[vInfo[closestveh][Slot4]], vInfo[closestveh][Muni4]);
- case 4: GivePlayerWeapon(playerid, GunName[vInfo[closestveh][Slot5]], vInfo[closestveh][Muni5]);
- }
- }
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement