Vote Kick

Started by PsyChO_KiLLeR, Mar 06, 2015, 08:20 AM

Previous topic - Next topic

PsyChO_KiLLeR

Well i try to add Vote Kick system of ADM Script of Dany but its not working when i type /votekick name it doesnt show anything and type /vote name its also not show any thing it just give error on console of OnPlayerCommand VKick Does not exist what it is?

MacTavish

Copy-paste never work some mind needed. Actually i've also added in my server and works well

Make sure you've pasted the stuffclass PlayerStats

{
//that was here
}

Grand Hunting Project
Join #SLC, #KAKAN, #Doom, #GHP @LUnet

Retired VC:MP Player/Scripter :P

.

I think I'm more confused than you are on this one :-\
.

PsyChO_KiLLeR

i already have that playerstats and i already add there this
 VKick = false;
      Voted = "";



jayant

Quote from: PsyChO_KiLLeR on Mar 06, 2015, 08:33 AMi already have that playerstats and i already add there this
 VKick = false;
      Voted = "";
Check it again & again..It worked for Beztone then it also work for you..You should not make topics n topics for things like this..All you to do is copy-paste carefully and edit it according to your script.

PsyChO_KiLLeR

#5
i know that i give there whole system of that vk check it beztone

OnPlayerCommand

else if( cmd == "votekick" )
{
    if( !text ) MessagePlayer( "Syntax: /c votekick <plr>.", player );
else
{
local plr = GetPlayer( text );
if( !plr ) MessagePlayer( "Invalid Player.", player );
else if(( plr ) && ( stats[ plr.ID ].VKick )) MessagePlayer( "An active votekick is present on this player.", player );
else if(( playerson.len() > 2 ) && ( !VK ))
     {
        Message( "A votekick started on " + plr.Name + "." );
        stats[ plr.ID ].VKick = true;
                   VK = true;
        NewTimer( "Check", 10, 1 );
stats[ plr.ID ].Count++;
stats[ player.ID ].Voted = plr.Name;
     } else Message( "There is already a votekick going on. (or) Less than 3 players." );
}
}
else if( cmd == "vote" )
{
    if( !text ) MessagePlayer( "Syntax: /c vote <plr>.", player );
else
{
local plr = GetPlayer( text );
if( !plr ) MessagePlayer( "Invalid Player.", player );
    else if(( plr ) && ( !stats[ plr.ID ].VKick )) MessagePlayer( "No active votekick is present on this player.", player );
    else if (( plr ) && ( stats[ player.ID ].Voted == plr.Name )) MessagePlayer( "Already voted.", player );
    else
       {
         Message( "" + player.Name + " voted against " + plr.Name + "." );
         stats[ plr.ID ].Count++;
stats[ player.ID ].Voted = plr.Name;
       }
}
}
   


Function
function Check()
{
 local plr;
 foreach(playerid, val in playerson ) if ( stats[playerid].VKick ) plr = FindPlayer(playerid);
 local MinVote = playerson.len()/2;
 if ( stats[ plr.ID ].Count > MinVote.tointeger() ) KickPlayer( plr );
    else
    {
      Message( "Votekick on " + plr.Name + " failed [ " + stats[ plr.ID ].Count + "/" + MinVote + "]." );
  stats[ plr.ID ].VKick = false;
  stats[ plr.ID ].Count = 0;
    }
 VK = false;
}



on main.nut start
playerson <- [];
 local VK = false;



class PlayerStats
{
     VKick = false;
      Voted = "";
}




OnScriptLoad

stats <- array( GetMaxPlayers(), null );



Thats it
 

jayant

#6
God... :-X Atleast make use of [ code ] your text here [ /code ]. If you cant do this no one will read that code because its likely impossible to read.
Edit - Thanks for taking time to use [ code ] tags.

Kratos_


I couldn't see the line which specifies " Array as the Class Object " . But , later you're accessing class entities through those arrays .
Post your function onPlayerJoin( player ) .
In the middle of chaos , lies opportunity.

MacTavish

I've posted Dany's votekick system Here

Grand Hunting Project
Join #SLC, #KAKAN, #Doom, #GHP @LUnet

Retired VC:MP Player/Scripter :P