[pawn]new Xp[256], VoteKick[MAX_PLAYERS];
new file[ 128 ];[/pawn]
[pawn] else if (strcmp(cmd, "!votekick", true) == 0) {
tmp = strtok( cmdtext, idx ), plr = FindPlayerIDFromString( tmp );
if (!strlen(tmp)) SendClientMessage(playerid, 0x333AFFF,"Write: !votekick <name/id>");
else
{
if(VoteKick[playerid] == 1)
{
SendClientMessage(playerid,0xAA3333AA,"You already Vote");
}
if(VoteKick[playerid] == 0) {
format( szMsg, sizeof( szMsg ), "Player [%s] calls votekick for [%s] ",gPlayers[playerid],gPlayers[plr]);
SendClientMessageToAll(0x333AFFF, szMsg );
format( szMsg, sizeof( szMsg ), "For Vote Write !votekick %s",gPlayers[plr]);
SendClientMessageToAll(0x333AFFF, szMsg );
DarVoteKick(plr,1);
SetTimer( "Votando", 120000,false);
VoteKick[playerid] = 1;
format( szMsg, sizeof( szMsg ), "VoteKick [%s], [%s] ",gPlayers[plr],VoteKickLevel(ObtenerVoteKick(plr)));
SendClientMessageToAll(0x333AFFF, szMsg );
}
if (ObtenerVoteKick(plr) == 5)
{
Kick(plr);
format( szMsg, sizeof( szMsg ), "Player [%s] Is kicked Reason [VoteKick]",gPlayers[plr]);
SendClientMessageToAll(0xAA3333FF, szMsg );
SetTimer( "VotoBorrado", 5000,false);
KillTimer(120000);
}
}
return 1;
}[/pawn]
[pawn]//==============================================================================
public VotoBorrado() {
for(new i = 0; i < MAX_PLAYERS; i++) {
if(IsPlayerConnected(i)) {
if(VoteKick
== 1) {
SendClientMessage(i,0x0FCD18FF,"Now You Cant Vote Again");
VoteKick = 0;
}
}
}
}
//==============================================================================
public Votando() {
for(new i = 0; i < MAX_PLAYERS; i++) {
if(IsPlayerConnected(i)) {
SendClientMessage(i,0x0FCD18FF,"VoteKick is canceled 2 minutes passed");
QuitaVoteKick(i);
VoteKick = 0;
}
}
}
//==============================================================================
public ObtenerVoteKick(playerid)
{
format(Xp,256, REGISTROS, gPlayers[playerid]); //Please change "REGISTROS" and put your folder name of registers
new vote; vote = dini_Int(Xp,"VoteKick");
return vote;
}
public DarVoteKick( playerid, Amount )
{
format( file, sizeof( file ), REGISTROS, gPlayers[ playerid ] ); //Please change "REGISTROS" and put your folder name of registers
new votekick; votekick = dini_Int( file, "VoteKick" );
dini_IntSet( file, "VoteKick", votekick +Amount);
}
public QuitaVoteKick(playerid)
{
format(Xp,256, REGISTROS, gPlayers[playerid]); //Please change "REGISTROS" and put your folder name of registers
dini_Unset(Xp,"VoteKick");
}
//==============================================================================
public VoteKickLevel(level)
{
new lvl[256];
if (level == 1) lvl = "1";
if (level == 2) lvl = "2";
if (level == 3) lvl = "3";
if (level == 4) lvl = "4";
else if (level == 5) lvl = "5";
return lvl;
}
//================================================
[/pawn]
This Command is for make a vote and if the player have 5 vote es automatic kicked