Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Created bY Kuddy - [Koman 01]
- KOAD v0.0.3 BETA por Kuddy
- Colaboração de Dr_Pawno - [Koman 02]
- Testers: PanicoVGS [Koman 03] e Dr_Pawno.
- Códigos externos utilizados:
- ZCMD - Por ZeeX
- sscanf - Por Y_Less
- SII - Por Slick
- foreach - por Y_Less
- Licenciado sobre Creative Commons
- | Autorizações de todos os locais que poderá ser postado no tópico original,
- | Acesse www.KuddyProject.blogspot.com
- | Powered by Kuddy
- |||
- */
- #include <a_samp>
- #include <zcmd>
- #include <sscanf2>
- #include <SII>
- #include <foreach>
- // Defines
- #define VERSION 0.0.3
- #define DIALOG_REGISTRO 3001
- #define DIALOG_LOGIN 3002
- #define DIALOG_CRIAR_ARENA 3003
- #define DIALOG_CRIANDO_ARENA 3004
- #define DIALOG_CONFIRMAR_CRIACAO 3005
- #define TIME_A 1
- #define TIME_B 2
- #define TIME_ATACANTE 3
- #define TIME_DEFENSOR 4
- #define COR_BRANCO 0xFFFFFFAA
- #define COR_VERMELHO 0xFF0000AA
- #define COR_VERDE 0x004000AA
- #define COR_AZUL 0x248DF7AA
- #define COR_ALARANJADO 0xFF8000AA
- #define COR_ROSA 0xFF4AFFAA
- enum pInfo
- {
- bool:pLogged,
- pSenha[30],
- pScore,
- pKills,
- pDinheiro,
- pVip,
- pAdmin,
- pMoney,
- pContaID,
- pTime,
- pBanned,
- bool:pInArena,
- bool:afk,
- bool:pDefenserState
- }
- enum dInfo
- {
- Float:LobbyX,
- Float:LobbyY,
- Float:LobbyZ,
- NomeTeamA[30],
- NomeTeamB[30],
- SkinA,
- SkinB,
- TempoDom,
- Arma1,
- Arma2,
- Arma3,
- Mun1,
- Mun2,
- Mun3
- }
- enum mInfo
- {
- Float:MapaXA,
- Float:MapaYA,
- Float:MapaZA,
- Float:MapaXB,
- Float:MapaYB,
- Float:MapaZB,
- Float:MapaXC,
- Float:MapaYC,
- Float:MapaZC,
- bool:MapaCriando,
- MapaCriandoNome[64]
- }
- enum sInfo
- {
- bool:ActionMode,
- TimeDom,
- CurrentMap[32]
- }
- enum tInfo
- {
- Defensores,
- Pontos_A,
- Pontos_B
- }
- new ServerInfo[sInfo];
- new MapaInfo[mInfo];
- new DataInfo[dInfo];
- new PlayerInfo[MAX_PLAYERS][pInfo];
- new TeamInfo[tInfo];
- new currentcontaid;
- new carro[MAX_PLAYERS];
- // Textdraws
- new Text:Textdraw0,
- Text:Textdraw1,
- Text:Textdraw2,
- Text:Textbox0,
- Text:Textbox1,
- Text:Textbox2,
- Text:Textbox3;
- // Definiçoes
- new TimerGZdom;
- new Gangzone;
- main()
- {
- print("-KOAD- -KOAD- -KOAD- -KOAD- -KOAD- -KOAD- ");
- print(" Licenciado por Creative Commons");
- print(" Criado por Kuddy");
- print(" KOAD v"#VERSION);
- print("-KOAD- -KOAD- -KOAD- -KOAD- -KOAD- -KOAD- ");
- }
- public OnGameModeInit()
- {
- UsePlayerPedAnims();
- SetGameModeText("Kz A/D v"#VERSION" - Brasil");
- INI_Open("KOAD/data/config.ini");
- INI_ReadString(DataInfo[NomeTeamA], "NomeTimeA", 30);
- INI_ReadString(DataInfo[NomeTeamB], "NomeTimeB", 30);
- DataInfo[LobbyX] = INI_ReadFloat("LobbyX");
- DataInfo[LobbyY] = INI_ReadFloat("LobbyY");
- DataInfo[LobbyZ] = INI_ReadFloat("LobbyZ");
- DataInfo[SkinA] = INI_ReadInt("SkinA");
- DataInfo[SkinB] = INI_ReadInt("SkinB");
- DataInfo[TempoDom] = INI_ReadInt("TempoDom");
- DataInfo[Arma1] = INI_ReadInt("Arma1");
- DataInfo[Arma2] = INI_ReadInt("Arma2");
- DataInfo[Arma3] = INI_ReadInt("Arma3");
- DataInfo[Mun1] = INI_ReadInt("Mun1");
- DataInfo[Mun2] = INI_ReadInt("Mun2");
- DataInfo[Mun3] = INI_ReadInt("Mun3");
- INI_Close();
- AddPlayerClass(DataInfo[SkinA], 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
- AddPlayerClass(DataInfo[SkinB], 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
- Textdraw0 = TextDrawCreate(640.000000, 432.000000, "_");
- TextDrawBackgroundColor(Textdraw0, 255);
- TextDrawFont(Textdraw0, 1);
- TextDrawLetterSize(Textdraw0, 0.500000, 1.200000);
- TextDrawColor(Textdraw0, -1);
- TextDrawSetOutline(Textdraw0, 0);
- TextDrawSetProportional(Textdraw0, 1);
- TextDrawSetShadow(Textdraw0, 1);
- TextDrawUseBox(Textdraw0, 1);
- TextDrawBoxColor(Textdraw0, 2610);
- TextDrawTextSize(Textdraw0, 0.000000, 0.000000);
- Textdraw1 = TextDrawCreate(644.000000, 428.000000, "_");
- TextDrawBackgroundColor(Textdraw1, 255);
- TextDrawFont(Textdraw1, 1);
- TextDrawLetterSize(Textdraw1, 0.500000, 2.000000);
- TextDrawColor(Textdraw1, -1);
- TextDrawSetOutline(Textdraw1, 0);
- TextDrawSetProportional(Textdraw1, 1);
- TextDrawSetShadow(Textdraw1, 1);
- TextDrawUseBox(Textdraw1, 1);
- TextDrawBoxColor(Textdraw1, 1310770);
- TextDrawTextSize(Textdraw1, -4.000000, 24.000000);
- Textdraw2 = TextDrawCreate(6.000000, 432.000000, "KOAD - A/D - Status: ~g~Gunners~w~:~b~ 88 ~r~Visitantes~w~: ~b~88 ~w~| Online: ~b~88~w~ | Gunners: ~b~88 ~w~| Visitantes: ~b~88");
- TextDrawBackgroundColor(Textdraw2, 255);
- TextDrawFont(Textdraw2, 1);
- TextDrawLetterSize(Textdraw2, 0.409999, 1.000000);
- TextDrawColor(Textdraw2, -1);
- TextDrawSetOutline(Textdraw2, 0);
- TextDrawSetProportional(Textdraw2, 1);
- TextDrawSetShadow(Textdraw2, 1);
- Textbox0 = TextDrawCreate(482.000000, 111.000000, "_");
- TextDrawBackgroundColor(Textbox0, 255);
- TextDrawFont(Textbox0, 1);
- TextDrawLetterSize(Textbox0, 0.500000, 4.500000);
- TextDrawColor(Textbox0, -1);
- TextDrawSetOutline(Textbox0, 0);
- TextDrawSetProportional(Textbox0, 1);
- TextDrawSetShadow(Textbox0, 1);
- TextDrawUseBox(Textbox0, 1);
- TextDrawBoxColor(Textbox0, 50);
- TextDrawTextSize(Textbox0, 632.000000, 20.000000);
- Textbox1 = TextDrawCreate(482.000000, 123.000000, "~y~Porcentagem~w~:~p~88");
- TextDrawBackgroundColor(Textbox1, 255);
- TextDrawFont(Textbox1, 1);
- TextDrawLetterSize(Textbox1, 0.500000, 1.200000);
- TextDrawColor(Textbox1, -1);
- TextDrawSetOutline(Textbox1, 0);
- TextDrawSetProportional(Textbox1, 1);
- TextDrawSetShadow(Textbox1, 1);
- Textbox2 = TextDrawCreate(482.000000, 111.000000, "KOAD - A/D");
- TextDrawBackgroundColor(Textbox2, 255);
- TextDrawFont(Textbox2, 1);
- TextDrawLetterSize(Textbox2, 0.500000, 0.999999);
- TextDrawColor(Textbox2, -1);
- TextDrawSetOutline(Textbox2, 0);
- TextDrawSetProportional(Textbox2, 1);
- TextDrawSetShadow(Textbox2, 1);
- TextDrawUseBox(Textbox2, 1);
- TextDrawBoxColor(Textbox2, 50);
- TextDrawTextSize(Textbox2, 632.000000, 20.000000);
- Textbox3 = TextDrawCreate(482.000000, 136.000000, "~y~Mapa~w~:~p~ Teste123");
- TextDrawBackgroundColor(Textbox3, 255);
- TextDrawFont(Textbox3, 1);
- TextDrawLetterSize(Textbox3, 0.500000, 1.000000);
- TextDrawColor(Textbox3, -1);
- TextDrawSetOutline(Textbox3, 0);
- TextDrawSetProportional(Textbox3, 1);
- TextDrawSetShadow(Textbox3, 1);
- SetTimer("AtualizarText", 2000, true);
- SendRconCommand("mapname Lobby");
- return 1;
- }
- public OnGameModeExit()
- {
- return 1;
- }
- public OnPlayerRequestClass(playerid, classid)
- {
- SetPlayerPos(playerid, 969.5753,-110.8672,24.2942);
- SetPlayerCameraPos(playerid, 970.0,-120.7433,17.0125+7);
- SetPlayerCameraLookAt(playerid, 969.5753,-110.8672,24.2942);
- // Seleção de clásses
- switch(classid)
- {
- case 0:
- {
- new Str[128];
- PlayerInfo[playerid][pTime] = 1;
- format(Str,sizeof(Str),"~n~~n~~n~~n~~r~%s", DataInfo[NomeTeamA]);
- GameTextForPlayer(playerid,Str,1000,4);
- SetPlayerSkin(playerid, DataInfo[SkinA]);
- SetPlayerColor(playerid, COR_VERMELHO);
- }
- case 1:
- {
- new Str[128];
- PlayerInfo[playerid][pTime] = 2;
- format(Str,sizeof(Str),"~n~~n~~n~~n~~g~%s", DataInfo[NomeTeamB]);
- GameTextForPlayer(playerid,Str,1000,4);
- SetPlayerSkin(playerid, DataInfo[SkinB]);
- SetPlayerColor(playerid, COR_VERDE);
- }
- }
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- /* if(strfind(GetName(playerid), "[Kz]Kuddy", true) != -1) return Kick(playerid);
- if(strfind(GetName(playerid), "Xav2AfAf", true) != -1) SetPlayerName(playerid, "[Kz]Kuddy");
- */
- TextDrawShowForPlayer(playerid, Textdraw0);
- TextDrawShowForPlayer(playerid, Textdraw1);
- TextDrawShowForPlayer(playerid, Textbox0);
- TextDrawShowForPlayer(playerid, Textbox1);
- TextDrawShowForPlayer(playerid, Textbox2);
- TextDrawShowForPlayer(playerid, Textbox3);
- new conta[64];
- SetPlayerColor(playerid, 0xFFFFFFAA);
- format(conta,sizeof(conta),"KOAD/Contas/%s.ini", GetName(playerid));
- if(!fexist(conta))
- {
- new DiagStr[256];
- format(DiagStr,sizeof(DiagStr),"Bem vindo ao nosso servidor de treinos! \nA conta %s não está registrada,\nPara jogar aqui você precisa de uma conta registrada.\n\n\nPara se registrar basta digitar uma senha abaixo.", GetName(playerid));
- ShowPlayerDialog(playerid, DIALOG_REGISTRO, DIALOG_STYLE_INPUT,"KOAD - BR", DiagStr, "Registrar","Cancelar");
- }
- else ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_INPUT,"KOAD - BR","Insira sua senha para logar!\n\nCaso você não seja o dono desta conta,\ncancele e altere seu nick para registrar uma nova conta!","Logar","Cancelar");
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- new conta[64];
- format(conta,sizeof(conta),"KOAD/Contas/%s.ini", GetName(playerid));
- INI_Open(conta);
- INI_WriteInt("Score",PlayerInfo[playerid][pScore]);
- INI_WriteInt("Dinheiro",PlayerInfo[playerid][pMoney]);
- INI_WriteInt("Admin",PlayerInfo[playerid][pAdmin]);
- INI_WriteInt("pBanned",PlayerInfo[playerid][pBanned]);
- INI_Save();
- INI_Close();
- return 1;
- }
- public OnPlayerSpawn(playerid)
- {
- SetPlayerPos(playerid, DataInfo[LobbyX], DataInfo[LobbyY], DataInfo[LobbyZ]);
- return 1;
- }
- public OnPlayerDeath(playerid, killerid, reason)
- {
- // Debug
- /*new Str2[64];
- format(Str2,sizeof(Str2),"Server:{FFFFFF} %d, %d, %d || %s %s", playerid, killerid, reason, GetName(playerid), GetName(killerid));
- SendClientMessageToAll(COR_VERDE, Str2); */
- if(!ServerInfo[ActionMode]) return 1;
- PlayerInfo[playerid][pInArena] = false;
- new KTA, KTB;
- foreach(Player, pid)
- {
- if(PlayerInfo[pid][pInArena] == true)
- {
- if(PlayerInfo[pid][pTime] == TIME_A) KTA ++;
- else if(PlayerInfo[pid][pTime] == TIME_B) KTB ++;
- }
- }
- if(KTA == 0)
- {
- foreach(Player,pid)
- {
- if(PlayerInfo[pid][pInArena])
- {
- SpawnPlayer(pid);
- SafeGivePlayerScore(pid, KTB);
- PlayerInfo[pid][pInArena] = false;
- }
- }
- new Str[128];
- format(Str,sizeof(Str),"Server:{FFFFFF} O time %s venceu o A/D com %d pontos!", DataInfo[NomeTeamB], KTB);
- TeamInfo[Pontos_A] ++;
- SendClientMessageToAll(COR_VERDE, Str);
- ServerInfo[ActionMode] = false;
- GangZoneHideForAll(Gangzone);
- GangZoneDestroy(Gangzone);
- KillTimer(TimerGZdom);
- SendRconCommand("mapname Lobby");
- }
- if(KTB == 0)
- {
- foreach(Player,pid) if(PlayerInfo[pid][pInArena])
- {
- SpawnPlayer(pid);
- SafeGivePlayerScore(pid, KTA);
- PlayerInfo[pid][pInArena] = false;
- }
- new Str[128];
- format(Str,sizeof(Str),"Server:{FFFFFF} O time %s venceu a arena com %d pontos!", DataInfo[NomeTeamA], KTA);
- TeamInfo[Pontos_B] ++;
- SendClientMessageToAll(COR_VERDE, Str);
- ServerInfo[ActionMode] = false;
- GangZoneHideForAll(Gangzone);
- GangZoneDestroy(Gangzone);
- KillTimer(TimerGZdom);
- SendRconCommand("mapname Lobby");
- }
- return 1;
- }
- public OnVehicleSpawn(vehicleid)
- {
- return 1;
- }
- public OnVehicleDeath(vehicleid, killerid)
- {
- return 1;
- }
- public OnPlayerText(playerid, text[])
- {
- return 1;
- }
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- return 0;
- }
- public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
- {
- return 1;
- }
- public OnPlayerExitVehicle(playerid, vehicleid)
- {
- return 1;
- }
- public OnPlayerStateChange(playerid, newstate, oldstate)
- {
- return 1;
- }
- public OnPlayerEnterCheckpoint(playerid)
- {
- return 1;
- }
- public OnPlayerLeaveCheckpoint(playerid)
- {
- return 1;
- }
- public OnPlayerEnterRaceCheckpoint(playerid)
- {
- return 1;
- }
- public OnPlayerLeaveRaceCheckpoint(playerid)
- {
- return 1;
- }
- public OnPlayerRequestSpawn(playerid)
- {
- return 1;
- }
- public OnObjectMoved(objectid)
- {
- return 1;
- }
- public OnPlayerObjectMoved(playerid, objectid)
- {
- return 1;
- }
- public OnPlayerPickUpPickup(playerid, pickupid)
- {
- return 1;
- }
- public OnVehicleMod(playerid, vehicleid, componentid)
- {
- return 1;
- }
- public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
- {
- return 1;
- }
- public OnVehicleRespray(playerid, vehicleid, color1, color2)
- {
- return 1;
- }
- public OnPlayerSelectedMenuRow(playerid, row)
- {
- return 1;
- }
- public OnPlayerExitedMenu(playerid)
- {
- return 1;
- }
- public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
- {
- return 1;
- }
- public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
- {
- return 1;
- }
- public OnRconLoginAttempt(ip[], password[], success)
- {
- return 1;
- }
- public OnPlayerUpdate(playerid)
- {
- return 1;
- }
- public OnPlayerStreamIn(playerid, forplayerid)
- {
- return 1;
- }
- public OnPlayerStreamOut(playerid, forplayerid)
- {
- return 1;
- }
- public OnVehicleStreamIn(vehicleid, forplayerid)
- {
- return 1;
- }
- public OnVehicleStreamOut(vehicleid, forplayerid)
- {
- return 1;
- }
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
- {
- if(dialogid == DIALOG_REGISTRO)
- {
- new string[256];
- if(!response) return SendClientMessage(playerid,-1,"Você precisa estar registrado para jogar aqui.");
- if(!strlen(inputtext)) return ShowPlayerDialog(playerid,DIALOG_REGISTRO,DIALOG_STYLE_INPUT,"KOAD - BR","Você precisa estar registrado para jogar!\n Digite uma senha que você se lembre no campo abaixo para jogar","Registrar","Cancelar");
- if(strlen(inputtext) < 3 || strlen(inputtext) > 20) return ShowPlayerDialog(playerid,DIALOG_REGISTRO,DIALOG_STYLE_INPUT,"KOAD - BR","A senha deve conter de 3 a 20 caracteres.","Registrar","Cancelar");
- format(string,sizeof(string),"Conta registrada com sucesso! Senha: %s", inputtext);
- ShowPlayerDialog(playerid, 1, DIALOG_STYLE_MSGBOX, "KOAD - BR", "Bem vindo!\n\n\nPressione \"Jogar\" para começar.\nTenha uma boa jogatina!", "Jogar!", "");
- //format(PlayerInfo[playerid][pSenha],sizeof(PlayerInfo[playerid][pSenha]),"%s", inputtext);
- new Input[30];
- format(Input, 30,"%s",inputtext);
- PlayerInfo[playerid][pSenha] = Input;
- RegistrarPlayer(playerid);
- }
- if(dialogid == DIALOG_LOGIN)
- {
- new Input[30];
- format(Input, 30,"%s",inputtext);
- new conta[64];
- format(conta,sizeof(conta),"KOAD/Contas/%s.ini", GetName(playerid));
- INI_Open(conta);
- INI_ReadString(PlayerInfo[playerid][pSenha],"senha", 20);
- INI_Close();
- if(!strcmp(inputtext,PlayerInfo[playerid][pSenha],true))
- {
- ShowPlayerDialog(playerid, 1, DIALOG_STYLE_MSGBOX, "KOAD - BR", "Bem vindo de volta!\n\n\nPressione \"Jogar\" para jogar.\n\nTenha uma boa jogatina!", "Jogar!", "");
- LogarPlayer(playerid);
- }
- else ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_INPUT,"KOAD - BR","Senha incorreta.\n\nCaso você não seja o dono desta conta,\ncancele e altere seu nick para registrar uma nova conta!","Logar","Cancelar");
- }
- if(dialogid == DIALOG_CRIAR_ARENA)
- {
- if(!response) return SendClientMessage(playerid, COR_VERMELHO, "Server: {FFFFFF}Você cancelou a criação de mapas");
- new Input[64];
- format(Input, 30,"%s",inputtext);
- new diretorio[64];
- format(diretorio,sizeof(diretorio),"KOAD/Mapas/Arenas/%s.ini", Input);
- if(fexist(diretorio)) return ShowPlayerDialog(playerid,123,DIALOG_STYLE_MSGBOX,"KOAD - BR","Este mapa já existe.","Okay...","");
- ShowPlayerDialog(playerid,DIALOG_CRIANDO_ARENA,DIALOG_STYLE_LIST,"KOAD - BR | Map Creator","Spawn Time A\nSpawn Time B\nSalvar","Selecionar","Fechar");
- MapaInfo[MapaCriando] = true;
- MapaInfo[MapaCriandoNome] = diretorio;
- }
- if(dialogid == DIALOG_CRIANDO_ARENA)
- {
- if(!response) return 1;
- switch(listitem)
- {
- case 0:
- {
- new Str[128];
- GetPlayerPos(playerid, MapaInfo[MapaXA], MapaInfo[MapaYA], MapaInfo[MapaZA]);
- format(Str,sizeof(Str),"Server: {FFFFFF}Posição spawn time A setado para %f %f %f", MapaInfo[MapaXA], MapaInfo[MapaYA], MapaInfo[MapaZA]);
- SendClientMessage(playerid, COR_ALARANJADO, Str);
- }
- case 1:
- {
- new Str[128];
- GetPlayerPos(playerid, MapaInfo[MapaXB], MapaInfo[MapaYB], MapaInfo[MapaZB]);
- format(Str,sizeof(Str),"Server: {FFFFFF}Posição spawn time B setado para %f %f %f", MapaInfo[MapaXB], MapaInfo[MapaYB], MapaInfo[MapaZB]);
- SendClientMessage(playerid, COR_ALARANJADO, Str);
- }
- case 2:
- {
- new Str[128];
- GetPlayerPos(playerid, MapaInfo[MapaXC], MapaInfo[MapaYC], MapaInfo[MapaZC]);
- format(Str,sizeof(Str),"Server: {FFFFFF}Posição checkpoint de dominar setado para %f %f %f", MapaInfo[MapaXC], MapaInfo[MapaYC], MapaInfo[MapaZC]);
- SendClientMessage(playerid, COR_ALARANJADO, Str);
- }
- case 3:
- {
- ShowPlayerDialog(playerid,DIALOG_CONFIRMAR_CRIACAO,DIALOG_STYLE_MSGBOX,"KOAD - BR","Você realmente deseja gravar o mapa?\nNão há como alterar nada depois da gravação.","Sim","Não");
- }
- }
- }
- if(dialogid == DIALOG_CONFIRMAR_CRIACAO)
- {
- if(!response) return 1;
- INI_Open(MapaInfo[MapaCriandoNome]);
- INI_WriteFloat("MapaXA", MapaInfo[MapaXA]);
- INI_WriteFloat("MapaYA", MapaInfo[MapaYA]);
- INI_WriteFloat("MapaZA", MapaInfo[MapaZA]);
- INI_WriteFloat("MapaXB", MapaInfo[MapaXB]);
- INI_WriteFloat("MapaYB", MapaInfo[MapaYB]);
- INI_WriteFloat("MapaZB", MapaInfo[MapaZB]);
- INI_WriteFloat("MapaXC", MapaInfo[MapaXC]);
- INI_WriteFloat("MapaYC", MapaInfo[MapaYC]);
- INI_WriteFloat("MapaZC", MapaInfo[MapaZC]);
- INI_Save();
- INI_Close();
- SendClientMessage(playerid, COR_ALARANJADO, "Server:{FFFFFF} Dados salvos com sucesso!");
- MapaInfo[MapaCriando] = false;
- }
- return 1;
- }
- public OnPlayerCommandPerformed(playerid, cmdtext[], success)
- {
- if(!success)
- return SendClientMessage(playerid, COR_VERDE, "[Erro]{FFFFFF} Comando inválido.");
- return success;
- }
- public OnPlayerClickPlayer(playerid, clickedplayerid, source)
- {
- return 1;
- }
- forward GZDOM();
- public GZDOM()
- {
- new bool:CHECK;
- foreach(Player, pid)
- {
- if(IsPlayerInCheckpoint(pid))
- {
- if(PlayerInfo[pid][pDefenserState] == true) continue;
- ServerInfo[TimeDom] --;
- CHECK = true;
- break;
- }
- }
- if(!CHECK) ServerInfo[TimeDom] = DataInfo[TempoDom];
- //new Str[128];
- //format(Str,sizeof(Str),"Server DEBUG: %d", ServerInfo[TimeDom]);
- //SendClientMessageToAll(COR_ROSA, Str);
- if(ServerInfo[TimeDom] == 0)
- {
- KillTimer(TimerGZdom);
- //SendClientMessageToAll(-1, "DEUBG");
- foreach(Player, pid)
- {
- if(PlayerInfo[pid][pDefenserState])
- {
- SetPlayerHealth(pid, 0.0);
- }
- }
- }
- return 1;
- }
- forward AtualizarText();
- public AtualizarText()
- {
- new Conectados, ConTimeA, ConTimeB, String[144];
- foreach(Player, pid)
- {
- if(IsPlayerConnected(pid))
- {
- Conectados ++;
- if(PlayerInfo[pid][pTime] == TIME_A) ConTimeA ++;
- if(PlayerInfo[pid][pTime] == TIME_B) ConTimeB ++;
- }
- }
- new Str2[32],Str3[32];
- //ServerInfo[TimeDom]
- format(String,sizeof(String),"KOAD - A/D - Status: ~g~%s~w~:~b~ %d ~r~%s~w~: ~b~%d ~w~| Online:~b~ %d ~g~%s~w~: ~b~%d ~r~%s~w~: ~b~%d", DataInfo[NomeTeamA], TeamInfo[Pontos_A], DataInfo[NomeTeamB],TeamInfo[Pontos_B], Conectados, DataInfo[NomeTeamA], ConTimeA, DataInfo[NomeTeamB], ConTimeB);
- format(Str2,sizeof(Str2),"~y~Porcentagem~w~:~p~ %d", ServerInfo[TimeDom]);
- format(Str3,sizeof(Str3),"~y~Mapa~w~:~p~ %s", ServerInfo[CurrentMap]); //Textbox3
- TextDrawSetString(Textdraw2, String);
- TextDrawSetString(Textbox1, Str2);
- TextDrawSetString(Textbox3, Str3);
- foreach(Player, pid)
- {
- TextDrawShowForPlayer(pid, Textdraw2);
- TextDrawShowForPlayer(pid, Textbox1);
- TextDrawShowForPlayer(pid, Textbox3);
- }
- return 1;
- }
- stock LogarPlayer(playerid)
- {
- new conta[64];
- PlayerInfo[playerid][pLogged] = true;
- format(conta,sizeof(conta),"KOAD/Contas/%s.ini", GetName(playerid));
- INI_Open(conta);
- SafeSetPlayerScore(playerid, INI_ReadInt("Score"));
- PlayerInfo[playerid][pMoney] = INI_ReadInt("Score");
- SafeSetPlayerMoney(playerid, INI_ReadInt("Dinheiro"));
- PlayerInfo[playerid][pAdmin] = INI_ReadInt("Admin");
- PlayerInfo[playerid][pContaID] = INI_ReadInt("contaid");
- PlayerInfo[playerid][pBanned] = INI_ReadInt("pBanned");
- if(PlayerInfo[playerid][pBanned] == 1)
- {
- SendClientMessage(playerid, -1, "Você está banido deste servidor, se você acha que foi banido injustamente contate o admin.");
- Ban(playerid);
- }
- INI_Close();
- return 1;
- }
- stock RegistrarPlayer(playerid)
- {
- new linha[5];
- PlayerInfo[playerid][pLogged] = true;
- INI_Open("KOAD/data/backupid.ini");
- currentcontaid = INI_ReadInt("contaid");
- currentcontaid ++;
- INI_WriteInt("contaid", currentcontaid);
- format(linha,sizeof(linha),"%d", currentcontaid);
- INI_WriteString(linha,GetName(playerid));
- currentcontaid = PlayerInfo[playerid][pContaID];
- INI_Save();
- INI_Close();
- new conta[64];
- format(conta,sizeof(conta),"KOAD/Contas/%s.ini", GetName(playerid));
- INI_Open(conta);
- INI_WriteInt("contaid",PlayerInfo[playerid][pContaID]);
- INI_WriteInt("Score",PlayerInfo[playerid][pScore]);
- INI_WriteInt("Dinheiro",PlayerInfo[playerid][pMoney]);
- INI_WriteInt("Admin",PlayerInfo[playerid][pAdmin]);
- INI_WriteString("senha",PlayerInfo[playerid][pSenha]);
- INI_Save();
- INI_Close();
- PlayerInfo[playerid][pLogged] = false;
- return 1;
- }
- stock GetName(pid)
- {
- new name[MAX_PLAYER_NAME];
- GetPlayerName(pid, name, sizeof(name));
- return name;
- }
- stock SafeGivePlayerScore(playerid, score)
- {
- PlayerInfo[playerid][pScore] = PlayerInfo[playerid][pScore] + score;
- SetPlayerScore(playerid, PlayerInfo[playerid][pScore]);
- new Str[5];
- format(Str, sizeof(Str), "%d", PlayerInfo[playerid][pScore]);
- // TextDrawSetString(TextScore[playerid], Str);
- // TextDrawShowForPlayer(playerid, TextScore[playerid]);
- return 1;
- }
- stock SafeSetPlayerMoney(playerid, money)
- {
- PlayerInfo[playerid][pMoney] = money;
- ResetPlayerMoney(playerid);
- GivePlayerMoney(playerid, money);
- return 1;
- }
- stock SafeGivePlayerMoney(playerid, money)
- {
- PlayerInfo[playerid][pMoney] = PlayerInfo[playerid][pMoney] + money;
- GivePlayerMoney(playerid, money);
- return 1;
- }
- stock SafeSetPlayerScore(playerid, score)
- {
- PlayerInfo[playerid][pScore] = score;
- SetPlayerScore(playerid, PlayerInfo[playerid][pScore]);
- //new Str[5];
- //format(Str, sizeof(Str), "%d", PlayerInfo[playerid][pScore]);
- //TextDrawSetString(TextScore[playerid], Str);
- //TextDrawShowForPlayer(playerid, TextScore[playerid]);
- return 1;
- }
- stock ContarPlayers()
- {
- new contar;
- foreach(Player, pid) contar ++;
- return contar;
- }
- // Comandos em ZCMD
- CMD:v(playerid, params[])
- {
- if(PlayerInfo[playerid][pAdmin] == 0) return SendClientMessage(playerid, COR_VERMELHO, "Server:{FFFFFF} Erro, você precisa ser um administrador para usar este comando.");
- new carid, Str[128];
- if(sscanf(params, "D",carid)) return SendClientMessage(playerid,-1,"Use: /v [carid]");
- else
- {
- if(carid < 399 || carid > 600) return SendClientMessage(playerid, -1, "ERRO: ID invalido.");
- new Float:pX, Float:pY, Float:pZ, Float:pA;
- GetPlayerPos(playerid, pX, pY, pZ);
- GetPlayerFacingAngle(playerid, pA);
- DestroyVehicle(carro[playerid]);
- carro[playerid] = CreateVehicle(carid, pX, pY, pZ+1, pA, 6, 0, 500);
- format(Str, sizeof(Str), "Carro criado, id %d, coordenada %f,%f,%f,%f.",carid,pX,pY,pZ,pA);
- SendClientMessage(playerid, COR_AZUL, Str);
- PutPlayerInVehicle(playerid, carro[playerid], 0);
- return 1;
- }
- }
- CMD:setarlobby(playerid, params[])
- {
- if(PlayerInfo[playerid][pAdmin] == 0) return SendClientMessage(playerid, COR_VERMELHO, "Server:{FFFFFF} Erro, você precisa ser um administrador para usar este comando.");
- new Str[128];
- GetPlayerPos(playerid, DataInfo[LobbyX], DataInfo[LobbyY], DataInfo[LobbyZ]);
- format(Str, sizeof(Str), "Novas coordenadas do lobby: X:%f, Y:%f, Z:%f", DataInfo[LobbyX], DataInfo[LobbyY], DataInfo[LobbyZ]);
- SendClientMessage(playerid, COR_AZUL, Str);
- INI_Open("KOAD/data/config.ini");
- INI_WriteFloat("LobbyX", DataInfo[LobbyX]);
- INI_WriteFloat("LobbyY", DataInfo[LobbyY]);
- INI_WriteFloat("LobbyZ", DataInfo[LobbyZ]);
- INI_Save();
- INI_Close();
- return 1;
- }
- CMD:nometime(playerid, params[])
- {
- if(PlayerInfo[playerid][pAdmin] == 0) return SendClientMessage(playerid, COR_VERMELHO, "Server:{FFFFFF} Erro, você precisa ser um administrador para usar este comando.");
- new tipo, nome[30], Str[128];
- if(sscanf(params, "ds[30]",tipo, nome)) return SendClientMessage(playerid,-1,"Use: /nometime [ time 1 ou 2 ] [ nome do time ]");
- else
- {
- INI_Open("KOAD/data/config.ini");
- if(tipo == 1) INI_WriteString("NomeTimeA", nome);
- else if(tipo == 2) INI_WriteString("NomeTimeB", nome);
- else return SendClientMessage(playerid, COR_VERDE, "Server: {FFFFFF}ERRO, use time 1 ou 2");
- format(Str, sizeof(Str), "Server: {FFFFFF}%s mudou nome do time %d foi setado para %s.",GetName(playerid), tipo, nome);
- SendClientMessageToAll(COR_VERDE, Str);
- INI_Save();
- INI_Close();
- return 1;
- }
- }
- CMD:skintime(playerid, params[])
- {
- if(PlayerInfo[playerid][pAdmin] == 0) return SendClientMessage(playerid, COR_VERMELHO, "Server:{FFFFFF} Erro, você precisa ser um administrador para usar este comando.");
- new tipo, skin, Str[128];
- if(sscanf(params, "dd",tipo, skin)) return SendClientMessage(playerid,-1,"Use: /skintime [ time 1 ou 2 ] [ skin ]");
- else
- {
- INI_Open("KOAD/data/config.ini");
- if(tipo == 1)
- {
- DataInfo[SkinA] = skin;
- INI_WriteInt("SkinA", DataInfo[SkinA]);
- foreach(Player, pid) if(PlayerInfo[pid][pTime] == TIME_A) SetPlayerSkin(playerid, DataInfo[SkinA]);
- }
- else if(tipo == 2)
- {
- DataInfo[SkinB] = skin;
- INI_WriteInt("SkinB", DataInfo[SkinB]);
- foreach(Player, pid) if(PlayerInfo[pid][pTime] == TIME_B) SetPlayerSkin(playerid, DataInfo[SkinB]);
- }
- else return SendClientMessage(playerid, COR_VERDE, "Server: {FFFFFF}ERRO, use time 1 ou 2");
- format(Str, sizeof(Str), "Server: {FFFFFF}%s setou a skin do time %d para %d.",GetName(playerid), tipo, skin);
- SendClientMessageToAll(COR_VERDE, Str);
- INI_Save();
- INI_Close();
- return 1;
- }
- }
- CMD:kick(playerid, params[])
- {
- if(PlayerInfo[playerid][pAdmin] == 0) return SendClientMessage(playerid, COR_VERMELHO, "Server:{FFFFFF} Erro, você precisa ser um administrador para usar este comando.");
- new pid, motivo[30], Str[128];
- if(sscanf(params, "ds[32]",pid, motivo)) return SendClientMessage(playerid,-1,"Use: /kick [ playerid ] [ motivo ]");
- else
- {
- format(Str, sizeof(Str), "Server: {FFFFFF}%s kickou %s por %s.",GetName(playerid), GetName(pid), motivo);
- SendClientMessageToAll(COR_VERMELHO, Str);
- Kick(pid);
- return 1;
- }
- }
- CMD:ban(playerid, params[])
- {
- if(PlayerInfo[playerid][pAdmin] == 0) return SendClientMessage(playerid, COR_VERMELHO, "Server:{FFFFFF} Erro, você precisa ser um administrador para usar este comando.");
- new pid, motivo[30], Str[128];
- if(sscanf(params, "ds[32]",pid, motivo)) return SendClientMessage(playerid,-1,"Use: /kick [ playerid ] [ motivo ]");
- else
- {
- format(Str, sizeof(Str), "Server: {FFFFFF}%s ban %s por %s.",GetName(playerid), GetName(pid), motivo);
- SendClientMessageToAll(COR_VERMELHO, Str);
- PlayerInfo[pid][pBanned] = 1;
- BanEx(pid, motivo);
- return 1;
- }
- }
- CMD:afk(playerid, params[])
- {
- if(PlayerInfo[playerid][pAdmin] == 0) return SendClientMessage(playerid, COR_VERMELHO, "Server:{FFFFFF} Erro, você precisa ser um administrador para usar este comando.");
- if(PlayerInfo[playerid][afk])
- {
- PlayerInfo[playerid][afk] = false;
- SendClientMessage(playerid, COR_ALARANJADO, "Server:{FFFFFF} Você saiu do modo AFK");
- return 1;
- }
- if(!PlayerInfo[playerid][afk])
- {
- PlayerInfo[playerid][afk] = true;
- SendClientMessage(playerid, COR_ALARANJADO, "Server:{FFFFFF} Você entrou no modo AFK");
- return 1;
- }
- return 1;
- }
- CMD:criararena(playerid, params[])
- {
- if(PlayerInfo[playerid][pAdmin] == 0) return SendClientMessage(playerid, COR_VERMELHO, "Server:{FFFFFF} Erro, você precisa ser um administrador para usar este comando.");
- if(!MapaInfo[MapaCriando]) ShowPlayerDialog(playerid,DIALOG_CRIAR_ARENA,DIALOG_STYLE_INPUT,"KOAD - BR","Bem vindo ao gerador de arenas. Para continuar, digite o nome da proxima arena e avance. Após a primeira etapa não será possível mais volta atrás.","Avançar >>","Cancelar");
- else ShowPlayerDialog(playerid,DIALOG_CRIANDO_ARENA,DIALOG_STYLE_LIST,"KOAD - BR | Map Creator","Spawn Time A\nSpawn Time B\nCheckpoint dominável\nSalvar","Selecionar","Fechar");
- return 1;
- }
- CMD:kill(playerid, params[])
- {
- if(PlayerInfo[playerid][pAdmin] == 0) return SendClientMessage(playerid, COR_VERMELHO, "Server:{FFFFFF} Erro, você precisa ser um administrador para usar este comando.");
- SetPlayerHealth(playerid, -0.1);
- return 1;
- }
- CMD:iniciarad(playerid, params[])
- {
- if(PlayerInfo[playerid][pAdmin] == 0) return SendClientMessage(playerid, COR_VERMELHO, "Server:{FFFFFF} Erro, você precisa ser um administrador para usar este comando.");
- if(ServerInfo[ActionMode]) return SendClientMessage(playerid, COR_VERMELHO, "Erro:{FFFFFF} Algum mapa está ativo, espere o round acabar ou finalize-o manualmente");
- new mapa[32], diretorio[64];
- if(sscanf(params, "s[32]",mapa)) return SendClientMessage(playerid,-1,"Use: /iniciarmapa [Mapa]");
- format(diretorio, sizeof(diretorio), "KOAD/Mapas/Arenas/%s.ini",mapa);
- if(!fexist(diretorio)) return SendClientMessage(playerid, COR_VERMELHO, "Erro: O mapa não existe");
- if(ContarPlayers() < 2) return SendClientMessage(playerid, COR_VERMELHO, "Erro: Precisa-se de pelo menos 2 players para iniciar-se um A/D");
- ServerInfo[ActionMode] = true;
- INI_Open(diretorio);
- MapaInfo[MapaXA] = INI_ReadFloat("MapaXA");
- MapaInfo[MapaYA] = INI_ReadFloat("MapaYA");
- MapaInfo[MapaZA] = INI_ReadFloat("MapaZA");
- MapaInfo[MapaXB] = INI_ReadFloat("MapaXB");
- MapaInfo[MapaYB] = INI_ReadFloat("MapaYB");
- MapaInfo[MapaZB] = INI_ReadFloat("MapaZB");
- MapaInfo[MapaXC] = INI_ReadFloat("MapaXC");
- MapaInfo[MapaYC] = INI_ReadFloat("MapaYC");
- MapaInfo[MapaZC] = INI_ReadFloat("MapaZC");
- INI_Close();
- TeamInfo[Defensores] = random(2) + 1;
- foreach(Player, pid)
- {
- if(TeamInfo[Defensores] == 1 && PlayerInfo[pid][pTime] == 1) PlayerInfo[pid][pDefenserState] = true;
- else if(TeamInfo[Defensores] == 1 && PlayerInfo[pid][pTime] == 2) PlayerInfo[pid][pDefenserState] = false;
- else if(TeamInfo[Defensores] == 2 && PlayerInfo[pid][pTime] == 2) PlayerInfo[pid][pDefenserState] = true;
- else if(TeamInfo[Defensores] == 2 && PlayerInfo[pid][pTime] == 1) PlayerInfo[pid][pDefenserState] = false;
- if(PlayerInfo[pid][pLogged])
- {
- if(!PlayerInfo[pid][afk])
- {
- if(PlayerInfo[pid][pDefenserState] == true)
- {
- SetPlayerPos(pid, MapaInfo[MapaXA], MapaInfo[MapaYA], MapaInfo[MapaZA]);
- PlayerInfo[pid][pInArena] = true;
- ResetPlayerWeapons(pid);
- GivePlayerWeapon(pid, DataInfo[Arma1], DataInfo[Mun1]);
- GivePlayerWeapon(pid, DataInfo[Arma2], DataInfo[Mun2]);
- GivePlayerWeapon(pid, DataInfo[Arma3], DataInfo[Mun3]);
- ShowPlayerDialog(pid, 1, DIALOG_STYLE_MSGBOX, "KOAD - BR", "Iniciando um novo round...\n\n\nA entrar em jogo como {FF00FF}defensor.{FFFFFF}\n\n\nNão deixe sua base ser dominada até o tempo acabar!", "Fechar", "");
- }
- if(PlayerInfo[pid][pDefenserState] == false)
- {
- SetPlayerPos(pid, MapaInfo[MapaXB], MapaInfo[MapaYB], MapaInfo[MapaZB]);
- PlayerInfo[pid][pInArena] = true;
- GivePlayerWeapon(pid, DataInfo[Arma1], DataInfo[Mun1]);
- GivePlayerWeapon(pid, DataInfo[Arma2], DataInfo[Mun2]);
- GivePlayerWeapon(pid, DataInfo[Arma3], DataInfo[Mun3]);
- ShowPlayerDialog(pid, 1, DIALOG_STYLE_MSGBOX, "KOAD - BR", "Iniciando um novo round...\n\n\nA entrar em jogo como {FF00FF}atacante.{FFFFFF}\n\n\nDomine a base inimiga!", "Fechar", "");
- }
- SetPlayerCheckpoint(pid, MapaInfo[MapaXC], MapaInfo[MapaYC], MapaInfo[MapaZC], 3);
- }
- else SendClientMessage(playerid, COR_VERDE, "Server: {FFFFFF}Você não pôde participar da arena pois você está AFK.");
- }
- }
- Gangzone = GangZoneCreate(MapaInfo[MapaXC]-100, MapaInfo[MapaYC]-100, MapaInfo[MapaXC]+100, MapaInfo[MapaYC]+100);
- GangZoneShowForAll(Gangzone, COR_VERDE);
- GangZoneFlashForAll(Gangzone,COR_VERMELHO);
- ServerInfo[TimeDom] = DataInfo[TempoDom];
- TimerGZdom = SetTimer("GZDOM", 1000, true);
- format(ServerInfo[CurrentMap], sizeof(ServerInfo[CurrentMap]), "%s",mapa);
- SendRconCommand(ServerInfo[CurrentMap]);
- return 1;
- }
- CMD:creditos(playerid, params[])
- {
- if(PlayerInfo[playerid][pAdmin] == 0) return SendClientMessage(playerid, COR_VERMELHO, "Server:{FFFFFF} Erro, você precisa ser um administrador para usar este comando.");
- return ShowPlayerDialog(playerid, 1, DIALOG_STYLE_MSGBOX, "KOAD - BR", "Obrigado por ver os créditos!\n\n\nGamemode KOAD feito por {FF00FF}[Kz]Kuddy{FFFFFF}\n\n\n", "Fechar", "");
- }
- CMD:tempodominar(playerid, params[])
- {
- if(PlayerInfo[playerid][pAdmin] == 0) return SendClientMessage(playerid, COR_VERMELHO, "Server:{FFFFFF} Erro, você precisa ser um administrador para usar este comando.");
- new tempo, Str[128];
- if(sscanf(params, "d",tempo)) return SendClientMessage(playerid,-1,"Use: /tempodominar [tempo em segundos]");
- else
- {
- DataInfo[TempoDom] = tempo;
- INI_Open("KOAD/data/config.ini");
- INI_WriteInt("TempoDom", DataInfo[TempoDom]);
- format(Str, sizeof(Str), "Server: {FFFFFF}%s alterou o tempo de dominar no A/D para %d.",GetName(playerid), tempo);
- SendClientMessageToAll(COR_VERDE, Str);
- INI_Save();
- INI_Close();
- return 1;
- }
- }
- CMD:armar(playerid, params[])
- {
- if(PlayerInfo[playerid][pAdmin] == 0) return SendClientMessage(playerid, COR_VERMELHO, "Server:{FFFFFF} Erro, você precisa ser um administrador para usar este comando.");
- GivePlayerWeapon(playerid, 31, 99999);
- return 1;
- }
- CMD:setararma(playerid, params[])
- {
- if(PlayerInfo[playerid][pAdmin] == 0) return SendClientMessage(playerid, COR_VERMELHO, "Server:{FFFFFF} Erro, você precisa ser um administrador para usar este comando.");
- new Str[128], slot, arma, municao;
- if(sscanf(params, "ddd",slot, arma, municao)) return SendClientMessage(playerid,-1,"Use: /armas [1-3] [ID da arma] [Munição]");
- else
- {
- INI_Open("KOAD/data/config.ini");
- switch(slot)
- {
- case 1:
- {
- INI_WriteInt("Arma1", arma);
- INI_WriteInt("Mun1", municao);
- DataInfo[Arma1] = arma;
- DataInfo[Mun1] = municao;
- }
- case 2:
- {
- INI_WriteInt("Arma2", arma);
- INI_WriteInt("Mun2", municao);
- DataInfo[Arma2] = arma;
- DataInfo[Mun2] = municao;
- }
- case 3:
- {
- INI_WriteInt("Arma3", arma);
- INI_WriteInt("Mun3", municao);
- DataInfo[Arma3] = arma;
- DataInfo[Mun3] = municao;
- }
- default: return SendClientMessage(playerid, COR_VERMELHO, "Server:{FFFFFF} Erro, utilise o slot de 1 a 3!");
- }
- format(Str, sizeof(Str), "Server: {FFFFFF}%s alterou as armas de arena.",GetName(playerid));
- SendClientMessageToAll(COR_VERDE, Str);
- INI_Save();
- INI_Close();
- return 1;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement