Vice City Multiplayer

VC:MP 0.3 => mIRC/pawn Scripting => ShowRoom (pawn) => Topic started by: aledark24 on August 10, 2013, 10:20:31 pm

Title: Votekick, Command (is the one of a kind in vcmp)
Post by: aledark24 on August 10, 2013, 10:20:31 pm
[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

(https://fbcdn-sphotos-d-a.akamaihd.net/hphotos-ak-ash4/1001538_10201533515677555_1854423173_n.jpg)

(https://fbcdn-sphotos-b-a.akamaihd.net/hphotos-ak-prn2/1069929_10201533515477550_1870935384_n.jpg)
Title: Re: Votekick, Command (is the one of a kind in vcmp)
Post by: [AoD]NC on August 11, 2013, 12:59:22 am
[BlackWarrior] is exited of the server (Kicked/Banned)
wut?
Title: Re: Votekick, Command (is the one of a kind in vcmp)
Post by: NeskWriter on August 11, 2013, 10:00:34 am
Yeah nice one but could u edit it to allow players vote for kick or not for kick (like: "!vote y/n")? For example if there's only 3 players and one of them is hacking, the dudes that voted are only 2, not 5. So if the dude that is hacking gets more votes for being kicked, he will be, or if not - he will not. :)
Title: Re: Votekick, Command (is the one of a kind in vcmp)
Post by: heekz.shadow on August 11, 2013, 02:30:28 pm
It sounds stupid to me that if 2 players are on the server and they do !votekick on another guy ( 3 players ) that guy will never be kicked.


You could do an average of the players ( I suppose they teach that in Spain in your grade ) and then use it at the max players instead of 5.

And no it's not one of a kind, lots of people done it before you including me.
Title: Re: Votekick, Command (is the one of a kind in vcmp)
Post by: sseebbyy on August 11, 2013, 04:12:18 pm
And no it's not one of a kind, lots of people done it before you including me.

Why you guys are pointing this so much ? It was done before, I'm sure about this, but no one posted it ! Do you see it on the VC:MP Forums ? because I don't.

I hope it works good, because scripters may try to learn from it. ;)



By the way, players will start to vote Yes just to be bad, to have their own ridiculous fun.

I suggest you to make this command just for admins, so if on the server will be connected just 2 players, one of them should be an admin, and it not make any sense to request a VoteKick since him can kick the "bad" player with kick command.



and shadow is right with this suggestion:

You could do an average of the players and then use it at the max players instead of 5.

or just more than a half. (and maybe you add and some variables, to cannot start the kick vote when are just less than 5 players connected)
Title: Re: Votekick, Command (is the one of a kind in vcmp)
Post by: omersami2 on November 29, 2013, 01:44:05 am
[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

(https://fbcdn-sphotos-d-a.akamaihd.net/hphotos-ak-ash4/1001538_10201533515677555_1854423173_n.jpg)

(https://fbcdn-sphotos-b-a.akamaihd.net/hphotos-ak-prn2/1069929_10201533515477550_1870935384_n.jpg)
Nice Work Man I Appreciate Your Work