View difference between Paste ID: JabYDEVF and CxQpwLrY
SHOW: | | - or go back to the newest paste.
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
Vissitem Tam Bem. www.ToTaL-SamP.com.br
8
===========================================================================*/
9
10
11
#define FILTERSCRIPT
12
13
#include <a_samp>
14
#include <streamer>
15
#include <DOF2>
16
#include <zcmd>
17
#include <sscanf2>
18
19
#define PASTA_ARVORES   "/Natal/Arvore%d.ini"
20
#define MAX_ARVORES   25
21
22
#define Vermelho        0xFF0000AA
23
24
25
forward CriarArvore(Float:X,Float:Y,Float:Z);
26
forward DeletarArvore(arvoreid);
27
forward CarregarArvores();
28
29
new Chapeu[MAX_PLAYERS];
30
new Arvore[MAX_ARVORES][4];
31
new ProximaArvore;
32
new arquivo[128];
33
new Text3D:Id[MAX_ARVORES];
34
new cmd[256];
35
36
public OnFilterScriptInit()
37
{
38
	print(" [FS] Natal Carregado");
39
    CarregarArvores();
40
    SetTimer("Mensagem",300000,1);
41
	return 1;
42
}
43
44
public OnFilterScriptExit()
45
{
46
	print(" [FS] Natal Descarregado");
47
    DOF2_Exit();
48
	return 1;
49
}
50
51
52
CMD:criararvore(playerid, params[]) {
53
	if(IsPlayerAdmin(playerid)){
54
		new Float:X,Float:Y,Float:Z;
55
		GetPlayerPos(playerid,X,Y,Z);
56
		for(new i=0;i<=MAX_ARVORES;i++){
57
			format(arquivo,sizeof(arquivo),PASTA_ARVORES,i);
58
			if(!DOF2_FileExists(arquivo)){
59
				DOF2_CreateFile(arquivo);
60
				DOF2_SetFloat(arquivo,"posX",X);
61
				DOF2_SetFloat(arquivo,"posX",X);
62
				DOF2_SetFloat(arquivo,"posY",Y);
63
				DOF2_SetFloat(arquivo,"posZ",Z);
64
				CriarArvore(X,Y,Z);
65
				SendClientMessage(playerid,-1,"Arvore Criada!");
66
				return 1;
67
			}
68
		}
69
		SendClientMessage(playerid,Vermelho,"Limite de arvores atingido!");
70
	}
71
	return 1;
72
}
73
74
75
76
CMD:excluirarvore(playerid, params[]) {
77
	if (IsPlayerAdmin(playerid)) {
78
		new arvoreid;
79
		if (sscanf(params, "d", arvoreid)) {
80
			SendClientMessage(playerid, 0x008040AA, "(ERRO) Use: /excluirarvore [id].");
81
			return 1;
82
		} else {
83
			if (arvoreid < 0 || arvoreid > MAX_ARVORES) return SendClientMessage(playerid, Vermelho, "Id Inválido!");
84
			DeletarArvore(arvoreid);
85
			SendClientMessage(playerid, -1, "Arvore Excluida!");
86
		}
87
	}
88
 	return 1;
89
}
90
91
CMD:comandosnatal(playerid, params[]) {
92
	if(IsPlayerAdmin(playerid)){
93
		SendClientMessage(playerid,0xFF0000AA,"========== Comandos Natal ===========");
94
		SendClientMessage(playerid,0xFFFFFFAA,"/criararvore");
95
		SendClientMessage(playerid,0xFFFFFFAA,"/excluirarvore");
96
		SendClientMessage(playerid,0xFFFFFFAA,"/mostrarids  -  /ocultarids");
97
		SendClientMessage(playerid,0xFF0000AA,"========== Comandos Natal ===========");
98
	}
99
	return 1;
100
}
101
102
103
CMD:chapeu(playerid, params[]) {
104
	if(Chapeu[playerid]==0){
105
		SetPlayerAttachedObject(playerid,1,19066,2,0.13,0.0,0.0,90,90.0,0.0);
106-
		SendClientMessage(playerid,-1,"Chapéu de Natal On");
106+
107
		SendClientMessage(playerid,-1,"On");
108
		}else{
109-
		SendClientMessage(playerid,-1,"Chapéu de Natal Off");
109+
110-
        Chapeu[playerid] = 0;
110+
		SendClientMessage(playerid,-1,"Off");
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
}