Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- stock chargerPoubelle()
- {
- new fichier[128],gString[250];
- new i = 0,v = 0;
- for(new a = 0; a < MAX_POUBELLE; a++)
- {
- i = PoubelleC;
- format(fichier, 128, FICHIER_POUBELLE, a);
- if(fexist(fichier))
- {
- InfoPoubelle[i][pUniqID] = dini_Int(fichier, "UniqID");
- InfoPoubelle[i][pPoubID] = dini_Int(fichier,"PoubID");
- InfoPoubelle[i][pSpawnX] = dini_Float(fichier, "SpawnX");
- InfoPoubelle[i][pSpawnY] = dini_Float(fichier, "SpawnY");
- InfoPoubelle[i][pSpawnZ] = dini_Float(fichier, "SpawnZ");
- InfoPoubelle[i][pSpawnA] = dini_Float(fichier, "SpawnA");
- InfoPoubelle[i][coffrePoub] = (dini_Bool(fichier, "coffre")) ? (true) : (false);
- InfoPoubelle[i][slotsCoffre]= dini_Int(fichier, "slotsCoffre");
- format(gString, sizeof(gString), Rouge_SAMP"[Poubelle:] "Bleu_SAMP"Appuie sur 'CRTL' pour ouvrir la poubelle");
- PickupPoubelle[i] = Create3DTextLabel(gString, 0xFFFFFFFF, InfoPoubelle[i][pSpawnX], InfoPoubelle[i][pSpawnY],InfoPoubelle[i][pSpawnZ], 20, 0);
- Objetps[i] = CreateObject(InfoPoubelle[i][pPoubID], InfoPoubelle[i][pSpawnX], InfoPoubelle[i][pSpawnY],InfoPoubelle[i][pSpawnZ], InfoPoubelle[i][pSpawnA], 0.0, 0.0, 250.0);
- format(fichier, TAILLE_STRING_CLASSIC, FICHIER_COFFRESB, a);
- if(!fexist(fichier))
- dini_Create(fichier);
- else
- {
- if(InfoPoubelle[i][coffre])
- {
- for(new c = 0; c < InfoPoubelle[c][slotsCoffre]; c++)
- {
- format(stringtmp, TAILLE_STRING_CLASSIC, "coffre_slotLibre%d", c);
- InfoCoffrePoub[i][c][slotLibre] = (dini_Bool(fichier, stringtmp)) ? (true) : (false);
- if(!InfoCoffrePoub[i][c][slotLibre])
- {
- format(stringtmp, TAILLE_STRING_CLASSIC, "coffre_nomItem%d", c);
- format(InfoCoffrePoub[i][c][nomItem], 32, dini_Get(fichier, stringtmp));
- format(stringtmp, TAILLE_STRING_CLASSIC, "coffre_quantite%d", c);
- InfoCoffrePoub[i][c][quantite] = dini_Int(fichier, stringtmp);
- }
- }
- }
- }
- PoubelleC++;
- }
- else
- {
- // Ce sera un slot de véhicule libre, il faut donc le préparer
- for(new c = 0; c < SLOTS_COFFRE; c++)
- InfoCoffrePoub[a][c][slotLibre] = true;
- }
- }
- printf("[INFO]: %d poubelle chargé.", PoubelleC);
- return 1;
- }
- YCMD:creerpoubelle(playerid, params[], help)
- {
- if(help)
- {
- }
- else
- {
- if(GetPVarInt(playerid, "JoueursAdmin") <= 3)
- {
- SendPlayerMessage(playerid, Rouge_SAMP"Erreur","Vous avez pas le niveau admin nécéssaire.");
- return 1;
- }
- new vModel;
- if(sscanf(params, "i", vModel))
- {
- SendPlayerMessage(playerid, Vert_SAMP"Usage", "1) Petite poubelle | 2) Grande poubelle");
- SendPlayerMessage(playerid, Vert_SAMP"Usage", "/creerpoubelle [IDPoubelle]");
- return 1;
- }
- else
- {
- if(vModel < 1 || vModel > 2)
- {
- SendPlayerMessage(playerid,Rouge_SAMP"Poubelle", "Le modèle de la poubelle dois être entre 1 et 2.");
- return 1;
- }
- new Float:X, Float:Y, Float:Z, Float:A;
- GetPlayerPos(playerid, X, Y, Z); GetPlayerFacingAngle(playerid, A);
- PoubelleC++;
- if(vModel == 1)
- {
- InfoPoubelle[PoubelleC][pPoubID] = 1339;
- InfoPoubelle[PoubelleC][slotsCoffre] = 5;
- }
- if(vModel == 2)
- {
- InfoPoubelle[PoubelleC][pPoubID] = 1345;
- InfoPoubelle[PoubelleC][slotsCoffre]= 5;
- }
- InfoPoubelle[PoubelleC][pUniqID] = PoubelleC;
- InfoPoubelle[PoubelleC][pSpawnX] = X;
- InfoPoubelle[PoubelleC][pSpawnY] = Y;
- InfoPoubelle[PoubelleC][pSpawnZ] = Z-1;
- InfoPoubelle[PoubelleC][pSpawnA] = 0.0;
- //InfoPoubelle[i][slotsCoffre]= dini_Int(fichier, "slotsCoffre");
- sauverPoubelle(PoubelleC);
- printf("[INFO]: Poubelle n°%d spawné.", PoubelleC);
- SendPlayerMessage(playerid, Bleu_SAMP"Poubelle", "Poubelle spawn avec succès.");
- for(new c = 0; c < MAX_POUBELLE; c++)
- {
- Delete3DTextLabel(PickupPoubelle[c]);
- DestroyObject(Objetps[c]);
- PoubelleC = 0;
- }
- chargerPoubelle();
- return 1;
- }
- }
- return 1;
- }
- stock afficherCoffrePoub(playerid, poubid)
- {
- new
- longstr[TAILLE_STRING_CLASSIC*2];
- longstr = "Quantité\t\tNom\n";
- new bID = PoubelleC;
- for(new c = 0; c < InfoPoubelle[bID][slotsCoffre]; c++)
- {
- if(!InfoCoffrePoub[bID][c][slotLibre] && InfoCoffrePoub[bID][c][quantite])
- format(longstr, TAILLE_STRING_CLASSIC*2, "%s%d\t\t%s\n", longstr, InfoCoffrePoub[bID][c][quantite], InfoCoffrePoub[bID][c][nomItem]);
- else
- format(longstr, TAILLE_STRING_CLASSIC*2, "%s("NOITEM" n°%d)\n", longstr, c);
- }
- ShowPlayerDialog(playerid, DIALOG_COFFRE400, DIALOG_STYLE_LIST, "Contenu de la poubelle", longstr, "Voir/Mettre", "Fermer");
- SetEVar(playerid, 0, poubid);
- }
Advertisement
Add Comment
Please, Sign In to add comment