Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #define dcmd(%1,%2,%3) if (!strcmp((%3)[1], #%1, true, (%2)) && ((((%3)[(%2) + 1] == '\0') && (dcmd_%1(playerid, ""))) || (((%3)[(%2) + 1] == ' ') && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1 // Credits go to DracoBlue
- // Message Colors
- #define COLOR_ERROR 0xFB0000FF
- #define COLOR_MSG 0xFFFFFF00
- // GangZone Colors
- #define PRETA 0x000000C7
- #define BRANCA 0xFFFFFFBE
- #define LARANJA 0xFF8000B8
- #define VERMELHA 0xFF0000C7
- #define AZUL 0x0000FFC5
- #define VIOLETA 0x8000FFC9
- #define VERDE 0x00FF00D0
- #define AMARELA 0xFFFF00CC
- #define ROSA 0xFF80FFC7
- #define AZULMAR 0x5BB9E6CA
- #define MARROM 0x562C2CD2
- // Max Zones You Can Create
- #define MAX_ZONES 100
- new
- bool: GangZone[MAX_PLAYERS],
- bool: Spawned[MAX_PLAYERS],
- bool: GetPos[MAX_PLAYERS],
- CreatedZone[MAX_ZONES],
- gColor,
- Float: pMaxX = 0.0,
- Float: pMaxY = 0.0,
- Float: pMinX = 0.0,
- Float: pMinY = 0.0,
- Float: pZ = 0.0,
- gCount;
- public OnFilterScriptInit()
- {
- print("---------------------------------------");
- print(" Criador Gangzone by RyDeR - Carregado ");
- print(" Tradução By: Lucas Nicolas ");
- print("---------------------------------------");
- return 1;
- }
- public OnFilterScriptExit()
- {
- new i;
- while(i != MAX_PLAYERS)
- {
- Spawned[i] = false;
- GangZone[i] = false;
- ++i;
- }
- new g;
- while(g != MAX_ZONES)
- {
- --CreatedZone[g];
- --g;
- }
- return 1;
- }
- dcmd_gzone(playerid, params[])
- {
- #pragma unused params
- if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_ERROR, ">> Apenas o proprietário do servidor pode fazer gangzones!");
- if(Spawned[playerid] == false) return SendClientMessage(playerid, COLOR_ERROR, ">> Você não pode gerar uma Gangzone ainda!");
- if(GangZone[playerid] == true) return SendClientMessage(playerid, COLOR_ERROR, ">> Você já está criando uma gangzone!");
- if(IsPlayerInAnyVehicle(playerid)) RemovePlayerFromVehicle(playerid);
- ShowDefaultDialog(playerid);
- return 1;
- }
- ShowDefaultDialog(playerid)
- {
- return ShowPlayerDialog(playerid, 9540, DIALOG_STYLE_LIST, "GangZone Creator by RyDeR", "Criar Gangzone", "Selecionar", "Sair");
- }
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
- {
- switch(dialogid)
- {
- case 9540:
- {
- if(response == 0) return 1;
- switch(listitem)
- {
- case 0:
- {
- ShowPlayerDialog(playerid, 9541, DIALOG_STYLE_LIST, "Escolha a cor da gangzone", "Preta\nBranca\nLaranja\nVermelha\nAzul\nVioleta\nVerde\nAmarela\nRosa\nAzulMar\nMarrom", "Selecionar", "Voltar");
- }
- }
- }
- case 9541:
- {
- if(response == 0) return ShowDefaultDialog(playerid);
- switch(listitem)
- {
- case 0: gColor = PRETA;
- case 1: gColor = BRANCA;
- case 2: gColor = LARANJA;
- case 3: gColor = VERMELHA;
- case 4: gColor = AZUL;
- case 5: gColor = VIOLETA;
- case 6: gColor = VERDE;
- case 7: gColor = AMARELA;
- case 8: gColor = ROSA;
- case 9: gColor = AZULMAR;
- case 10: gColor = MARROM;
- }
- ShowPlayerDialog(playerid, 9542, DIALOG_STYLE_MSGBOX, "Gangzone Info", "GangZone Criada! Use as setas para fazer a zona de maior ou menor\nUsando a Fire Key + Setas você menos a altura ou a largura.\nPressione Enter quando tiver terminado!", "Aceitar", "Voltar");
- }
- case 9542:
- {
- if(response == 0) return ShowPlayerDialog(playerid, 9541, DIALOG_STYLE_LIST, "Escolha a cor da gangzone", "Preta\nBranca\nLaranja\nVermelha\nAzul\nVioleta\nVerde\nAmarela\nRosa\nAzulMar\nMarrom", "Selecionar", "Voltar");
- GangZone[playerid] = true;
- GetPos[playerid] = false;
- }
- case 9545:
- {
- if(response == 0)
- {
- GangZoneDestroy(GangZone[gCount]);
- return 1;
- }
- new
- string[128],
- string2[256],
- File:SaveIt;
- if(!strlen(inputtext)) return ShowPlayerDialog(playerid, 9546, DIALOG_STYLE_MSGBOX, "Erro", "Você tem que dar um nome para salvá-lo.", "Tentar Novamente", "Não Salvar");
- format(string, 128, "%s.rZone", inputtext);
- format(string2, sizeof(string2), "//No Topo Do Script:\r\nNovo %s;\r\n\r\n//Em OnGameModeInit\r\n%s = GangZoneCreate(%f, %f, %f, %f);\r\n\r\n//Em OnPlayerSpawn:\r\nGangZoneShowForPlayer(playerid, %s, %d);", inputtext, inputtext, pMinX, pMinY, pMaxX, pMaxY, inputtext, gColor);
- SaveIt = fopen(string, io_write);
- fwrite(SaveIt, string2);
- fclose(SaveIt);
- ShowPlayerDialog(playerid, 9547, DIALOG_STYLE_MSGBOX, "Progesso Completado!", "Sua gangzone foi salva. Verifique o diretório scriptfiles!", "Outra", "Sair");
- new
- g;
- while(g <sizeof(gCount))
- {
- ++CreatedZone[g];
- ++g;
- }
- }
- case 9546:
- {
- if(response == 0)
- {
- GangZoneDestroy(GangZone[gCount]);
- return 1;
- }
- ShowPlayerDialog(playerid, 9545, DIALOG_STYLE_INPUT, "Salvar ou Excluir a GZ", "Para salvar este de o nome para ele.\nSe você quiser excluir isso, clique em 'Sair'", "Salvar", "Excluir");
- }
- case 9547:
- {
- if(response == 0) return 1;
- ShowDefaultDialog(playerid);
- }
- }
- return 1;
- }
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- dcmd(gzone, 5, cmdtext);
- return 0;
- }
- public OnPlayerUpdate(playerid)
- {
- if(IsPlayerConnected(playerid))
- {
- if(GangZone[playerid] == true)
- {
- new
- Keys,
- UpDown,
- LeftRight;
- if(GetPos[playerid] == false) GetPlayerPos(playerid, pMaxX, pMaxY, pZ), GetPlayerPos(playerid, pMinX, pMinY, pZ), GetPos[playerid] = true;
- GetPlayerKeys(playerid, Keys, UpDown, LeftRight);
- TogglePlayerControllable(playerid, false);
- if(LeftRight == KEY_LEFT)
- {
- pMinX -= 8.0;
- GangZoneDestroy(CreatedZone[gCount]);
- CreatedZone[gCount] = GangZoneCreate(pMinX, pMinY, pMaxX, pMaxY);
- GangZoneShowForPlayer(playerid, CreatedZone[gCount], gColor);
- }
- else if(LeftRight & KEY_LEFT && Keys & KEY_FIRE)
- {
- pMinX += 8.0;
- GangZoneDestroy(CreatedZone[gCount]);
- CreatedZone[gCount] = GangZoneCreate(pMinX, pMinY, pMaxX, pMaxY);
- GangZoneShowForPlayer(playerid, CreatedZone[gCount], gColor);
- }
- else if(LeftRight == KEY_RIGHT)
- {
- pMaxX += 8.0;
- GangZoneDestroy(CreatedZone[gCount]);
- CreatedZone[gCount] = GangZoneCreate(pMinX, pMinY, pMaxX, pMaxY);
- GangZoneShowForPlayer(playerid, CreatedZone[gCount], gColor);
- }
- else if(LeftRight & KEY_RIGHT && Keys & KEY_FIRE)
- {
- pMaxX -= 8.0;
- GangZoneDestroy(CreatedZone[gCount]);
- CreatedZone[gCount] = GangZoneCreate(pMinX, pMinY, pMaxX, pMaxY);
- GangZoneShowForPlayer(playerid, CreatedZone[gCount], gColor);
- }
- else if(UpDown == KEY_UP)
- {
- pMaxY += 8.0;
- GangZoneDestroy(CreatedZone[gCount]);
- CreatedZone[gCount] = GangZoneCreate(pMinX, pMinY, pMaxX, pMaxY);
- GangZoneShowForPlayer(playerid, CreatedZone[gCount], gColor);
- }
- else if(UpDown & KEY_UP && Keys & KEY_FIRE)
- {
- pMaxY -= 8.0;
- GangZoneDestroy(CreatedZone[gCount]);
- CreatedZone[gCount] = GangZoneCreate(pMinX, pMinY, pMaxX, pMaxY);
- GangZoneShowForPlayer(playerid, CreatedZone[gCount], gColor);
- }
- else if(UpDown == KEY_DOWN)
- {
- pMinY -= 8.0;
- GangZoneDestroy(CreatedZone[gCount]);
- CreatedZone[gCount] = GangZoneCreate(pMinX, pMinY, pMaxX, pMaxY);
- GangZoneShowForPlayer(playerid, CreatedZone[gCount], gColor);
- }
- else if(UpDown & KEY_DOWN && Keys & KEY_FIRE)
- {
- pMinY += 8.0;
- GangZoneDestroy(CreatedZone[gCount]);
- CreatedZone[gCount] = GangZoneCreate(pMinX, pMinY, pMaxX, pMaxY);
- GangZoneShowForPlayer(playerid, CreatedZone[gCount], gColor);
- }
- else if(Keys & KEY_SECONDARY_ATTACK)
- {
- TogglePlayerControllable(playerid, true);
- GangZone[playerid] = false;
- GetPos[playerid] = false;
- ShowPlayerDialog(playerid, 9545, DIALOG_STYLE_INPUT, "Salvar ou Excluir a GZ", "Para salvar este de o nome para ele.\nSe você quiser excluir isso, clique em 'Sair'", "Salvar", "Excluir");
- }
- }
- }
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- GangZone[playerid] = false;
- Spawned[playerid] = false;
- GetPos[playerid] = false;
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- GangZone[playerid] = false;
- Spawned[playerid] = false;
- GetPos[playerid] = false;
- GangZoneDestroy(GangZone[gCount]);
- return 1;
- }
- public OnPlayerSpawn(playerid)
- {
- Spawned[playerid] = true;
- return 1;
- }
- public OnPlayerDeath(playerid, killerid, reason)
- {
- Spawned[playerid] = false;
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement