Guest User

Untitled

a guest
Jul 26th, 2013
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.80 KB | None | 0 0
  1. stock chargerPoubelle()
  2. {
  3. new fichier[128],gString[250];
  4. new i = 0,v = 0;
  5. for(new a = 0; a < MAX_POUBELLE; a++)
  6. {
  7. i = PoubelleC;
  8. format(fichier, 128, FICHIER_POUBELLE, a);
  9. if(fexist(fichier))
  10. {
  11. InfoPoubelle[i][pUniqID] = dini_Int(fichier, "UniqID");
  12. InfoPoubelle[i][pPoubID] = dini_Int(fichier,"PoubID");
  13. InfoPoubelle[i][pSpawnX] = dini_Float(fichier, "SpawnX");
  14. InfoPoubelle[i][pSpawnY] = dini_Float(fichier, "SpawnY");
  15. InfoPoubelle[i][pSpawnZ] = dini_Float(fichier, "SpawnZ");
  16. InfoPoubelle[i][pSpawnA] = dini_Float(fichier, "SpawnA");
  17. InfoPoubelle[i][coffrePoub] = (dini_Bool(fichier, "coffre")) ? (true) : (false);
  18. InfoPoubelle[i][slotsCoffre]= dini_Int(fichier, "slotsCoffre");
  19. format(gString, sizeof(gString), Rouge_SAMP"[Poubelle:] "Bleu_SAMP"Appuie sur 'CRTL' pour ouvrir la poubelle");
  20. PickupPoubelle[i] = Create3DTextLabel(gString, 0xFFFFFFFF, InfoPoubelle[i][pSpawnX], InfoPoubelle[i][pSpawnY],InfoPoubelle[i][pSpawnZ], 20, 0);
  21. Objetps[i] = CreateObject(InfoPoubelle[i][pPoubID], InfoPoubelle[i][pSpawnX], InfoPoubelle[i][pSpawnY],InfoPoubelle[i][pSpawnZ], InfoPoubelle[i][pSpawnA], 0.0, 0.0, 250.0);
  22. format(fichier, TAILLE_STRING_CLASSIC, FICHIER_COFFRESB, a);
  23. if(!fexist(fichier))
  24. dini_Create(fichier);
  25. else
  26. {
  27. if(InfoPoubelle[i][coffre])
  28. {
  29. for(new c = 0; c < InfoPoubelle[c][slotsCoffre]; c++)
  30. {
  31. format(stringtmp, TAILLE_STRING_CLASSIC, "coffre_slotLibre%d", c);
  32. InfoCoffrePoub[i][c][slotLibre] = (dini_Bool(fichier, stringtmp)) ? (true) : (false);
  33. if(!InfoCoffrePoub[i][c][slotLibre])
  34. {
  35. format(stringtmp, TAILLE_STRING_CLASSIC, "coffre_nomItem%d", c);
  36. format(InfoCoffrePoub[i][c][nomItem], 32, dini_Get(fichier, stringtmp));
  37. format(stringtmp, TAILLE_STRING_CLASSIC, "coffre_quantite%d", c);
  38. InfoCoffrePoub[i][c][quantite] = dini_Int(fichier, stringtmp);
  39. }
  40. }
  41. }
  42. }
  43. PoubelleC++;
  44. }
  45. else
  46. {
  47. // Ce sera un slot de véhicule libre, il faut donc le préparer
  48. for(new c = 0; c < SLOTS_COFFRE; c++)
  49. InfoCoffrePoub[a][c][slotLibre] = true;
  50. }
  51. }
  52. printf("[INFO]: %d poubelle chargé.", PoubelleC);
  53. return 1;
  54. }
  55.  
  56.  
  57. YCMD:creerpoubelle(playerid, params[], help)
  58. {
  59. if(help)
  60. {
  61.  
  62. }
  63. else
  64. {
  65. if(GetPVarInt(playerid, "JoueursAdmin") <= 3)
  66. {
  67. SendPlayerMessage(playerid, Rouge_SAMP"Erreur","Vous avez pas le niveau admin nécéssaire.");
  68. return 1;
  69. }
  70. new vModel;
  71. if(sscanf(params, "i", vModel))
  72. {
  73. SendPlayerMessage(playerid, Vert_SAMP"Usage", "1) Petite poubelle | 2) Grande poubelle");
  74. SendPlayerMessage(playerid, Vert_SAMP"Usage", "/creerpoubelle [IDPoubelle]");
  75. return 1;
  76. }
  77. else
  78. {
  79. if(vModel < 1 || vModel > 2)
  80. {
  81. SendPlayerMessage(playerid,Rouge_SAMP"Poubelle", "Le modèle de la poubelle dois être entre 1 et 2.");
  82. return 1;
  83. }
  84. new Float:X, Float:Y, Float:Z, Float:A;
  85. GetPlayerPos(playerid, X, Y, Z); GetPlayerFacingAngle(playerid, A);
  86. PoubelleC++;
  87. if(vModel == 1)
  88. {
  89. InfoPoubelle[PoubelleC][pPoubID] = 1339;
  90. InfoPoubelle[PoubelleC][slotsCoffre] = 5;
  91. }
  92. if(vModel == 2)
  93. {
  94. InfoPoubelle[PoubelleC][pPoubID] = 1345;
  95. InfoPoubelle[PoubelleC][slotsCoffre]= 5;
  96. }
  97. InfoPoubelle[PoubelleC][pUniqID] = PoubelleC;
  98. InfoPoubelle[PoubelleC][pSpawnX] = X;
  99. InfoPoubelle[PoubelleC][pSpawnY] = Y;
  100. InfoPoubelle[PoubelleC][pSpawnZ] = Z-1;
  101. InfoPoubelle[PoubelleC][pSpawnA] = 0.0;
  102. //InfoPoubelle[i][slotsCoffre]= dini_Int(fichier, "slotsCoffre");
  103. sauverPoubelle(PoubelleC);
  104. printf("[INFO]: Poubelle n°%d spawné.", PoubelleC);
  105. SendPlayerMessage(playerid, Bleu_SAMP"Poubelle", "Poubelle spawn avec succès.");
  106. for(new c = 0; c < MAX_POUBELLE; c++)
  107. {
  108. Delete3DTextLabel(PickupPoubelle[c]);
  109. DestroyObject(Objetps[c]);
  110. PoubelleC = 0;
  111. }
  112. chargerPoubelle();
  113. return 1;
  114. }
  115. }
  116. return 1;
  117. }
  118.  
  119.  
  120. stock afficherCoffrePoub(playerid, poubid)
  121. {
  122. new
  123. longstr[TAILLE_STRING_CLASSIC*2];
  124. longstr = "Quantité\t\tNom\n";
  125. new bID = PoubelleC;
  126. for(new c = 0; c < InfoPoubelle[bID][slotsCoffre]; c++)
  127. {
  128. if(!InfoCoffrePoub[bID][c][slotLibre] && InfoCoffrePoub[bID][c][quantite])
  129. format(longstr, TAILLE_STRING_CLASSIC*2, "%s%d\t\t%s\n", longstr, InfoCoffrePoub[bID][c][quantite], InfoCoffrePoub[bID][c][nomItem]);
  130. else
  131. format(longstr, TAILLE_STRING_CLASSIC*2, "%s("NOITEM" n°%d)\n", longstr, c);
  132. }
  133. ShowPlayerDialog(playerid, DIALOG_COFFRE400, DIALOG_STYLE_LIST, "Contenu de la poubelle", longstr, "Voir/Mettre", "Fermer");
  134. SetEVar(playerid, 0, poubid);
  135. }
Advertisement
Add Comment
Please, Sign In to add comment