View difference between Paste ID: efge9XXe and yqvkSHY9
SHOW: | | - or go back to the newest paste.
1
//---------- GangZones
2
new ParkGlen;
3
new DonoParkGlen;
4
new PontosAtaque;
5
new PontosDefesa;
6
new OrgAtaque;
7
new OrgDefesa;
8
new Guerra; 
9
new PlayerText:Text_Guerra[MAX_PLAYERS][7];
10
11
#define ZoneParkGlen 1857.559570, -1254.249023, 2060.889160, -1142.216430
12
13
#define Cor_Policia 0x28D4FA99
14
15
#define Cor_TropaCalvo 0xFF004099
16
17
public OnGameModeInit()
18
{
19
	Guerra = 0;
20
	//-------Gangzone
21
	ParkGlen = GangZoneCreate(ZoneParkGlen);
22
	return 1;
23
}
24
25
public OnPlayerDeath(playerid, killerid, reason)
26
{
27
	if(DentroGangZone(playerid, ZoneParkGlen) && Guerra == 1)
28
	{
29
		if(Player[playerid][Organizacao] == OrgAtaque)
30
		{
31
			PontosDefesa += 1;
32
			new str[50];
33
			format(str, 50, "%02d_Pontos", PontosDefesa);
34
			for(new i = 0; i < MAX_PLAYERS; i++)
35
			{
36
				if(Player[i][Organizacao] == OrgAtaque || Player[i][Organizacao] == OrgDefesa)
37
				{
38
					PlayerTextDrawSetString(i, Text_Guerra[i][5], str);
39
					PlayerTextDrawShow(i, Text_Guerra[i][5]);
40
				}
41
			}
42
		}
43
	}
44
	if(DentroGangZone(playerid, ZoneParkGlen) && Guerra == 1)
45
	{
46
		if(Player[playerid][Organizacao] == OrgDefesa)
47
		{
48
			PontosAtaque += 1;
49
			new str[50];
50
			format(str, 50, "%02d_Pontos", PontosAtaque);
51
			for(new i = 0; i < MAX_PLAYERS; i++)
52
			{
53
				if(Player[i][Organizacao] == OrgAtaque || Player[i][Organizacao] == OrgDefesa)
54
				{
55
					PlayerTextDrawSetString(i, Text_Guerra[i][6], str);
56
					PlayerTextDrawShow(i, Text_Guerra[i][6]);
57
				}
58
			}
59
		}
60
	}
61
	return 1;
62
}
63
64
public OnPlayerConnect(playerid)
65
{
66
	switch(DonoParkGlen)
67
	{
68
		case 0:
69
		{
70
			GangZoneShowForPlayer(playerid, ParkGlen, 0xFFFFFF99);
71
		}
72
		case 1:
73
		{
74
			GangZoneShowForPlayer(playerid, ParkGlen, Cor_Policia);
75
		}
76
		case 2:
77
		{
78
			GangZoneShowForPlayer(playerid, ParkGlen, Cor_TropaCalvo);
79
		}
80
	}
81
	
82
	Text_Guerra[playerid][0] = CreatePlayerTextDraw(playerid, -14.333334, 254.711135, "box");
83
	PlayerTextDrawLetterSize(playerid, Text_Guerra[playerid][0], 0.000000, 7.433329);
84
	PlayerTextDrawTextSize(playerid, Text_Guerra[playerid][0], 123.000000, 0.000000);
85
	PlayerTextDrawAlignment(playerid, Text_Guerra[playerid][0], 1);
86
	PlayerTextDrawColor(playerid, Text_Guerra[playerid][0], -1);
87
	PlayerTextDrawUseBox(playerid, Text_Guerra[playerid][0], 1);
88
	PlayerTextDrawBoxColor(playerid, Text_Guerra[playerid][0], 139);
89
	PlayerTextDrawSetShadow(playerid, Text_Guerra[playerid][0], 0);
90
	PlayerTextDrawBackgroundColor(playerid, Text_Guerra[playerid][0], 255);
91
	PlayerTextDrawFont(playerid, Text_Guerra[playerid][0], 1);
92
	PlayerTextDrawSetProportional(playerid, Text_Guerra[playerid][0], 1);
93
94
	Text_Guerra[playerid][1] = CreatePlayerTextDraw(playerid, 37.000015, 253.881515, "Park_Glen");
95
	PlayerTextDrawLetterSize(playerid, Text_Guerra[playerid][1], 0.251332, 1.056592);
96
	PlayerTextDrawAlignment(playerid, Text_Guerra[playerid][1], 1);
97
	PlayerTextDrawColor(playerid, Text_Guerra[playerid][1], -1);
98
	PlayerTextDrawSetShadow(playerid, Text_Guerra[playerid][1], 0);
99
	PlayerTextDrawSetOutline(playerid, Text_Guerra[playerid][1], 1);
100
	PlayerTextDrawBackgroundColor(playerid, Text_Guerra[playerid][1], 255);
101
	PlayerTextDrawFont(playerid, Text_Guerra[playerid][1], 1);
102
	PlayerTextDrawSetProportional(playerid, Text_Guerra[playerid][1], 1);
103
104
	Text_Guerra[playerid][2] = CreatePlayerTextDraw(playerid, 3.333345, 284.992492, "organizacao1:");
105
	PlayerTextDrawLetterSize(playerid, Text_Guerra[playerid][2], 0.158665, 1.010962);
106
	PlayerTextDrawAlignment(playerid, Text_Guerra[playerid][2], 1);
107
	PlayerTextDrawColor(playerid, Text_Guerra[playerid][2], -1);
108
	PlayerTextDrawSetShadow(playerid, Text_Guerra[playerid][2], 1);
109
	PlayerTextDrawBackgroundColor(playerid, Text_Guerra[playerid][2], 255);
110
	PlayerTextDrawFont(playerid, Text_Guerra[playerid][2], 2);
111
	PlayerTextDrawSetProportional(playerid, Text_Guerra[playerid][2], 1);
112
113
	Text_Guerra[playerid][3] = CreatePlayerTextDraw(playerid, 3.000013, 304.488922, "organizacao2:");
114
	PlayerTextDrawLetterSize(playerid, Text_Guerra[playerid][3], 0.158665, 1.010962);
115
	PlayerTextDrawAlignment(playerid, Text_Guerra[playerid][3], 1);
116
	PlayerTextDrawColor(playerid, Text_Guerra[playerid][3], -1);
117
	PlayerTextDrawSetShadow(playerid, Text_Guerra[playerid][3], 1);
118
	PlayerTextDrawBackgroundColor(playerid, Text_Guerra[playerid][3], 255);
119
	PlayerTextDrawFont(playerid, Text_Guerra[playerid][3], 2);
120
	PlayerTextDrawSetProportional(playerid, Text_Guerra[playerid][3], 1);
121
122
	Text_Guerra[playerid][4] = CreatePlayerTextDraw(playerid, 16.333349, 267.155639, "dominacao_de_territorio");
123
	PlayerTextDrawLetterSize(playerid, Text_Guerra[playerid][4], 0.152333, 0.820147);
124
	PlayerTextDrawAlignment(playerid, Text_Guerra[playerid][4], 1);
125
	PlayerTextDrawColor(playerid, Text_Guerra[playerid][4], -65281);
126
	PlayerTextDrawSetShadow(playerid, Text_Guerra[playerid][4], 0);
127
	PlayerTextDrawBackgroundColor(playerid, Text_Guerra[playerid][4], 255);
128
	PlayerTextDrawFont(playerid, Text_Guerra[playerid][4], 2);
129
	PlayerTextDrawSetProportional(playerid, Text_Guerra[playerid][4], 1);
130
131
	Text_Guerra[playerid][5] = CreatePlayerTextDraw(playerid, 77.333343, 285.407318, "00_pontos");
132
	PlayerTextDrawLetterSize(playerid, Text_Guerra[playerid][5], 0.158665, 1.010962);
133
	PlayerTextDrawAlignment(playerid, Text_Guerra[playerid][5], 1);
134
	PlayerTextDrawColor(playerid, Text_Guerra[playerid][5], -5963521);
135
	PlayerTextDrawSetShadow(playerid, Text_Guerra[playerid][5], 1);
136
	PlayerTextDrawBackgroundColor(playerid, Text_Guerra[playerid][5], 255);
137
	PlayerTextDrawFont(playerid, Text_Guerra[playerid][5], 2);
138
	PlayerTextDrawSetProportional(playerid, Text_Guerra[playerid][5], 1);
139
140
	Text_Guerra[playerid][6] = CreatePlayerTextDraw(playerid, 76.333358, 304.488739, "00_pontos");
141
	PlayerTextDrawLetterSize(playerid, Text_Guerra[playerid][6], 0.158665, 1.010962);
142
	PlayerTextDrawAlignment(playerid, Text_Guerra[playerid][6], 1);
143
	PlayerTextDrawColor(playerid, Text_Guerra[playerid][6], -2132541185);
144
	PlayerTextDrawSetShadow(playerid, Text_Guerra[playerid][6], 1);
145
	PlayerTextDrawBackgroundColor(playerid, Text_Guerra[playerid][6], 255);
146
	PlayerTextDrawFont(playerid, Text_Guerra[playerid][6], 2);
147
	PlayerTextDrawSetProportional(playerid, Text_Guerra[playerid][6], 1);
148
	return 1;
149
}
150
151
stock CarregarGangZones()
152
{
153
	new str[15];
154
	format(str, 15, "GangZones.ini");
155
	DonoParkGlen = dini_Int(str, "ParkGlen");
156
	return 1;
157
}
158
stock SalvarGangZones()
159
{
160
	new str[15];
161
	format(str, 15, "GangZones.ini");
162
	if(!dini_Exists(str)) dini_Create(str);
163
	dini_IntSet(str, "ParkGlen", DonoParkGlen);
164
	return 1;
165
}
166
167
stock DentroGangZone(playerid, Float:XMin, Float:YMin, Float:XMax, Float:YMax)
168
{
169
    new
170
        RetValue = 0,
171
        Float:aX,
172
        Float:aY,
173
        Float:aZ
174
    ;
175
    GetPlayerPos( playerid, aX, aY, aZ );
176
    if( aX >= XMin && aY >= YMin && aX < XMax && aY < YMax )
177
    {
178
        RetValue = 1;
179
    }
180
    return RetValue;
181
} 
182
183
stock AtualizarGangZones()
184
{
185
	if(DonoParkGlen == 0) GangZoneShowForAll(ParkGlen, 0xFFFFFF99);
186
	if(DonoParkGlen == 1) GangZoneShowForAll(ParkGlen, Cor_Policia);
187
	if(DonoParkGlen == 2) GangZoneShowForAll(ParkGlen, Cor_TropaCalvo);
188
	return 1;
189
}
190
191
stock GetNomeOrg(orgid)
192
{
193
	new str[20];
194
	if(orgid == 1)
195
	{
196
		str = "Policia Militar";
197
	}
198
	if(orgid == 2)
199
	{
200
		str = "Tropa Calvo";
201
	}
202
	return str;
203
}
204
205
CMD:dominar(playerid)
206
{
207
	if(Player[playerid][Organizacao] == 0) return SendClientMessage(playerid, -1, "Voce nao participa de nenhuma organizacao");
208
	if(Guerra == 1) return SendClientMessage(playerid, -1, "Ja existe uma guerra em andamento");
209
	if(DentroGangZone(playerid, ZoneParkGlen))
210
	{
211
		if(DonoParkGlen == 0)
212
		{
213
			DonoParkGlen = Player[playerid][Organizacao];
214
			new str[100];
215
			format(str, 100, "A organizacao %s dominou o park glen", GetNomeOrg(Player[playerid][Organizacao]));
216
			SendClientMessageToAll(-1, str);
217
			SalvarGangZones();
218
			AtualizarGangZones();
219
		}
220
		if(DonoParkGlen > 0)
221
		{
222
			if(DonoParkGlen == Player[playerid][Organizacao]) return SendClientMessage(playerid, -1, "Sua organizacao ja tem a posse deste territorio");
223
			new str[100];
224
			format(str, 100, "A organizacao %s, esta tentando dominar o Park Glen", GetNomeOrg(Player[playerid][Organizacao]));
225
			SendClientMessageToAll(-1, str);
226
			SetTimer("AcabarGuerra", 30000, false);
227
			OrgAtaque = Player[playerid][Organizacao];
228
			OrgDefesa = DonoParkGlen;
229
			Guerra = 1;
230
			if(Player[playerid][Organizacao] == 1) GangZoneFlashForAll(ParkGlen, Cor_Policia);
231
			if(Player[playerid][Organizacao] == 2) GangZoneFlashForAll(ParkGlen, Cor_TropaCalvo);
232
			for(new i = 0; i < MAX_PLAYERS; i++)
233
			{
234
				if(Player[i][Organizacao] == OrgAtaque || Player[i][Organizacao] == OrgDefesa)
235
				{
236
					format(str, 50, "%s", GetNomeOrg(OrgDefesa));
237
					PlayerTextDrawSetString(i, Text_Guerra[i][2], str);
238
239
					format(str, 50, "%s", GetNomeOrg(OrgAtaque));
240
					PlayerTextDrawSetString(i, Text_Guerra[i][3], str);
241
242
					PlayerTextDrawSetString(i, Text_Guerra[i][1], "Park_Glen");
243
					for(new x = 0; x < 7; x++) PlayerTextDrawShow(i, Text_Guerra[i][x]);
244
				}
245
			}
246
		}
247
	}
248
	return 1;
249
}
250
forward AcabarGuerra();
251
public AcabarGuerra()
252
{
253
	Guerra = 0;
254
	if(PontosAtaque > PontosDefesa)
255
	{
256
		DonoParkGlen = OrgAtaque;
257
		SalvarGangZones();
258
		AtualizarGangZones();
259
		GangZoneStopFlashForAll(ParkGlen);
260
		new str[120];
261
		format(str, 120, "A organizacao %s dominou o territorio", GetNomeOrg(OrgAtaque));
262
		SendClientMessageToAll(-1, str);
263
		for(new i = 0; i < MAX_PLAYERS; i++)
264
		{
265
			if(Player[i][Organizacao] == OrgAtaque || Player[i][Organizacao] == OrgDefesa)
266
			{
267
				for(new x = 0; x < 7; x++) PlayerTextDrawHide(i, Text_Guerra[i][x]);
268
			}
269
		}
270
	}
271
	if(PontosDefesa > PontosAtaque)
272
	{
273
		DonoParkGlen = OrgDefesa;
274
		SalvarGangZones();
275
		AtualizarGangZones();
276
		GangZoneStopFlashForAll(ParkGlen);
277
		new str[120];
278
		format(str, 120, "A organizacao %s dominou o territorio", GetNomeOrg(OrgDefesa));
279
		SendClientMessageToAll(-1, str);
280
		for(new i = 0; i < MAX_PLAYERS; i++)
281
		{
282
			if(Player[i][Organizacao] == OrgAtaque || Player[i][Organizacao] == OrgDefesa)
283
			{
284
				for(new x = 0; x < 7; x++) PlayerTextDrawHide(i, Text_Guerra[i][x]);
285
			}
286
		}
287
	}
288
	if(PontosDefesa == PontosAtaque)
289
	{
290
		DonoParkGlen = 0;
291
		SalvarGangZones();
292
		AtualizarGangZones();
293
		GangZoneStopFlashForAll(ParkGlen);
294
		SendClientMessageToAll(-1, "Nenhuma organizacao dominou o territorio");
295
		for(new i = 0; i < MAX_PLAYERS; i++)
296
		{
297
			if(Player[i][Organizacao] == OrgAtaque || Player[i][Organizacao] == OrgDefesa)
298
			{
299
				for(new x = 0; x < 7; x++) PlayerTextDrawHide(i, Text_Guerra[i][x]);
300
			}
301
		}
302
	}
303
	return 1;
304
}