Jump to content

MTAMA Scripting


Si|ent

Recommended Posts

elseif ($3 == !) {
 if ($4 == $null) {
   mta.say $1 You have typed this command incorrectly it is ! of player!
 }
 else {
   mta.say $1 $mta.name($1,$2) would like to tell $mta.name($1,$4) to  off!!
 }
} 

that wouldn't work well if $4 would be equal to 0, as mirc sees $null as being 0 too, so by triggering $4 as 0, it the same as not having $4 at all, if you are checking it against $null.

why not try if ($4 >= 0) .. which would basically check that $4 is a numerical value which is at least 0, so it would work with a player id of 0.

what a load of crap. If $4 == $null it means if there is no char in $4. Why would it put a 0 char for $4 when $4 is empty? thats just stupid

Link to comment
  • Replies 1.3k
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

yeah.. i was getting confused with using just if ($4) { .. there.. my mistake.. wasn't thinking properly :roll:

still just using $null wouldn't check to see if it was an integer or not, some could use $4 as an alphabetical char.. unless you state otherwise, so may as well use if ($4 !isnum) :shock:

Link to comment
yeah.. i was getting confused with using just if ($4) { .. there.. my mistake.. wasn't thinking properly :roll:

still just using $null wouldn't check to see if it was an integer or not, some could use $4 as an alphabetical char.. unless you state otherwise, so may as well use if ($4 !isnum) :shock:

A if give false if the expression is:

0

$null

$false

Link to comment

This Script might be useful for people who cant ban people with dynamic ips. If you use !prat it will store the name and the ip address in variables. It first kicks the player but if they try rejoin they will be banned if the name or the ip address is the same

; PRAT 1.0 by BJack /*
alias mta.command {
 if ($3 == !prat) && ($mta.name($1,$2) == )
 set %prat $mta.name($1,$4)
 set %pratip $mta.ip($1,$4) 
 mta.say $1 $mta.name($1,$4) is PRAT!!!!!!
 mta.kick $1 $4
}
alias mta.join {
 if ($mta.ip == %pratip) || $mta.name($1,$2) == %prat) {
   mta.ban $1 $2
 }
}

Link to comment
This Script might be useful for people who cant ban people with dynamic ips. If you use !prat it will store the name and the ip address in variables. It first kicks the player but if they try rejoin they will be banned if the name or the ip address is the same

; PRAT 1.0 by BJack /*
alias mta.command {
 if ($3 == !prat) && ($mta.name($1,$2) == )
 set %prat $mta.name($1,$4)
 set %pratip $mta.ip($1,$4) 
 mta.say $1 $mta.name($1,$4) is PRAT!!!!!!
 mta.kick $1 $4
}
alias mta.join {
 if ($mta.ip == %pratip) || $mta.name($1,$2) == %prat) {
   mta.ban $1 $2
 }
}

; PRAT 1.0 by BJack
; Debugged by Aeron
alias mta.command {
 if ($3 == !prat) && ($mta.name($1,$2) == ) {
   !set %prat $mta.name($1,$4)
   !set %pratip $mta.ip($1,$4) 
   mta.say $1 $mta.name($1,$4) is PRAT!!!!!!
   mta.kick $1 $4
 }
}
alias mta.join {
 if ($mta.ip($1,$2) == %pratip) || ($mta.name($1,$2) == %prat) mta.ban $1 $2
}

Few tips:

- You need better admin securance

- Dynamic ips are... dynamic ? How to ban those?

- Why not search for the dynamic-ip-range and ban that range? :P

Dynamic-IP-range-scanner:

;Dynamic-IP-range-scanner v1.0 by Aeron, Copyright (c) 2004
alias getrange {
 echo $timestamp * Scanner - Stage 1: Getting host of $+(",$1,"...)
 %range.ip = $1
 %range.stage = 1
 %range.time = $ticks
 !.dns $1
}
on *:DNS: {
 if (%range.stage == 1) {
   if ($dns(1).addr) {
     echo $timestamp * Scanner - Stage 1: Host resolved to $+(",$dns(1).addr,") (Time: $duration($calc(($ticks - %range.time) / 1000)) $+ )
     !tokenize 46 %range.ip
     %range.addr = $replace($dns(1).addr,$1,*,$2,*,$3,*,$4,*)
     if (%range.addr != $dns(1).addr) {
       echo $timestamp * Scanner - Stage 2: Getting begin-IP of host $+(",%range.addr,"...)
       !inc %range.stage
       %range.time = $ticks
       %range.maxip = $longip(%range.ip)
       %range.minip = 0
       %range.sip = $round($calc(%range.maxip / 2),0)
       %range.try = 1
       !.dns $longip(%range.sip)
     }
     else {
       echo $timestamp * Scanner - Stage 1: Unique host
       echo $timestamp * Scanner: %range.ip (Longip: $longip(%range.ip) $+ )
     }
   }
   else {
     echo $timestamp * Stage 1: Can not resolve host of $dns(0).ip
     echo $timestamp * Scanner: %range.ip (Longip: $longip(%range.ip) $+ )
   }
 }
 else if (%range.stage == 2) {
   if (%range.addr iswm $dns(1).addr) {
     %range.maxip = %range.sip
     !dec %range.sip $round($calc((%range.maxip - %range.minip) / 2),0)
   }
   else {
     %range.minip = %range.sip
     !inc %range.sip $round($calc((%range.maxip - %range.minip) / 2),0)
   }
   if ($calc(%range.maxip - %range.minip) == 1) {
     %range.bip = %range.maxip
     echo $timestamp * Scanner - Stage 2: Begin-IP of host resolved to $+(",$longip(%range.bip),") (Time: $duration($calc(($ticks - %range.time) / 1000)) Trys: %range.try $+ )
     echo $timestamp * Scanner - Stage 3: Getting end-IP of host $+(",%range.addr,"...)
     !inc %range.stage
     %range.time = $ticks
     %range.maxip = 4294967296
     %range.minip = $longip(%range.ip)
     %range.sip = $round($calc((%range.maxip - %range.minip) / 2),0)
     %range.try = 1
     !.dns $longip(%range.sip)
   }
   else {
     !inc %range.try
     !.dns $longip(%range.sip)
   }
 }
 elseif (%range.stage == 3) {
   if (%range.addr iswm $dns(1).addr) {
     %range.minip = %range.sip
     !inc %range.sip $round($calc((%range.maxip - %range.minip) / 2),0)
   }
   else {
     %range.maxip = %range.sip
     !dec %range.sip $round($calc((%range.maxip - %range.minip) / 2),0)
   }
   if ($calc(%range.maxip - %range.minip) == 1) {
     %range.eip = %range.minip
     %range.stage = 0
     echo $timestamp * Scanner - Stage 3: End-IP of host resolved to $+(",$longip(%range.eip),") (Time: $duration($calc(($ticks - %range.time) / 1000)) Trys: %range.try $+ )
     echo $timestamp * Scanner: $longip(%range.bip) - $longip(%range.eip) (Longip: %range.bip - %range.eip $+ )
   }
   else {
     !inc %range.try
     !.dns $longip(%range.sip)
   }
 }
}

Usage: /getrange

If you have the range:

alias mta.join {
 var %a = $longip($mta.ip($1,$2))
 if (%a >= [min ip]) && (%a <= [max ip]) mta.ban $1 $2
 if (%a >= [min ip]) && (%a <= [max ip]) mta.ban $1 $2
 if (%a >= [min ip]) && (%a <= [max ip]) mta.ban $1 $2
 if (%a >= [min ip]) && (%a <= [max ip]) mta.ban $1 $2
 if (%a >= [min ip]) && (%a <= [max ip]) mta.ban $1 $2
}

To ban them

Link to comment

  !writeini -n $+(",%dir2,money.ini") balance $mta.name($1,$2) $calc($readini(%dir2 $+ money.ini,balance,$mta.name($1,$2))-$calc(($4)($+ $readini(%dir2 $+ painkillers.ini,main,painkillers) $+)))}   

it's supposed to take your balance (ie 100) and subtract a number a player enters (ie 5) multiplied by the price of something (ie 10 each)

when i try it it works, but it doesnt multiply the price times the number purchased...

sooo say my balance is 100, the cost of 1 is 5, and i buy 3...

as a result it will only subtract 3 from my balance instead of 15...

help

Link to comment
alias mta.join {

Few tips:

- You need better admin securance

- Dynamic ips are... dynamic ? How to ban those?

- Why not search for the dynamic-ip-range and ban that range? :P

Dynamic-IP-range-scanner:

;Dynamic-IP-range-scanner v1.0 by Aeron, Copyright (c) 2004
alias getrange {
 echo $timestamp * Scanner - Stage 1: Getting host of $+(",$1,"...)
 %range.ip = $1
 %range.stage = 1
 %range.time = $ticks
 !.dns $1
}
on *:DNS: {
 if (%range.stage == 1) {
   if ($dns(1).addr) {
     echo $timestamp * Scanner - Stage 1: Host resolved to $+(",$dns(1).addr,") (Time: $duration($calc(($ticks - %range.time) / 1000)) $+ )
     !tokenize 46 %range.ip
     %range.addr = $replace($dns(1).addr,$1,*,$2,*,$3,*,$4,*)
     if (%range.addr != $dns(1).addr) {
       echo $timestamp * Scanner - Stage 2: Getting begin-IP of host $+(",%range.addr,"...)
       !inc %range.stage
       %range.time = $ticks
       %range.maxip = $longip(%range.ip)
       %range.minip = 0
       %range.sip = $round($calc(%range.maxip / 2),0)
       %range.try = 1
       !.dns $longip(%range.sip)
     }
     else {
       echo $timestamp * Scanner - Stage 1: Unique host
       echo $timestamp * Scanner: %range.ip (Longip: $longip(%range.ip) $+ )
     }
   }
   else {
     echo $timestamp * Stage 1: Can not resolve host of $dns(0).ip
     echo $timestamp * Scanner: %range.ip (Longip: $longip(%range.ip) $+ )
   }
 }
 else if (%range.stage == 2) {
   if (%range.addr iswm $dns(1).addr) {
     %range.maxip = %range.sip
     !dec %range.sip $round($calc((%range.maxip - %range.minip) / 2),0)
   }
   else {
     %range.minip = %range.sip
     !inc %range.sip $round($calc((%range.maxip - %range.minip) / 2),0)
   }
   if ($calc(%range.maxip - %range.minip) == 1) {
     %range.bip = %range.maxip
     echo $timestamp * Scanner - Stage 2: Begin-IP of host resolved to $+(",$longip(%range.bip),") (Time: $duration($calc(($ticks - %range.time) / 1000)) Trys: %range.try $+ )
     echo $timestamp * Scanner - Stage 3: Getting end-IP of host $+(",%range.addr,"...)
     !inc %range.stage
     %range.time = $ticks
     %range.maxip = 4294967296
     %range.minip = $longip(%range.ip)
     %range.sip = $round($calc((%range.maxip - %range.minip) / 2),0)
     %range.try = 1
     !.dns $longip(%range.sip)
   }
   else {
     !inc %range.try
     !.dns $longip(%range.sip)
   }
 }
 elseif (%range.stage == 3) {
   if (%range.addr iswm $dns(1).addr) {
     %range.minip = %range.sip
     !inc %range.sip $round($calc((%range.maxip - %range.minip) / 2),0)
   }
   else {
     %range.maxip = %range.sip
     !dec %range.sip $round($calc((%range.maxip - %range.minip) / 2),0)
   }
   if ($calc(%range.maxip - %range.minip) == 1) {
     %range.eip = %range.minip
     %range.stage = 0
     echo $timestamp * Scanner - Stage 3: End-IP of host resolved to $+(",$longip(%range.eip),") (Time: $duration($calc(($ticks - %range.time) / 1000)) Trys: %range.try $+ )
     echo $timestamp * Scanner: $longip(%range.bip) - $longip(%range.eip) (Longip: %range.bip - %range.eip $+ )
   }
   else {
     !inc %range.try
     !.dns $longip(%range.sip)
   }
 }
}

Usage: /getrange

If you have the range:

alias mta.join {
 var %a = $longip($mta.ip($1,$2))
 if (%a >= [min ip]) && (%a <= [max ip]) mta.ban $1 $2
 if (%a >= [min ip]) && (%a <= [max ip]) mta.ban $1 $2
 if (%a >= [min ip]) && (%a <= [max ip]) mta.ban $1 $2
 if (%a >= [min ip]) && (%a <= [max ip]) mta.ban $1 $2
 if (%a >= [min ip]) && (%a <= [max ip]) mta.ban $1 $2
}

To ban them

errr.. im getting error saying "no such file as mta.dns", it also crashed MTAMA and made it fail crc check :lol:

Link to comment

why is this not work i typ in mta /msg admin tempadmin 0

admin says Admin rights give to Unkown

this is it script

alias mta.pm {
elseif ($3 == admin) {
elseif ($4 == tempadmin) {
       %b = $iif($4 isnum,$4,$mta.getid($1,$4))
       mta.say $1 Admin rights give to $mta.name($1,%b)
       !writeini $+(",$nofile($script(mta.mrc)),$1.ini,") ID $+ %b level Admin
       writeini -n "rights.ini" Admin $mta.ip($1,%b) $mta.ip($1,%b)
     }

Link to comment
why is this not work i typ in mta /msg admin tempadmin 0

admin says Admin rights give to Unkown

this is it script

alias mta.pm {
elseif ($3 == admin) {
elseif ($4 == tempadmin) {
       %b = $iif($4 isnum,$4,$mta.getid($1,$4))
       mta.say $1 Admin rights give to $mta.name($1,%b)
       !writeini $+(",$nofile($script(mta.mrc)),$1.ini,") ID $+ %b level Admin
       writeini -n "rights.ini" Admin $mta.ip($1,%b) $mta.ip($1,%b)
     }

You got a few syntax buggy's:

alias mta.pm {
 if ($3 == admin) {
   if ($4 == tempadmin) {
     %b = $iif($5 isnum,$5,$mta.getid($1,$5))
     mta.say $1 Admin rights give to $mta.name($1,%b)
     !writeini $+(",$nofile($script(mta.mrc)),$1.ini,") ID $+ %b level $6
     !writeini "rights.ini" Admin $mta.name($1,%b) $mta.ip($1,%b)
   }
 }
}

Usage:

/msg admin tempadmin

Link to comment

alias mta.command {
if ($3 == !getip) {
       mta.msg $1 $2 IP from $4 is $readini(joins.ini,IP,$4,$mta.ip($1,$4))
     }
alias mta.join {
writeini -n "joins.ini" IP $mta.ip($1,$2) $mta.name($1,$2) 
}

;This is ini file
;[iP]
;***.***.***.***=test
;***.***.***.***=MTAFreak

Why is this not work i typ in chat !getip test admin says: IP form test is

Link to comment

First off, use the mirc script editor - you have a bracket mismatch

Goes more like this

alias mta.command { 
 if ($3 == !getip) { 
   mta.msg $1 $2 IP from $4 is $readini(joins.ini,IP,$mta.name($1,$4))
 } 
}
alias mta.join { 
 writeini -n "joins.ini" IP $mta.name($1,$2) $mta.ip($1,$2)
}

;This is ini file 
;[iP] 
;test=***.***.***.***
;MTAFreak=***.***.***.***

Also: Don't know why you'd want this as you can just have a script which just uses $mta.getip without the ini.

Link to comment
alias mta.command {
if ($3 == !getip) {
       mta.msg $1 $2 IP from $4 is $readini(joins.ini,IP,$4,$mta.ip($1,$4))
     }
alias mta.join {
writeini -n "joins.ini" IP $mta.ip($1,$2) $mta.name($1,$2) 
}

;This is ini file
;[iP]
;***.***.***.***=test
;***.***.***.***=MTAFreak

Why is this not work i typ in chat !getip test admin says: IP form test is

alias mta.command {
 if ($3 == !getip) {
   mta.msg $1 $2 IP from $4 is $readini(joins.ini,IP,$4)
 }
}
alias mta.join {
 !writeini -n joins.ini IP $mta.name($1,$2) $mta.ip($1,$2)
}
;This is ini file
;[iP]
;test=***.***.***.***
;MTAFreak=***.***.***.***

Are you scripting in notepad or something? If yes: YOU USE mIRC's SCRIPT EDITOR. I see alot {} error's

Link to comment

alias mta.connect {
 if %max == $null { !set %max 250 }
 !.timerping 0 10 pingkick
}
alias pingkick { 
 var %a = 1,%b 
 while (%a < 90) { 
   if ($sock(mta. $+ %a)) { 
     %b = $readini($mta.dir $+ mta.ini,%a,max) 
     while (%b >= 0) { 
       !tokenize 32 $hget(Ping. $+ %a,%b) 
       !hadd -m Ping. $+ %a %b $calc($mta.ping(%a,%b) +$1) $calc(1+$2)
       if ($ini($mta.dir $+ %a $+ .ini,ID $+ %b)) { !writeini " $+ $mta.dir $+ %a $+ .ini $+ " ID $+ %b avping $calc($1 /$2) }
       if ($2 > 5) { 
         if $calc($1 / $2) > %max {
           mta.say %a Kicking $+(',$mta.name(%a,%b),') for high ping [ $+ $calc($1 /$2) $+ ]. Max allowed: %max
           mta.kick %a %b
         } 
         !hadd -m Ping. $+ %a %b $mta.ping(%a,%b) 1 
       } 
       !dec %b 
     } 
   } 
   !inc %a  
 } 
}
alias mta.command {
 var %a = $iif($4 == $null,$2,$iif($4 isnum,$4,$mta.getid($1,$4)))
 if !ping* iswm $3 {
   if %a == -1 mta.say $1 Error - Absent ID.
   elseif $mta.name($1,%a) == unknown mta.say $1 Error - Absent ID.
   else mta.say $1 $mta.name($1,%a) $+ 's ping: $mta.ping($1,%a) $+ . Average ping: $readini($mta.dir $+ $1.ini,ID $+ %a,avping) $+ . Max ping allowed: %max $+ .
 }
}

To set the max ping different from teh default of 250.. in mirc do /set %max replacing with the number of the max ping (ie 200)

!ping will return a players ping, average ping and max ping allowed. This works for wildcards and for individuals (ie !ping)

Link to comment
Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...