Advertisement
nrgrpgbrasil

[FS] Natal Dark

Dec 13th, 2020
731
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 5.30 KB | None | 0 0
  1. /*===========================================================================
  2.            [NRG]Dark
  3.                    dark_eagn@hotmail.com
  4.                         Discord: DarK!#4052
  5. ===========================================================================*/
  6.  
  7.  
  8. #define FILTERSCRIPT
  9.  
  10. #include <a_samp>
  11. #include <streamer>
  12. #include <DOF2>
  13. #include <zcmd>
  14. #include <sscanf2>
  15.  
  16. #define PASTA_ARVORES   "/Natal/Arvore%d.ini"
  17. #define MAX_ARVORES   25
  18.  
  19. #define Vermelho        0xFF0000AA
  20.  
  21.  
  22. forward CriarArvore(Float:X,Float:Y,Float:Z);
  23. forward DeletarArvore(arvoreid);
  24. forward CarregarArvores();
  25.  
  26. new Chapeu[MAX_PLAYERS];
  27. new Arvore[MAX_ARVORES][4];
  28. new ProximaArvore;
  29. new arquivo[128];
  30. new Text3D:Id[MAX_ARVORES];
  31. new cmd[256];
  32.  
  33. public OnFilterScriptInit()
  34. {
  35.     print(" [FS] Natal Carregado");
  36.     CarregarArvores();
  37.     SetTimer("Mensagem",300000,1);
  38.     return 1;
  39. }
  40.  
  41. public OnFilterScriptExit()
  42. {
  43.     print(" [FS] Natal Descarregado");
  44.     DOF2_Exit();
  45.     return 1;
  46. }
  47.  
  48.  
  49. CMD:criararvore(playerid, params[]) {
  50.     if(IsPlayerAdmin(playerid)){
  51.         new Float:X,Float:Y,Float:Z;
  52.         GetPlayerPos(playerid,X,Y,Z);
  53.         for(new i=0;i<=MAX_ARVORES;i++){
  54.             format(arquivo,sizeof(arquivo),PASTA_ARVORES,i);
  55.             if(!DOF2_FileExists(arquivo)){
  56.                 DOF2_CreateFile(arquivo);
  57.                 DOF2_SetFloat(arquivo,"posX",X);
  58.                 DOF2_SetFloat(arquivo,"posX",X);
  59.                 DOF2_SetFloat(arquivo,"posY",Y);
  60.                 DOF2_SetFloat(arquivo,"posZ",Z);
  61.                 CriarArvore(X,Y,Z);
  62.                 SendClientMessage(playerid,-1,"Arvore Criada!");
  63.                 return 1;
  64.             }
  65.         }
  66.         SendClientMessage(playerid,Vermelho,"Limite de arvores atingido!");
  67.     }
  68.     return 1;
  69. }
  70.  
  71.  
  72.  
  73. CMD:excluirarvore(playerid, params[]) {
  74.     if (IsPlayerAdmin(playerid)) {
  75.         new arvoreid;
  76.         if (sscanf(params, "d", arvoreid)) {
  77.             SendClientMessage(playerid, 0x008040AA, "(ERRO) Use: /excluirarvore [id].");
  78.             return 1;
  79.         } else {
  80.             if (arvoreid < 0 || arvoreid > MAX_ARVORES) return SendClientMessage(playerid, Vermelho, "Id Inválido!");
  81.             DeletarArvore(arvoreid);
  82.             SendClientMessage(playerid, -1, "Arvore Excluida!");
  83.         }
  84.     }
  85.     return 1;
  86. }
  87.  
  88. CMD:comandosnatal(playerid, params[]) {
  89.     if(IsPlayerAdmin(playerid)){
  90.         SendClientMessage(playerid,0xFF0000AA,"========== Comandos Natal ===========");
  91.         SendClientMessage(playerid,0xFFFFFFAA,"/criararvore");
  92.         SendClientMessage(playerid,0xFFFFFFAA,"/excluirarvore");
  93.         SendClientMessage(playerid,0xFFFFFFAA,"/mostrarids  -  /ocultarids");
  94.         SendClientMessage(playerid,0xFF0000AA,"========== Comandos Natal ===========");
  95.     }
  96.     return 1;
  97. }
  98.  
  99.  
  100. CMD:chapeu(playerid, params[]) {
  101.     if(Chapeu[playerid]==0){
  102.         SetPlayerAttachedObject(playerid,1,19066,2,0.13,0.0,0.0,90,90.0,0.0);
  103.         Chapeu[playerid] = 1;
  104.         SendClientMessage(playerid,-1,"Chapéu de Natal On");
  105.         }else{
  106.         RemovePlayerAttachedObject(playerid,1);
  107.         SendClientMessage(playerid,-1,"Chapéu de Natal Off");
  108.         Chapeu[playerid] = 0;
  109.     }
  110.     return 1;
  111. }
  112.  
  113. CMD:ocultarids(playerid, params[]) {
  114.     if(IsPlayerAdmin(playerid)){
  115.         OcultarIds();
  116.         SendClientMessage(playerid,-1,"Ids Ocultados!");
  117.     }
  118.     return 1;
  119. }
  120.  
  121. CMD:mostrarids(playerid, params[]) {
  122.     if(IsPlayerAdmin(playerid)){
  123.         MostrarIds();
  124.         SendClientMessage(playerid,-1,"Ids Exibidos!");
  125.     }
  126.     return 1;
  127. }
  128.  
  129.  
  130.  
  131. public CriarArvore(Float:X,Float:Y,Float:Z)
  132. {
  133.     Arvore[ProximaArvore][0] = CreateDynamicObject(19076, X-0.39, Y+0.67, Z-0.9,   0.00, 0.00, 0.00); //Arvore
  134.     Arvore[ProximaArvore][1] = CreateDynamicObject(19056, X-1.39, Y+0.10, Z-0.2,   0.00, 0.00, 0.00);
  135.     Arvore[ProximaArvore][2] = CreateDynamicObject(19057, X+1.39, Y+0.45, Z-0.2,   0.00, 0.00, 0.00);
  136.     Arvore[ProximaArvore][3] = CreateDynamicObject(19054, X-0.07, Y-0.67, Z-0.2,   0.00, 0.00, 0.00);
  137.     ProximaArvore++;
  138.     return (ProximaArvore-1);
  139. }
  140.  
  141. public DeletarArvore(arvoreid)
  142. {
  143.     DestroyDynamicObject(Arvore[arvoreid][0]);
  144.     DestroyDynamicObject(Arvore[arvoreid][1]);
  145.     DestroyDynamicObject(Arvore[arvoreid][2]);
  146.     DestroyDynamicObject(Arvore[arvoreid][3]);
  147.     format(arquivo,128,PASTA_ARVORES,arvoreid);
  148.     DOF2_RemoveFile(arquivo);
  149.     ProximaArvore--;
  150.     return 1;
  151. }
  152.  
  153. public CarregarArvores()
  154. {
  155.     new string[128];
  156.     new counter;
  157.     for(new i=0;i<=MAX_ARVORES;i++){
  158.         format(string,sizeof(string),PASTA_ARVORES,i);
  159.         if(DOF2_FileExists(string)){
  160.              CriarArvore(DOF2_GetFloat(string,"posX"),DOF2_GetFloat(string,"posY"),DOF2_GetFloat(string,"posZ"));
  161.              counter++;
  162.         }
  163.     }
  164.     format(string,sizeof(string),"%d árvores de natal carregadas!!",counter);
  165.     if(counter>0) print(string);
  166.     return 1;
  167. }
  168.  
  169. stock MostrarIds()
  170. {
  171.     new str[50];
  172.     for(new i=0;i<=MAX_ARVORES;i++){
  173.         format(arquivo,128,PASTA_ARVORES,i);
  174.         if(DOF2_FileExists(arquivo)){
  175.             format(str,50,"Arvore id: %d",i);
  176.             Id[i] = Create3DTextLabel(str,0xFFFF80AA,DOF2_GetFloat(arquivo,"posX"),DOF2_GetFloat(arquivo,"posY"),DOF2_GetFloat(arquivo,"posZ"),20.0,0);
  177.         }
  178.     }
  179.     return 1;
  180. }
  181.  
  182. stock OcultarIds()
  183. {
  184.     for(new i=0;i<=MAX_ARVORES;i++){
  185.         Delete3DTextLabel(Id[i]);
  186.     }
  187.     return 1;
  188. }
  189.  
  190. forward Mensagem();
  191. public Mensagem(){
  192.     SendClientMessageToAll(0xFF8000AA,"Nossa Equipe deseja a todos um Feliz Natal!! Use /chapeu");
  193.     return 1;
  194. }
  195.  
  196.  
  197. public OnPlayerCommandReceived(playerid, cmdtext[])
  198. {
  199.     cmd = #;
  200.     strcat(cmd, cmdtext);
  201.     return 1;
  202. }
  203.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement