Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* -=-=-=-=-=-=-=-=-=-=-=-=-=-==-=-==-=-=-=-=-=-=-=-=-=-
- POR FAVOR NÃO REMOVA OS CRÉDITOS
- G-VOTE KICK
- PERFIL: http://forum.sa-mp.com/member.php?u=286494
- Meu skype:
- krazy.samp
- -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=*/
- // INCLUDES
- #include a_samp
- #include zcmd
- #include sscanf2
- // DEFINES
- #define PRESSED(%0) (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
- #define MAX_GVotes 5
- #define GTimer_Encerrar 60000
- // VAR
- new GVotes[MAX_PLAYERS],
- GMotivo[30],
- pID,
- bool:GVotosON,
- bool:GVotou[MAX_PLAYERS],
- stra[128],
- TimerG;
- // CALLBACKS
- public OnFilterScriptInit()
- {
- print("\nFS Criado por GiromB - Não remova os créditos\n");
- GVotosON = false;
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- GVotes[playerid] = 0;
- GVotou[playerid] = false;
- SendClientMessage( playerid, -1, "[INFO] Este servidor possui o script- VOTE KICK, Criado por GiromB!");
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- GVotes[playerid] = 0;
- GVotou[playerid] = false;
- return 1;
- }
- public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
- {
- if( PRESSED(KEY_YES))
- {
- if( GVotosON == true)
- {
- if( GVotou[playerid] == true) return SendClientMessage(playerid, -1, "[ERROR] Você já GVotou!");
- ShowPlayerDialog(playerid, 750, DIALOG_STYLE_MSGBOX, "Vote Kick", stra, "sim ", "nao");
- }
- }
- return 1;
- }
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
- {
- if( dialogid == 750)
- {
- if( response)
- {
- new mNome[MAX_PLAYER_NAME], tNome[MAX_PLAYER_NAME], str[128];
- GetPlayerName(pID, tNome, sizeof(tNome));
- GetPlayerName(playerid, mNome, sizeof(mNome));
- format( str, sizeof( str), "[VOTE KICK] O player %s GVotou para o jogador %s ser kickado [Votos: %i/%i ] ", mNome, tNome, GVotes[pID], MAX_GVotes);
- SendClientMessageToAll( -1, str);
- GVotou[playerid] = true;
- GVotes[pID] ++;
- }
- if( GVotes[pID] > MAX_GVotes)
- {
- new tNome[MAX_PLAYER_NAME], str[128], str2[128];
- GetPlayerName( pID, tNome, sizeof(tNome));
- format( str, sizeof( str), "[VOTE KICK] O player %s foi kickado [GMotivo: %s]", tNome, GMotivo);
- format( str2, sizeof( str2), " Você foi kickado GMotivo: %s \n se acha que isto foi um engano/Abuso contate um Adminstrador", GMotivo);
- ShowPlayerDialog(pID, 751, DIALOG_STYLE_MSGBOX, "Vote Kick", str2, "ok ", "");
- SendClientMessageToAll( -1, str);
- SetTimerEx("KickG", 1000, false, "i", pID);
- KillTimer( TimerG);
- GVotosON = false;
- for( new i = 0, j = GetPlayerPoolSize(); i <= j; i++)
- {
- GVotou[i] = false;
- }
- }
- }
- return 1;
- }
- forward KickG();
- public KickG()
- {
- Kick(pID);
- return 1;
- }
- forward VotacaoG();
- public VotacaoG()
- {
- new tNome[MAX_PLAYER_NAME], str[128];
- GetPlayerName(pID, tNome, sizeof(tNome));
- format( str, sizeof( str), "[VOTE KICK] O player %s NÃO foi kickado pois não houve votos suficientes", tNome);
- SendClientMessageToAll( -1, str);
- for(new i = 0, j = GetPlayerPoolSize(); i <= j; i++)
- {
- GVotou[i] = false;
- }
- GVotosON = false;
- GVotes[pID] = 0;
- return 1;
- }
- // COMANDO[S]
- CMD:votekick(playerid, params[])
- {
- new mNome[MAX_PLAYER_NAME], tNome[MAX_PLAYER_NAME], str[128];
- GetPlayerName( pID, tNome, sizeof( tNome));
- GetPlayerName( playerid, mNome, sizeof( mNome));
- if( GVotosON == true) return SendClientMessage( playerid, -1, "[ERRO]: já existe uma votação em andamento");
- if( GetMaxPlayers() > MAX_GVotes) return SendClientMessage( playerid, -1, "[ERROR] Não tem players online o suficiente para começar a votaçao");
- if( sscanf( params, "is", pID, GMotivo)) return SendClientMessage( playerid, -1, "USE: /votekick [ID] [GMotivo]");
- if( !IsPlayerConnected( pID)) return SendClientMessage( playerid, -1, "[ERRO]: Este jogador não esta conectado.");
- format( str, sizeof( str), "[VOTE KICK] O player %s iniciou uma votação contra o jogador %s [GMotivo: %s]", mNome, tNome, GMotivo);
- format( stra, sizeof( stra), "Votação contra o jogador %s, GMotivo: %s você deseja kicka-lo?",tNome, GMotivo);
- SendClientMessageToAll( -1, "[VOTE KICK] Se você quiser participar da votação aperte 'Y' no seu teclado!");
- SendClientMessageToAll( -1, str);
- TimerG = SetTimer( "VotacaoG", GTimer_Encerrar, false);
- GVotes[pID] = 1;
- GVotosON = true;
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement