Advertisement
DarkSolutions

[FS]Sistema Natal v2.0

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