PB-Kick
Estava sem nada pra fazer e sem ideia ai apareceu esta ideia de fazer um sistema igual do Point Blank de uma votação para kickar o jogador indicado, simples mas acho que vai ser útil em servidor de DeathMatch.
Comandos:
Code :
Creditos:
Estava sem nada pra fazer e sem ideia ai apareceu esta ideia de fazer um sistema igual do Point Blank de uma votação para kickar o jogador indicado, simples mas acho que vai ser útil em servidor de DeathMatch.
Comandos:
PHP Code:
indicarkick - Inicia e endica o player
terminarvotacao - Termina a votação
cancelarin - cancela a votação
sim - vota sim
nao - vota nao
#include a_samp #include zcmd #include sscanf #define Manual false #define Automatico true #define Tempo ( 2000 * 60 ) new PlayersOn , JaVotou [ MAX_PLAYERS ] , _IDKick , Votacao_aberta = 0, _Sim, _Nao , _VotacaoTipo@ = Manual , LigadoAutomatic_ = 0; public OnPlayerConnect(playerid) { PlayersOn ++ ; return 1; } public OnPlayerDisconnect(playerid, reason) { PlayersOn -- ; return 1; } command(indicarkick , playerid , params[] ) { new _Id , _string [ 150 ], _Motivo [ 100 ]; if ( PlayersOn < 5 ) return SendClientMessage ( playerid , -1 , "Menos de 5 players não pode ser iniciado a votacao" ) ; if ( !Votacao_aberta ) return SendClientMessage ( playerid , -1 , "Votação já esta aberta " ) ; if ( sscanf ( params , "us" , _Id , _Motivo ) ) return SendClientMessage ( playerid , -1 , "°CMD° /indicarkick [ ID ] [ Motivo ]" ) ; format ( _string , sizeof ( _string ) , "Indicarão o %s para ser kickado [ /sim /nao ] Motivo : %s", PlayerNome (playerid ), _Motivo ) ; SendClientMessageToAll ( -1 , _string ) ; _IDKick = _Id ; if ( _VotacaoTipo@ == Automatico ) { LigadoAutomatic_ = 1 ; SetTimer("Contagem", Tempo, true); } return 1; } command(terminarvotacao , playerid , params[] ) { new _string [ 75 ] ; if ( Votacao_aberta == 1 ) return SendClientMessage ( playerid , -1 , "A Votação não foi iniciado " ) ; if ( LigadoAutomatic_ == 1 ) return SendClientMessage ( playerid , -1 , "A Votação esta automatica " ) ; SendClientMessageToAll ( -1 , "A Votação foi encerrado" ) ; if ( _Sim > _Nao ) { format ( _string ,sizeof ( _string ) , " O Player %s foi kickado . [ Pela Votação ] " , PlayerNome ( _IDKick ) ) ; SendClientMessageToAll ( -1 , _string ) ; Kick ( _IDKick ) ; } if ( _Nao > _Sim ) { SendClientMessageToAll ( -1 , " Ninguem foi kickado pela votacao" ) ; } for(new i=0; i<MAX_PLAYERS; i++) { JaVotou [ i ] = 0 ; } _IDKick = -1 ; _Nao = 0 ; _Sim = 0 ; Votacao_aberta = 0 ; return 1 ; } command(cancelarin , playerid , params [] ) { if ( !Votacao_aberta ) return SendClientMessage ( playerid , -1 , "A Votação não foi iniciado " ) ; if ( LigadoAutomatic_ == 1 ) return SendClientMessage ( playerid , -1 , "A Votação esta automatica " ) ; _IDKick = -1 ; _Nao = 0 ; _Sim = 0 ; Votacao_aberta = 0 ; for(new i=0; i<MAX_PLAYERS; i++) { JaVotou [ i ] = 0 ; } SendClientMessageToAll ( -1 , "Votação cancelada " ) ; return 1 ; } command(sim , playerid , params[] ) { if ( !Votacao_aberta ) return SendClientMessage ( playerid , -1 , "A Votação não foi iniciado " ) ; if ( JaVotou [ playerid ] == 1 ) return SendClientMessage (playerid , -1 , "você ja voto" ) ; _Sim ++ ; JaVotou [ playerid ] = 1 ; SendClientMessage ( playerid , -1 , "Seu voto foi computado" ) ; return 1 ; } command(nao , playerid , params[] ) { if ( !Votacao_aberta ) return SendClientMessage ( playerid , -1 , "A Votação não foi iniciado " ) ; if ( JaVotou [ playerid ] == 1 ) return SendClientMessage (playerid , -1 , "você ja voto" ) ; _Nao ++ ; JaVotou [ playerid ] = 1 ; SendClientMessage ( playerid , -1 , "Seu voto foi computado" ) ; return 1 ; } stock PlayerNome ( playerid ) { new nome [ MAX_PLAYER_NAME ] ; GetPlayerName ( playerid , nome , sizeof ( nome ) ); return nome ; } forward Contagem(); public Contagem() { new _string [ 100 ] ; if ( _Sim > _Nao ) { format ( _string ,sizeof ( _string ) , " O Player %s foi kickado . [ Pela Votação ] " , PlayerNome ( _IDKick ) ) ; SendClientMessageToAll ( -1 , _string ) ; Kick ( _IDKick ) ; } if ( _Nao > _Sim ) { SendClientMessageToAll ( -1 , " Ninguem foi kickado pela votacao" ) ; } for(new i=0; i<MAX_PLAYERS; i++) { JaVotou [ i ] = 0 ; } _IDKick = -1 ; _Nao = 0 ; _Sim = 0 ; Votacao_aberta = 0 ; return 1 ; }
Creditos:
Maurício Moraes (mau.tito)
0 comentários:
Postar um comentário