vote kick from dany [ bug ]

Started by Kewun, May 28, 2016, 09:41 AM

Previous topic - Next topic

Kewun

there is a bug, i didnt want to bump his topic of script
so, i can votekick a player, but i can vote him milion times using /vote command, and he will get kicked
players can abuse the /vote command, please fix it!

Cool

#1
check if player is already voted message him you already voted
for example if ( pstats[player.ID].Noob ) MessagePlayer("you are a noob.",player);
are u sure you are using this http://forum.vc-mp.org/?topic=345.0

Kewun

   else if( cmd == "vote" )
{
if( !text ) MessagePlayer("[#FF0000][Syntax]:[#ADFF2F] /vote <Nick/ID>.", player );
else
{
local plr = GetPlayer( text );
if( !plr ) MessagePlayer("[#FF0000][Error]:[#F5F5F5]Invalid Player.", player );
else if(( plr ) && ( !stats[ plr.ID ].VKick )) MessagePlayer("[#F5F5F5][Info]:[#ADFF2F]there is no vote kick on that player..", player );
else if(( plr ) && ( stats[ player.ID ].Voted == plr.Name )) MessagePlayer("[#F5F5F5][Info]:[#ADFF2F]you already voted!", player );
else
{
Message("[#ADFF2F][VoteKick]:[#FFFF00]" + player.Name + " has voted agaisnt " + plr.Name + "." );
Message("[#ADFF2F][votekick]:[#F5F5F5]vote count on " + plr.Name + " - [ " + stats[ plr.ID ].Count + "/3]." );
stats[ plr.ID ].Count++;
}
}
}
}

Kewun

i think the error is

   else if(( plr ) && ( stats[ player.ID ].Voted == plr.Name )) MessagePlayer("[#F5F5F5][Info]:[#ADFF2F]you already voted!", player );

and yeah im using http://forum.vc-mp.org/?topic=345.0

Anik


Coolkid

#5
add this on top in class PlayerStats
Voted = false
and here your command
else if( cmd == "vote" )
 {
  if( !text ) MessagePlayer("[#FF0000][Syntax]:[#ADFF2F] /vote <Nick/ID>.", player );
  else
  {
   local plr = GetPlayer( text );
   if( !plr ) MessagePlayer("[#FF0000][Error]:[#F5F5F5]Invalid Player.", player );
   else if(( plr ) && ( !stats[ plr.ID ].VKick )) MessagePlayer("[#F5F5F5][Info]:[#ADFF2F]there is no vote kick on that player..", player );
   else if(( plr ) && ( stats[ player.ID ].Voted == true )) MessagePlayer("[#F5F5F5][Info]:[#ADFF2F]you already voted!", player );
   else
   {
    Message("[#ADFF2F][VoteKick]:[#FFFF00]" + player.Name + " has voted agaisnt " + plr.Name + "." );
    Message("[#ADFF2F][votekick]:[#F5F5F5]vote count on " + plr.Name + " - [ " + stats[ plr.ID ].Count + "/3]." );
    stats[ plr.ID ].Count++;
stats[ player.ID ].Voted = true;
   }
  }
 }
}

Kewun

OMG THX MAN FINALLY! <3 u
(k no homo) ::)
anyway, thanks!!!