Jump to content

Votekick/voteban - Better than ever!


HouseMD

Recommended Posts

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
}
alias end.vote {
var %players = $round($calc($mta.server($1).players * $iif(%votetype == votekick,%vkp,%vbp) ),0)
if ($calc(%yes - %no) >= %players) {
mta.text $1 %votetype successful for $mta.nick($1,%id) Yes: %yes No: %no
$iif(%votetype == votekick,mta.kick $1 %id,$iif(%votetype == voteban,mta.ban $1 %id))
unset %id
unset %ids
unset %running
unset %votetype
unset %yes
unset %no
}
else {
mta.text $1 %votetype unsuccessful for $mta.nick($1,%id) Yes: %yes No: %no
unset %id
unset %ids
unset %running
unset %votetype
unset %yes
unset %no
}
}
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
elseif (%running == yes) mta.pm $1 $2 A %VoteType is already running
else {
if (%votetime == $null) set %votetime 30 
if (%vkp == $null) set %vkp 0.5
mta.text $1 A VoteKick has been issued on " $+ $mta.nick($1,%a) $+ "
mta.text $1 $round($calc($mta.server($1).players * %vkp),0) Votes needed, !Yes and !No ( $+ %votetime Seconds)
set %running yes
set %votetype VoteKick
set %id %a
set %no 0
set %yes 0
.timervote 1 %votetime end.vote $1-
}
}
elseif ($3 == !voteban) {
if (%a == -1) mta.pm $1 $2 Error: Absent ID
elseif (%running == yes) mta.pm $1 $2 A %VoteType is already running
else {
if (%votetime == $null) set %votetime 30
if (%vbp == $null) set %vbp 0.8 
mta.text $1 A Voteban has been issued on " $+ $mta.nick($1,%a) $+ "
mta.text $1 $round($calc($mta.server($1).players * %vbp),0) Votes needed, !Yes and !No ( $+ %votetime Seconds)
set %running yes
set %votetype Voteban
set %id %a
set %no 0
set %yes 0
.timervote 1 %votetime end.vote $1-
}
}
elseif ($3 == !no) {
if ($2 isin %IDs) mta.pm $1 $2 You have already voted on a %votetype
elseif (%running == $null) mta.pm $1 $2 There is no vote running!
else {
if (!%ids) set %ids $2
else set %ids %ids $2
set %no $calc(%no + 1)
mta.pm $1 $2 You have voted no for a %votetype against $mta.nick($1,%id)
}
}
elseif ($3 == !yes) {
if ($2 isin %IDs) mta.pm $1 $2 You have already voted on a %votetype
elseif (%running == $null) mta.pm $1 $2 There is no vote running!
else {
if (!%ids) set %ids $2
else set %ids %ids $2
set %yes $calc(%yes + 1)
mta.pm $1 $2 You have voted yes for a %votetype against $mta.nick($1,%id)
}
}
elseif ($3 == !vote) {
if (%running == $null) mta.pm $1 $2 There is no Vote Running!
else {
var %players = $round($calc($mta.server($1).players * $iif(%votetype == votekick,%vkp,%vbp) ),0)
mta.text $1 There is a %votetype running against $mta.nick($1,%id) $+ , $iif($calc(%yes - %no - %players) >= 0,No Votes needed,$abs($calc(%yes - %no - %players)) votes needed) ( $+ $timer(vote).secs seconds left!)
}
}
elseif ($3 == !setpercentvk) {
if ($gus.level($1,$2) <=  mta.pm $1 $2 You need to be level 9 to use this command!
elseif ($4 !isnum) mta.pm $1 $2 You need a number as percentage
elseif (!$4) mta.pm $1 $2 Error: $3 
elseif ($4 == $calc(%vkp * 100)) mta.pm $1 $2 The percentage is already set to the value you specified!
else {
mta.text $1 Percentage of Votekick set from $calc(%vkp * 100) $+ % to $4 $+ %
set %vkp $calc($4 / 100)
}
}
elseif ($3 == !setpercentvb) {
if ($gus.level($1,$2) <=  mta.pm $1 $2 You need to be level 9 to use this command!
elseif ($4 !isnum) mta.pm $1 $2 You need a number as percentage
elseif (!$4) mta.pm $1 $2 Error: $3 
elseif ($4 == $calc(%vkb * 100)) mta.pm $1 $2 The percentage is already set to the value you specified!
else {
mta.text $1 Percentage of Voteban set from $calc(%vbp * 100) $+ % to $4 $+ %
set %vbp $calc($4 / 100)
}
}
elseif ($3 == !setvotetime) {
if (!$4) Error: $3 
elseif ($4 !isnum) mta.pm $1 $2 The time must be in seconds
elseif (%votetime == $4) mta.pm $1 $2 The time of the vote is set to the same value you specified!
elseif ($gus.level($1,$2) <=  mta.pm $1 $2 You need to be level 9 to use this command!
else {
mta.text $1 The time of the vote is set from %votetime seconds to $4 seconds
set %votetime $4
}
}
}
on *:SIGNAL:mta.part: {
if (%running == yes) {
if ($2 == %id) {
mta.text $1 $mta.nick($1,$2) Parted! There was a %votetype against him!
.timervote off
unset %id
unset %ids
unset %running
unset %votetype
unset %yes
unset %no
}
}
}

- For Gus

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
}
alias end.vote {
var %players = $round($calc($mta.server($1).players * $iif(%votetype == votekick,%vkp,%vbp) ),0)
if ($calc(%yes - %no) >= %players) {
mta.text $1 %votetype successful for $mta.nick($1,%id) Yes: %yes No: %no
$iif(%votetype == votekick,mta.kick $1 %id,$iif(%votetype == voteban,mta.ban $1 %id))
unset %id
unset %ids
unset %running
unset %votetype
unset %yes
unset %no
}
else {
mta.text $1 %votetype unsuccessful for $mta.nick($1,%id) Yes: %yes No: %no
unset %id
unset %ids
unset %running
unset %votetype
unset %yes
unset %no
}
}
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
elseif (%running == yes) mta.pm $1 $2 A %VoteType is already running
else {
if (%votetime == $null) set %votetime 30 
if (%vkp == $null) set %vkp 0.5
mta.text $1 A VoteKick has been issued on " $+ $mta.nick($1,%a) $+ "
mta.text $1 $round($calc($mta.server($1).players * %vkp),0) Votes needed, !Yes and !No ( $+ %votetime Seconds)
set %running yes
set %votetype VoteKick
set %id %a
set %no 0
set %yes 0
.timervote 1 %votetime end.vote $1-
}
}
elseif ($3 == !voteban) {
if (%a == -1) mta.pm $1 $2 Error: Absent ID
elseif (%running == yes) mta.pm $1 $2 A %VoteType is already running
else {
if (%votetime == $null) set %votetime 30
if (%vbp == $null) set %vbp 0.8 
mta.text $1 A Voteban has been issued on " $+ $mta.nick($1,%a) $+ "
mta.text $1 $round($calc($mta.server($1).players * %vbp),0) Votes needed, !Yes and !No ( $+ %votetime Seconds)
set %running yes
set %votetype Voteban
set %id %a
set %no 0
set %yes 0
.timervote 1 %votetime end.vote $1-
}
}
elseif ($3 == !no) {
if ($2 isin %IDs) mta.pm $1 $2 You have already voted on a %votetype
elseif (%running == $null) mta.pm $1 $2 There is no vote running!
else {
if (!%ids) set %ids $2
else set %ids %ids $2
set %no $calc(%no + 1)
mta.pm $1 $2 You have voted no for a %votetype against $mta.nick($1,%id)
}
}
elseif ($3 == !yes) {
if ($2 isin %IDs) mta.pm $1 $2 You have already voted on a %votetype
elseif (%running == $null) mta.pm $1 $2 There is no vote running!
else {
if (!%ids) set %ids $2
else set %ids %ids $2
set %yes $calc(%yes + 1)
mta.pm $1 $2 You have voted yes for a %votetype against $mta.nick($1,%id)
}
}
elseif ($3 == !vote) {
if (%running == $null) mta.pm $1 $2 There is no Vote Running!
else {
var %players = $round($calc($mta.server($1).players * $iif(%votetype == votekick,%vkp,%vbp) ),0)
mta.text $1 There is a %votetype running against $mta.nick($1,%id) $+ , $iif($calc(%yes - %no - %players) >= 0,No Votes needed,$abs($calc(%yes - %no - %players)) votes needed) ( $+ $timer(vote).secs seconds left!)
}
}
elseif ($3 == !setpercentvk) {
if ($pgs.level($1,$2) <=  mta.pm $1 $2 You need to be level 9 to use this command!
elseif ($4 !isnum) mta.pm $1 $2 You need a number as percentage
elseif (!$4) mta.pm $1 $2 Error: $3 
elseif ($4 == $calc(%vkp * 100)) mta.pm $1 $2 The percentage is already set to the value you specified!
else {
mta.text $1 Percentage of Votekick set from $calc(%vkp * 100) $+ % to $4 $+ %
set %vkp $calc($4 / 100)
}
}
elseif ($3 == !setpercentvb) {
if ($pgs.level($1,$2) <=  mta.pm $1 $2 You need to be level 9 to use this command!
elseif ($4 !isnum) mta.pm $1 $2 You need a number as percentage
elseif (!$4) mta.pm $1 $2 Error: $3 
elseif ($4 == $calc(%vkb * 100)) mta.pm $1 $2 The percentage is already set to the value you specified!
else {
mta.text $1 Percentage of Voteban set from $calc(%vbp * 100) $+ % to $4 $+ %
set %vbp $calc($4 / 100)
}
}
elseif ($3 == !setvotetime) {
if (!$4) Error: $3 
elseif ($4 !isnum) mta.pm $1 $2 The time must be in seconds
elseif (%votetime == $4) mta.pm $1 $2 The time of the vote is set to the same value you specified!
elseif ($pgs.level($1,$2) <=  mta.pm $1 $2 You need to be level 9 to use this command!
else {
mta.text $1 The time of the vote is set from %votetime seconds to $4 seconds
set %votetime $4
}
}
}
on *:SIGNAL:mta.part: {
if (%running == yes) {
if ($2 == %id) {
mta.text $1 $mta.nick($1,$2) Parted! There was a %votetype against him!
.timervote off
unset %id
unset %ids
unset %running
unset %votetype
unset %yes
unset %no
}
}
}

- for PGS

Long votekick? yup! Painful? Nop!

This votekick has many nice stuff, like the ability to set the time of the votes and set the percentages (Vk for votekick, vb for voteban)

If you would like to change the admin levels, make sure that you know that this "<=" means "Same or Lower"

Link to comment
  • Recently Browsing   0 members

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