Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- VISITE NOSSO SITE: http://www.sampknd.com/
- VISITE NOSSO FACEBOOK: http://www.facebook.com/SampKnd
- SAMP KND MELHOR BLOG DE SAMP DO BRASIL
- */
- #include < a_samp >
- #include < ZCMD >
- #include < sscanf >
- /* DEFINES */
- #define PRESSED(%0) \
- (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0))) // By deregudegu
- /* Cores */
- #define CorSucesso 0x00FFFFFF
- #define CorErro 0xFF4500FF
- #define CorErroNeutro 0xFFFFFFFF
- #define Branco 0xFFFFFFFF
- #define Preto 0x000000FF
- #define VermelhoEscuro 0xB22222FF
- /* NEW's */
- new MotivovKick[56],
- Str[256],
- VotosP = 0,
- VotosN = 0,
- SendoKickado = -1,
- TimerVKick,
- TempoParaKickar,
- /* Bool's */
- bool:JaVotou[MAX_PLAYERS] = false,
- bool:VotacaoIniciada = false,
- bool:IniciouVotacao[MAX_PLAYERS] = false,
- /* Text's */
- Text:TVotacao,
- Text:TBox,
- Text:TKickar,
- Text:TNome,
- Text:TAFavor,
- Text:TContra,
- Text:TTempo;
- /* FORWARD's */
- forward Kickar(playerid);
- forward vKick();
- forward LiberarVotacao(playerid);
- /* PUBLIC's */
- public LiberarVotacao(playerid)
- {
- IniciouVotacao[playerid] = false;
- return 1;
- }
- public Kickar(playerid)
- {
- // SendClientMessage(playerid, -1, #Kickado); Caso queira testar o FS sem ser kickado, altere aqui.
- Kick(playerid);
- return 1;
- }
- public vKick()
- {
- TempoParaKickar--;
- //
- if(TempoParaKickar == 0)
- {
- KillTimer(TimerVKick);
- //
- if(VotosP > VotosN)
- {
- format(Str, sizeof(Str), "AdmCmd: O Player %s foi kickado pelo administrador automático. Motivo: [Votação] %s", GetPlayerNameEx(SendoKickado), MotivovKick);
- SendClientMessageToAll(VermelhoEscuro, Str);
- KickP(SendoKickado);
- }
- if(VotosP == VotosN || VotosN > VotosP)
- {
- format(Str, sizeof(Str), "AdmCmd: A votação para kickar o jogador %s foi encerrada e o mesmo não foi kickado.", GetPlayerNameEx(SendoKickado));
- SendClientMessageToAll(VermelhoEscuro, Str);
- }
- TextDrawHideForAll(TVotacao);
- TextDrawHideForAll(TBox);
- TextDrawHideForAll(TKickar);
- TextDrawHideForAll(TNome);
- TextDrawHideForAll(TAFavor);
- TextDrawHideForAll(TContra);
- TextDrawHideForAll(TTempo);
- //
- VotosP = 0;
- VotosN = 0;
- SendoKickado = -1;
- VotacaoIniciada = false;
- for(new i = 0; i < MAX_PLAYERS; i++)
- {
- if(IsPlayerConnected(i)) JaVotou[i] = false;
- }
- return 0;
- }
- format(Str, 256, "A FAVOR: %i", VotosP);
- TextDrawSetString(TAFavor, Str);
- //
- format(Str, 256, "CONTRA: %i", VotosN);
- TextDrawSetString(TContra, Str);
- //
- format(Str, 256, "%i", TempoParaKickar);
- TextDrawSetString(TTempo, Str);
- //
- TextDrawShowForAll(TAFavor);
- TextDrawShowForAll(TContra);
- TextDrawShowForAll(TTempo);
- return 1;
- }
- public OnFilterScriptInit()
- {
- print("\n--------------------------------------");
- print("| gKick Carregado com Sucesso |");
- print("--------------------------------------\n");
- //
- TVotacao = TextDrawCreate(515.000000, 118.000000, "VOTACAO:");
- TextDrawBackgroundColor(TVotacao, 255);
- TextDrawFont(TVotacao, 1);
- TextDrawLetterSize(TVotacao, 0.500000, 1.000000);
- TextDrawColor(TVotacao, -16711681);
- TextDrawSetOutline(TVotacao, 0);
- TextDrawSetProportional(TVotacao, 1);
- TextDrawSetShadow(TVotacao, 1);
- TBox = TextDrawCreate(515.000000, 118.000000, "~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~");
- TextDrawBackgroundColor(TBox, 255);
- TextDrawFont(TBox, 1);
- TextDrawLetterSize(TBox, 0.500000, 1.000000);
- TextDrawColor(TBox, -16711681);
- TextDrawSetOutline(TBox, 0);
- TextDrawSetProportional(TBox, 1);
- TextDrawSetShadow(TBox, 1);
- TextDrawUseBox(TBox, 1);
- TextDrawBoxColor(TBox, 1768515925);
- TextDrawTextSize(TBox, 600.000000, 0.000000);
- TKickar = TextDrawCreate(529.000000, 132.000000, "KICKAR:");
- TextDrawBackgroundColor(TKickar, 255);
- TextDrawFont(TKickar, 1);
- TextDrawLetterSize(TKickar, 0.419999, 0.799998);
- TextDrawColor(TKickar, -65281);
- TextDrawSetOutline(TKickar, 0);
- TextDrawSetProportional(TKickar, 1);
- TextDrawSetShadow(TKickar, 1);
- TNome = TextDrawCreate(557.000000, 143.000000, "MAX_PLAYER_NAME");
- TextDrawAlignment(TNome, 2);
- TextDrawBackgroundColor(TNome, 255);
- TextDrawFont(TNome, 1);
- TextDrawLetterSize(TNome, 0.250000, 0.899999);
- TextDrawColor(TNome, 16777215);
- TextDrawSetOutline(TNome, 0);
- TextDrawSetProportional(TNome, 1);
- TextDrawSetShadow(TNome, 1);
- TAFavor = TextDrawCreate(557.000000, 170.000000, "A FAVOR: 99");
- TextDrawAlignment(TAFavor, 2);
- TextDrawBackgroundColor(TAFavor, 255);
- TextDrawFont(TAFavor, 1);
- TextDrawLetterSize(TAFavor, 0.280000, 1.000000);
- TextDrawColor(TAFavor, -1);
- TextDrawSetOutline(TAFavor, 0);
- TextDrawSetProportional(TAFavor, 1);
- TextDrawSetShadow(TAFavor, 1);
- TContra = TextDrawCreate(559.000000, 182.000000, "CONTRA: 99");
- TextDrawAlignment(TContra, 2);
- TextDrawBackgroundColor(TContra, 255);
- TextDrawFont(TContra, 1);
- TextDrawLetterSize(TContra, 0.280000, 1.000000);
- TextDrawColor(TContra, -1);
- TextDrawSetOutline(TContra, 0);
- TextDrawSetProportional(TContra, 1);
- TextDrawSetShadow(TContra, 1);
- TTempo = TextDrawCreate(558.000000, 202.000000, "99");
- TextDrawAlignment(TTempo, 2);
- TextDrawBackgroundColor(TTempo, 255);
- TextDrawFont(TTempo, 1);
- TextDrawLetterSize(TTempo, 0.680000, 3.000000);
- TextDrawColor(TTempo, -1094795521);
- TextDrawSetOutline(TTempo, 0);
- TextDrawSetProportional(TTempo, 1);
- TextDrawSetShadow(TTempo, 1);
- return 1;
- }
- public OnFilterScriptExit()
- {
- TextDrawHideForAll(TVotacao);
- TextDrawHideForAll(TBox);
- TextDrawHideForAll(TKickar);
- TextDrawHideForAll(TNome);
- TextDrawHideForAll(TAFavor);
- TextDrawHideForAll(TContra);
- TextDrawHideForAll(TTempo);
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- if(playerid == SendoKickado)
- {
- KillTimer(TimerVKick);
- format(Str, sizeof(Str), "AdmCmd: A votação para kickar o jogador %s foi encerrada pois o mesmo saiu do jogo.", GetPlayerNameEx(SendoKickado));
- SendClientMessageToAll(VermelhoEscuro, Str);
- //
- TextDrawHideForAll(TVotacao);
- TextDrawHideForAll(TBox);
- TextDrawHideForAll(TKickar);
- TextDrawHideForAll(TNome);
- TextDrawHideForAll(TAFavor);
- TextDrawHideForAll(TContra);
- TextDrawHideForAll(TTempo);
- //
- VotosP = 0;
- VotosN = 0;
- SendoKickado = -1;
- VotacaoIniciada = false;
- for(new i = 0; i < MAX_PLAYERS; i++)
- {
- if(IsPlayerConnected(i)) JaVotou[i] = false;
- }
- }
- return 1;
- }
- public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
- {
- if(VotacaoIniciada == true)
- {
- if(PRESSED(KEY_ANALOG_LEFT)) // NUM 4
- {
- if(JaVotou[playerid] == false)
- {
- VotosP++;
- SendClientMessage(playerid, CorSucesso, "O seu Voto foi computado com Sucesso, bom jogo.");
- JaVotou[playerid] = true;
- }
- }
- if(PRESSED(KEY_ANALOG_RIGHT)) // NUM 6
- {
- if(JaVotou[playerid] == false)
- {
- VotosN++;
- SendClientMessage(playerid, CorSucesso, "O seu Voto foi computado com Sucesso, bom jogo.");
- JaVotou[playerid] = true;
- }
- }
- }
- return 1;
- }
- /* Comandos's */
- CMD:vkick(playerid, params[])
- {
- if(VotacaoIniciada == true) return SendClientMessage(playerid, CorErro, "Já existe uma contagem em andamento, por favor, tente novamente quando a mesma acabar.");
- if(sscanf(params, "is", SendoKickado, MotivovKick)) return SendClientMessage(playerid, CorErroNeutro, "USE: /vkick [ID] [MOTIVO]");
- if(!IsPlayerConnected(SendoKickado)) return SendClientMessage(playerid, CorErro, "Este ID não está conectado.");
- if(IniciouVotacao[playerid] == true) return SendClientMessage(playerid, CorErro, "As votações iniciadas por você precisam ter 1 minuto de intervalo entre elas.");
- //
- //
- format(Str, 256, "{FF8C00}Foi iniciada uma votação para Kickar o jogador %s pelo motivo %s.", GetPlayerNameEx(SendoKickado), MotivovKick);
- SendClientMessageToAll(Preto, Str);
- SendClientMessageToAll(Preto, "{FF8C00}USE: /aprovo ou pressione NUM4 para kická-lo e /reprovo ou NUM6 para mantê-lo no game.");
- //
- format(Str, sizeof(Str), "%s", GetPlayerNameEx(SendoKickado));
- TextDrawSetString(TNome, Str);
- //
- TextDrawSetString(TTempo, "20");
- TempoParaKickar = 20;
- //
- VotosP = 0;
- VotosN = 0;
- //
- format(Str, 256, "A FAVOR: %i", VotosP);
- TextDrawSetString(TAFavor, Str);
- //
- format(Str, 256, "CONTRA: %i", VotosN);
- TextDrawSetString(TContra, Str);
- //
- TextDrawShowForAll(TVotacao);
- TextDrawShowForAll(TBox);
- TextDrawShowForAll(TKickar);
- TextDrawShowForAll(TNome);
- TextDrawShowForAll(TAFavor);
- TextDrawShowForAll(TContra);
- TextDrawShowForAll(TTempo);
- //
- TimerVKick = SetTimer("vKick", 1000, true);
- VotacaoIniciada = true;
- IniciouVotacao[playerid] = true;
- SetTimerEx("LiberarVotacao", 1000 * 60, false, "i", playerid);
- return 1;
- }
- CMD:aprovo(playerid)
- {
- if(VotacaoIniciada == false) return SendClientMessage(playerid, CorErro, "Nenhuma votação foi iniciada");
- if(JaVotou[playerid] == true) return SendClientMessage(playerid, CorErro, "Só é permitido um voto por pessoa.");
- JaVotou[playerid] = true;
- VotosP++;
- SendClientMessage(playerid, CorSucesso, "Seu voto foi contabilizado");
- return 1;
- }
- CMD:reprovo(playerid)
- {
- if(VotacaoIniciada == false) return SendClientMessage(playerid, CorErro, "Nenhuma votação foi iniciada");
- if(JaVotou[playerid] == true) return SendClientMessage(playerid, CorErro, "Só é permitido um voto por pessoa.");
- JaVotou[playerid] = true;
- VotosN++;
- SendClientMessage(playerid, CorSucesso, "Seu voto foi contabilizado");
- return 1;
- }
- /* STOCKS's */
- stock GetPlayerNameEx(playerid)
- {
- new pNome[24];
- GetPlayerName(playerid, pNome, 24);
- return pNome;
- }
- stock KickP(playerid)
- {
- SetTimerEx("Kickar", 1000, false, "i", playerid);
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement