Jump to content

Can Someone make a working !Votekick for MTA: SA


HouseMD

Recommended Posts

well ok scoob, if you want it to be perfect, here you go ;)

on *:SIGNAL:mta.command:{
 var %a = $iif($iif($4,$iif($mta.nick($1,$4),$4,$mta.getid($1,$4)),$2),$v1,-1)
 if ($3 == !votekick) {
   if (%vote.nick. [ $+ [ $1 ] ] != $null) mta.pm $1 $2 Another votekick is running: $mta.nick($1,%vote.nick. [ $+ [ $1 ] ])
   elseif ($mta.server($1).players < 3) mta.pm $1 $2 Error - There should be at least 3 players in the server to start a votekick.
   elseif (%a == -1) mta.pm $1 $2 Error - Absent ID/Name
   elseif (%a == $2) mta.pm $1 $2 Error - Can't votekick yourself
   else {
     set %vote.nick. [ $+ [ $1 ] ] %a
     unset %vote.voters. [ $+ [ $1 ] ]
     mta.text $1 Votekick "!vote" if u want that $mta.nick($1,%a) should be kicked. [ $round($calc($mta.server($1).players / 2),0) votes needed] [1 minute]
     .timervote [ $+ [ $1 ] ] 1 60 mta.cancel.votekick $1
   }
 }
 elseif ($3 == !vote) {
   if ((%vote.nick. [ $+ [ $1 ] ] == $null) || (%vote.nick. [ $+ [ $1 ] ] !isnum)) mta.pm $1 $2 No votekick is currently running.
   elseif ($findtok(%vote.voters. [ $+ [ $1 ] ],$2,1,32)) mta.pm $1 $2 $mta.nick($1,$2) $+ , You have already voted.
   else {
     set %vote.voters. [ $+ [ $1 ] ] %vote.voters. [ $+ [ $1 ] ] $2
     if ($numtok(%vote.voters. [ $+ [ $1 ] ],32) >= $round($calc($mta.server($1).players / 2),0)) {
       mta.text $1 $mta.nick($1,%vote.nick. [ $+ [ $1 ] ]) Vote limit reached, $mta.nick($1,%vote.nick. [ $+ [ $1 ] ]) is out!
       mta.kick $1 %vote.nick. [ $+ [ $1 ] ]
       unset %vote.nick. [ $+ [ $1 ] ]
       unset %vote.voters. [ $+ [ $1 ] ]
       .timervote [ $+ [ $1 ] ] off
     }
     else mta.text $1 $numtok(%vote.voters. [ $+ [ $1 ] ],32) votes for $mta.nick($1,%vote.nick. [ $+ [ $1 ] ]) [ $+ $calc($round($calc($mta.server($1).players / 2),0) - $numtok(%vote.voters. [ $+ [ $1 ] ],32)) more votes needed] [ $+ $timer(vote [ $+ [ $1 ] ]).secs seconds left]
   }
 }
}
on *:SIGNAL:mta.part:{
 if ($2 = %vote.nick. [ $+ [ $1 ] ]) mta.cancel.votekick $1
}
alias mta.cancel.votekick {
 mta.text $1 Vote kick cancelled: $mta.nick($1,%vote.nick. [ $+ [ $1 ] ])
 unset %vote.nick. [ $+ [ $1 ] ]
 unset %vote.voters. [ $+ [ $1 ] ]
}

Link to comment
  • 2 weeks later...

Here is my ".ini" version of !votekick with !yes and !no

alias check.part {
 if ($readini($scriptdir $+ vk.ini,part,parted == $readini($scriptdir $+ vk.ini,names,votedon) )) {
   mta.text $1 $readini($scriptdir $+ vk.ini,names,votedon) Parted
   !remini -n vk.ini votedon
   !remini -n vk.ini vote
   !remini -n vk.ini playersvoted
   !remini -n vk.ini names
   !remini -n vk.ini id
   !remini -n vk.ini vk
   !remini -n vk.ini part
 }
}
alias finish.vote {
 if ($readini($scriptdir $+ vk.ini,number,parted >= 1)) {
   !writeini -n vk.ini number parted $calc($readini($scriptdir $+ vk.ini,number,parted) - 1)
 }
 if ($readini($scriptdir $+ vk.ini,vote,players) >= $round($calc($mta.server($1).players / 2),0)) {
   mta.text $1 Vote succeeded! Kicking: $readini($scriptdir $+ vk.ini,names,votedon)
   mta.kick $1 $readini($scriptdir $+ vk.ini,ID,votedon)
   !remini -n vk.ini votedon
   !remini -n vk.ini vote
   !remini -n vk.ini playersvoted
   !remini -n vk.ini names
   !remini -n vk.ini id
   !remini -n vk.ini vk
   !remini -n vk.ini part
 }
 if ($readini($scriptdir $+ vk.ini,vote,players) <= $round($calc($mta.server($1).players / 2),0)) {
   mta.text $1 Vote Unsuccessful for: $readini($scriptdir $+ vk.ini,names,votedon)
   !remini -n vk.ini votedon
   !remini -n vk.ini vote
   !remini -n vk.ini playersvoted
   !remini -n vk.ini names
   !remini -n vk.ini id
   !remini -n vk.ini vk
   !remini -n vk.ini part
 }
}
alias gus.getid {
 var %a = 0
 while (%a <= $mta.server($1).cmax)  {
   if ($+(*,$2,*) iswm $mta.nick($1,%a)) !return %a
   !inc %a
 }
 !return -1
}
on *:SIGNAL:mta.command:{
 var %a = $iif($4,$iif($mta.nick($1,$4) != $null,$4,$gus.getid($1,$4)),$2)
 if ($3 == !votekick) {
   if (%a == -1) mta.pm $1 $2 Error - Absent ID
   if (%a == $2) mta.pm $1 $2 Error - Cannot !votekick yourself
   if ($readini($scriptdir $+ vk.ini,vk,votekick == 1)) mta.pm $1 $2 Another Votekick is already running
   else {
     mta.text $1 A Vote has been initiated to kick $mta.nick($1,%a) by $mta.nick($1,$2) $+ , !Yes and !No [20 Sec] [ $+ $round($calc($mta.server($1).players / 2),0) Votes needed]
     !writeini -n vk.ini vote players 0
     !writeini -n vk.ini playersvoted $mta.nick($1,$2) 0
     !writeini -n vk.ini names votedon $mta.nick($1,%a)
     !writeini -n vk.ini ID votedon %a
     !writeini -n vk.ini vk Votekick 1
     !.timer 1 20 finish.vote $1 %a 
   }
 }
 elseif ($3 == !yes) {
   if ($readini($scriptdir $+ vk.ini,vk,votekick != 1)) mta.pm $1 $2 A !votekick hasn't been started
   if ($readini(vk.ini,playersvoted,$mta.nick($1,$2) == 1)) mta.pm $1 $2 You have already voted 
   else {
     !writeini -n vk.ini vote players $calc($readini($scriptdir $+ vk.ini,vote,players) + 1)
     !writeini -n vk.ini playersvoted $mta.nick($1,$2) 1
     mta.pm $1 $2 You have voted Yes
   }
 }
 elseif ($3 == !no) {
   if ($readini($scriptdir $+ vk.ini,vk,votekick != 1)) mta.pm $1 $2 A !votekick hasn't been started
   if ($readini(vk.ini,playersvoted,$mta.nick($1,$2) == 1)) mta.pm $1 $2 You have already voted 
   else {
     !writeini -n vk.ini vote players $calc($readini($scriptdir $+ vk.ini,vote,players) - 1)
     !writeini -n vk.ini playersvoted $mta.nick($1,$2) 1
     mta.pm $1 $2 You have voted No
   }
 }
}
on *:SIGNAL:mta.part: {
 if ($3 == 0) {
   !writeini -n vk.ini part parted $mta.nick($1,$2)
 }
 check.part $1-
 if ($readini($scriptdir $+ vk.ini,part,parted == $readini($scriptdir $+ vk.ini,names,votedon) )) {
   !writeini -n vk.ini number parted $calc($readini($scriptdir $+ vk.ini,number,parted) + 1)
 }
}

Bugs:

"Absent ID/Name" before !votekick is started, even if u chose the right person

Good:

If person parts...it stops the !votekick on that person

!yes and !no

You cannot be kicked in a server with 2 ppl unless you vote !yes

Cannot say !yes or !no twice

Cannot initiate 2 !votekicks

Bad:

Newbie scripters cannot create a !votekick and !voteban together

Edit: Completed making !votekick and !voteban together, testing

Edit2: Figured out why "Nothing to deny in" message is displayed, There is a !Yes and !No in the main "GUS" script, so you could change them to !yeh and !nah or similar...

Edited by Guest
Link to comment

looks kinda big, i can see many ways u could make it smaller tho, u should use player id's or people can just change their names and revote, also the player ur voting on can just change names. :D

Also, u could put all the !remini lines in 1 alias or just delete the ini totally, that u would shorten it by about 18 lines.

gj anyway, keep at it :)

Link to comment
Scooby, look carefully, I record the "Name" of the person and the ID...actually it would be a better idea if I didn't record the name... And yea...ur right, I'll shorten then !remini's with alias :D

Ahh yeah my bad, i didnt notice u save both... must be coz its the biggest votekick script ive ever seen. :lol:

Link to comment

but it works doesn't it... btw, I almost put the !votekick & !voteban together...Votekick works with 50% and !voteban works with 80% - My friend told me to make it 90% but that would be too much

Edit: Scoob, don't worry, the !votekick and !voteban script will be much bigger :lol:

Link to comment
but it works doesn't it... btw, I almost put the !votekick & !voteban together...Votekick works with 50% and !voteban works with 80% - My friend told me to make it 90% but that would be too much

Edit: Scoob, don't worry, the !votekick and !voteban script will be much bigger :lol:

just working is ok for a start, but once u make a complete script and u check mirc's cpu usage, u will see the difference between just working and working well. u should always try to make things efficiently, i mean ur votekick script was like twice as big as any id seen, imagine a complete script like that. voteban sounds a silly idea, what do u do if a few friends join and decide they wanna ban some random player. if theres only them in the server, then ur poor random player just got banned for nothing. and as for it being any bigger, u can make it the same size, all but a few lines... but like i said, sounds kinda pointless.

Link to comment

umm... I increased the Voteban thing to 90% I was inside the server with my friend testing it, and it needed full servers votes, so i guess... it would need all 3 players to ban someone...You could increase it to 95% by setting the dividing rate to 1.1, which is 95% and 1.11 is 95.5% and so on...

Link to comment

U could go on forever trying to make it better, but the fact is, people can ban people even if theyre not doing anything wrong.

if u really wanna go ahead with vote banning, then u should do what i did on my old script, the ban is for a set time, eg: 1 hour, that way it could keep out annoying cheaters, plus if some1 is accidentally banned, its only for an hour.

Of course, its not a simple thing to make if ur a beginner, u cant really just have a timer running to unban them in case ur mirc crashes, its not hard tho, maybe something for u to look at... it'll keep u busy:)

just add the name, ip and time to an ini, then get a timer checking the ini for unbans. when the time is reached, the player is unbanned. this will work even after mirc has been reset. problem solved.

Link to comment
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...