Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //---------- GangZones
- new ParkGlen;
- new DonoParkGlen;
- new PontosAtaque;
- new PontosDefesa;
- new OrgAtaque;
- new OrgDefesa;
- new Guerra;
- new PlayerText:Text_Guerra[MAX_PLAYERS][7];
- #define ZoneParkGlen 1857.559570, -1254.249023, 2060.889160, -1142.216430
- #define Cor_Policia 0x28D4FA99
- #define Cor_TropaCalvo 0xFF004099
- public OnGameModeInit()
- {
- Guerra = 0;
- //-------Gangzone
- ParkGlen = GangZoneCreate(ZoneParkGlen);
- return 1;
- }
- public OnPlayerDeath(playerid, killerid, reason)
- {
- if(DentroGangZone(playerid, ZoneParkGlen) && Guerra == 1)
- {
- if(Player[playerid][Organizacao] == OrgAtaque)
- {
- PontosDefesa += 1;
- new str[50];
- format(str, 50, "%02d_Pontos", PontosDefesa);
- for(new i = 0; i < MAX_PLAYERS; i++)
- {
- if(Player[i][Organizacao] == OrgAtaque || Player[i][Organizacao] == OrgDefesa)
- {
- PlayerTextDrawSetString(i, Text_Guerra[i][5], str);
- PlayerTextDrawShow(i, Text_Guerra[i][5]);
- }
- }
- }
- }
- if(DentroGangZone(playerid, ZoneParkGlen) && Guerra == 1)
- {
- if(Player[playerid][Organizacao] == OrgDefesa)
- {
- PontosAtaque += 1;
- new str[50];
- format(str, 50, "%02d_Pontos", PontosAtaque);
- for(new i = 0; i < MAX_PLAYERS; i++)
- {
- if(Player[i][Organizacao] == OrgAtaque || Player[i][Organizacao] == OrgDefesa)
- {
- PlayerTextDrawSetString(i, Text_Guerra[i][6], str);
- PlayerTextDrawShow(i, Text_Guerra[i][6]);
- }
- }
- }
- }
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- switch(DonoParkGlen)
- {
- case 0:
- {
- GangZoneShowForPlayer(playerid, ParkGlen, 0xFFFFFF99);
- }
- case 1:
- {
- GangZoneShowForPlayer(playerid, ParkGlen, Cor_Policia);
- }
- case 2:
- {
- GangZoneShowForPlayer(playerid, ParkGlen, Cor_TropaCalvo);
- }
- }
- Text_Guerra[playerid][0] = CreatePlayerTextDraw(playerid, -14.333334, 254.711135, "box");
- PlayerTextDrawLetterSize(playerid, Text_Guerra[playerid][0], 0.000000, 7.433329);
- PlayerTextDrawTextSize(playerid, Text_Guerra[playerid][0], 123.000000, 0.000000);
- PlayerTextDrawAlignment(playerid, Text_Guerra[playerid][0], 1);
- PlayerTextDrawColor(playerid, Text_Guerra[playerid][0], -1);
- PlayerTextDrawUseBox(playerid, Text_Guerra[playerid][0], 1);
- PlayerTextDrawBoxColor(playerid, Text_Guerra[playerid][0], 139);
- PlayerTextDrawSetShadow(playerid, Text_Guerra[playerid][0], 0);
- PlayerTextDrawBackgroundColor(playerid, Text_Guerra[playerid][0], 255);
- PlayerTextDrawFont(playerid, Text_Guerra[playerid][0], 1);
- PlayerTextDrawSetProportional(playerid, Text_Guerra[playerid][0], 1);
- Text_Guerra[playerid][1] = CreatePlayerTextDraw(playerid, 37.000015, 253.881515, "Park_Glen");
- PlayerTextDrawLetterSize(playerid, Text_Guerra[playerid][1], 0.251332, 1.056592);
- PlayerTextDrawAlignment(playerid, Text_Guerra[playerid][1], 1);
- PlayerTextDrawColor(playerid, Text_Guerra[playerid][1], -1);
- PlayerTextDrawSetShadow(playerid, Text_Guerra[playerid][1], 0);
- PlayerTextDrawSetOutline(playerid, Text_Guerra[playerid][1], 1);
- PlayerTextDrawBackgroundColor(playerid, Text_Guerra[playerid][1], 255);
- PlayerTextDrawFont(playerid, Text_Guerra[playerid][1], 1);
- PlayerTextDrawSetProportional(playerid, Text_Guerra[playerid][1], 1);
- Text_Guerra[playerid][2] = CreatePlayerTextDraw(playerid, 3.333345, 284.992492, "organizacao1:");
- PlayerTextDrawLetterSize(playerid, Text_Guerra[playerid][2], 0.158665, 1.010962);
- PlayerTextDrawAlignment(playerid, Text_Guerra[playerid][2], 1);
- PlayerTextDrawColor(playerid, Text_Guerra[playerid][2], -1);
- PlayerTextDrawSetShadow(playerid, Text_Guerra[playerid][2], 1);
- PlayerTextDrawBackgroundColor(playerid, Text_Guerra[playerid][2], 255);
- PlayerTextDrawFont(playerid, Text_Guerra[playerid][2], 2);
- PlayerTextDrawSetProportional(playerid, Text_Guerra[playerid][2], 1);
- Text_Guerra[playerid][3] = CreatePlayerTextDraw(playerid, 3.000013, 304.488922, "organizacao2:");
- PlayerTextDrawLetterSize(playerid, Text_Guerra[playerid][3], 0.158665, 1.010962);
- PlayerTextDrawAlignment(playerid, Text_Guerra[playerid][3], 1);
- PlayerTextDrawColor(playerid, Text_Guerra[playerid][3], -1);
- PlayerTextDrawSetShadow(playerid, Text_Guerra[playerid][3], 1);
- PlayerTextDrawBackgroundColor(playerid, Text_Guerra[playerid][3], 255);
- PlayerTextDrawFont(playerid, Text_Guerra[playerid][3], 2);
- PlayerTextDrawSetProportional(playerid, Text_Guerra[playerid][3], 1);
- Text_Guerra[playerid][4] = CreatePlayerTextDraw(playerid, 16.333349, 267.155639, "dominacao_de_territorio");
- PlayerTextDrawLetterSize(playerid, Text_Guerra[playerid][4], 0.152333, 0.820147);
- PlayerTextDrawAlignment(playerid, Text_Guerra[playerid][4], 1);
- PlayerTextDrawColor(playerid, Text_Guerra[playerid][4], -65281);
- PlayerTextDrawSetShadow(playerid, Text_Guerra[playerid][4], 0);
- PlayerTextDrawBackgroundColor(playerid, Text_Guerra[playerid][4], 255);
- PlayerTextDrawFont(playerid, Text_Guerra[playerid][4], 2);
- PlayerTextDrawSetProportional(playerid, Text_Guerra[playerid][4], 1);
- Text_Guerra[playerid][5] = CreatePlayerTextDraw(playerid, 77.333343, 285.407318, "00_pontos");
- PlayerTextDrawLetterSize(playerid, Text_Guerra[playerid][5], 0.158665, 1.010962);
- PlayerTextDrawAlignment(playerid, Text_Guerra[playerid][5], 1);
- PlayerTextDrawColor(playerid, Text_Guerra[playerid][5], -5963521);
- PlayerTextDrawSetShadow(playerid, Text_Guerra[playerid][5], 1);
- PlayerTextDrawBackgroundColor(playerid, Text_Guerra[playerid][5], 255);
- PlayerTextDrawFont(playerid, Text_Guerra[playerid][5], 2);
- PlayerTextDrawSetProportional(playerid, Text_Guerra[playerid][5], 1);
- Text_Guerra[playerid][6] = CreatePlayerTextDraw(playerid, 76.333358, 304.488739, "00_pontos");
- PlayerTextDrawLetterSize(playerid, Text_Guerra[playerid][6], 0.158665, 1.010962);
- PlayerTextDrawAlignment(playerid, Text_Guerra[playerid][6], 1);
- PlayerTextDrawColor(playerid, Text_Guerra[playerid][6], -2132541185);
- PlayerTextDrawSetShadow(playerid, Text_Guerra[playerid][6], 1);
- PlayerTextDrawBackgroundColor(playerid, Text_Guerra[playerid][6], 255);
- PlayerTextDrawFont(playerid, Text_Guerra[playerid][6], 2);
- PlayerTextDrawSetProportional(playerid, Text_Guerra[playerid][6], 1);
- return 1;
- }
- stock CarregarGangZones()
- {
- new str[15];
- format(str, 15, "GangZones.ini");
- DonoParkGlen = dini_Int(str, "ParkGlen");
- return 1;
- }
- stock SalvarGangZones()
- {
- new str[15];
- format(str, 15, "GangZones.ini");
- if(!dini_Exists(str)) dini_Create(str);
- dini_IntSet(str, "ParkGlen", DonoParkGlen);
- return 1;
- }
- stock DentroGangZone(playerid, Float:XMin, Float:YMin, Float:XMax, Float:YMax)
- {
- new
- RetValue = 0,
- Float:aX,
- Float:aY,
- Float:aZ
- ;
- GetPlayerPos( playerid, aX, aY, aZ );
- if( aX >= XMin && aY >= YMin && aX < XMax && aY < YMax )
- {
- RetValue = 1;
- }
- return RetValue;
- }
- stock AtualizarGangZones()
- {
- if(DonoParkGlen == 0) GangZoneShowForAll(ParkGlen, 0xFFFFFF99);
- if(DonoParkGlen == 1) GangZoneShowForAll(ParkGlen, Cor_Policia);
- if(DonoParkGlen == 2) GangZoneShowForAll(ParkGlen, Cor_TropaCalvo);
- return 1;
- }
- stock GetNomeOrg(orgid)
- {
- new str[20];
- if(orgid == 1)
- {
- str = "Policia Militar";
- }
- if(orgid == 2)
- {
- str = "Tropa Calvo";
- }
- return str;
- }
- CMD:dominar(playerid)
- {
- if(Player[playerid][Organizacao] == 0) return SendClientMessage(playerid, -1, "Voce nao participa de nenhuma organizacao");
- if(Guerra == 1) return SendClientMessage(playerid, -1, "Ja existe uma guerra em andamento");
- if(DentroGangZone(playerid, ZoneParkGlen))
- {
- if(DonoParkGlen == 0)
- {
- DonoParkGlen = Player[playerid][Organizacao];
- new str[100];
- format(str, 100, "A organizacao %s dominou o park glen", GetNomeOrg(Player[playerid][Organizacao]));
- SendClientMessageToAll(-1, str);
- SalvarGangZones();
- AtualizarGangZones();
- }
- if(DonoParkGlen > 0)
- {
- if(DonoParkGlen == Player[playerid][Organizacao]) return SendClientMessage(playerid, -1, "Sua organizacao ja tem a posse deste territorio");
- new str[100];
- format(str, 100, "A organizacao %s, esta tentando dominar o Park Glen", GetNomeOrg(Player[playerid][Organizacao]));
- SendClientMessageToAll(-1, str);
- SetTimer("AcabarGuerra", 30000, false);
- OrgAtaque = Player[playerid][Organizacao];
- OrgDefesa = DonoParkGlen;
- Guerra = 1;
- if(Player[playerid][Organizacao] == 1) GangZoneFlashForAll(ParkGlen, Cor_Policia);
- if(Player[playerid][Organizacao] == 2) GangZoneFlashForAll(ParkGlen, Cor_TropaCalvo);
- for(new i = 0; i < MAX_PLAYERS; i++)
- {
- if(Player[i][Organizacao] == OrgAtaque || Player[i][Organizacao] == OrgDefesa)
- {
- format(str, 50, "%s", GetNomeOrg(OrgDefesa));
- PlayerTextDrawSetString(i, Text_Guerra[i][2], str);
- format(str, 50, "%s", GetNomeOrg(OrgAtaque));
- PlayerTextDrawSetString(i, Text_Guerra[i][3], str);
- PlayerTextDrawSetString(i, Text_Guerra[i][1], "Park_Glen");
- for(new x = 0; x < 7; x++) PlayerTextDrawShow(i, Text_Guerra[i][x]);
- }
- }
- }
- }
- return 1;
- }
- forward AcabarGuerra();
- public AcabarGuerra()
- {
- Guerra = 0;
- if(PontosAtaque > PontosDefesa)
- {
- DonoParkGlen = OrgAtaque;
- SalvarGangZones();
- AtualizarGangZones();
- GangZoneStopFlashForAll(ParkGlen);
- new str[120];
- format(str, 120, "A organizacao %s dominou o territorio", GetNomeOrg(OrgAtaque));
- SendClientMessageToAll(-1, str);
- for(new i = 0; i < MAX_PLAYERS; i++)
- {
- if(Player[i][Organizacao] == OrgAtaque || Player[i][Organizacao] == OrgDefesa)
- {
- for(new x = 0; x < 7; x++) PlayerTextDrawHide(i, Text_Guerra[i][x]);
- }
- }
- }
- if(PontosDefesa > PontosAtaque)
- {
- DonoParkGlen = OrgDefesa;
- SalvarGangZones();
- AtualizarGangZones();
- GangZoneStopFlashForAll(ParkGlen);
- new str[120];
- format(str, 120, "A organizacao %s dominou o territorio", GetNomeOrg(OrgDefesa));
- SendClientMessageToAll(-1, str);
- for(new i = 0; i < MAX_PLAYERS; i++)
- {
- if(Player[i][Organizacao] == OrgAtaque || Player[i][Organizacao] == OrgDefesa)
- {
- for(new x = 0; x < 7; x++) PlayerTextDrawHide(i, Text_Guerra[i][x]);
- }
- }
- }
- if(PontosDefesa == PontosAtaque)
- {
- DonoParkGlen = 0;
- SalvarGangZones();
- AtualizarGangZones();
- GangZoneStopFlashForAll(ParkGlen);
- SendClientMessageToAll(-1, "Nenhuma organizacao dominou o territorio");
- for(new i = 0; i < MAX_PLAYERS; i++)
- {
- if(Player[i][Organizacao] == OrgAtaque || Player[i][Organizacao] == OrgDefesa)
- {
- for(new x = 0; x < 7; x++) PlayerTextDrawHide(i, Text_Guerra[i][x]);
- }
- }
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement