Jump to content

MTAMA Scripting


Si|ent

Recommended Posts

  • Replies 1.3k
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

i tried to find a tutorial once upon a time... but never found anything useful.. so id just look at some scripts, manhunt, gang war, and ones u find here, and figure out which bit does what.. thats what i eneded up doing.

Link to comment

HI all, i from poland and i have problem. Beacause I want write script "high ping kick", max ping 300, but i want this have in scripts.mrc. I don't know where i must have this: /set %max 300. Can you help me ?

Link to comment

Cube: just do it in the irc window... /set %max 300 use that with the ping kicker on this thread.

Kooper: yes i know of a way u can do that but it would require you to have winamp open all the time.

Link to comment

You first have to decide where you're going to store the ban data, and in what way. A (mySQL) database would be the best, but i'm thinking of using a ini file, because not everybody has a mysql server available. i'll try to finish it soon :)

Link to comment
Hi is there somebody who can tell me some more about a timeban script? I don't know where to start :wink::?:

alias mta.timeban {
!.timer 1 $3 mta.unban $1 $mta.ip($1,$2)
mta.ban $1 $2
}

Use the command

mta.timeban

1 Note: Dont close MTA:mA when there are still time bans are running.

Link to comment

oli said,

Kooper: yes i know of a way u can do that but it would require you to have winamp open all the time.

Actually provided your mp3 player, be it winamp or another, is the default for playing mp3 you can simply use:

/run c:\path to mp3\mp3name.mp3

So a quick and easy way would be to put the following in your MTAMA scripts.mrc in the mta.txt section;

 }
 if (!admin isin $3-) {
   mta.say $1 The admin has been alerted.
   /run c:\mp3\shout.mp3
 }

(Don't forget to use elseif if you have checks above it already)

ps. Is it just me or is our 'code' colourscheme really hard to read?

Link to comment
Actually provided your mp3 player, be it winamp or another, is the default for playing mp3 you can simply use:

/run c:\path to mp3\mp3name.mp3

mIRC even provides it's own sound playing function:

/splay c:\path to mp3\mp3name.mp3

Link to comment

lol ok, i didnt know about that command. Yeah bump, this code clolour scheme is crap :P maybe u should use a different theme, or u could just change the colour manually in the forum admin cp ;) although i think its the same colour thats used for "moderators" so they wuold change colour too :P

Link to comment

mIRC even provides it's own sound playing function:

/splay c:\path to mp3\mp3name.mp3

Dont forget "-p" for MP3's

!splay -p "c:\path to mp3\mp3name.mp3"

Quotes are needed because 'c:\path' isn't a mp3 file!

The '!' prefix makes the command faster and not processing as a alias

Link to comment

Dont forget "-p" for MP3's

...

Quotes are needed because 'c:\path' isn't a mp3 file!

The '!' prefix makes the command faster and not processing as a alias

Both the -p and the quotes are not needed (try it :wink:)

Link to comment

i have a problem with two script's i'm tryin to test can someone see if they can find an error

if ($3 == !votekick) {
   if (%vote.nick. [ $+ [ $1 ] ] == $null) {
     if ($ini($+(".$scriptdir,$1,.ini,"),ID $+ $4)) {
       set %vote.nick. [ $+ [ $1 ] ] $4
       set %vote.voters. [ $+ [ $1 ] ] $null
       mta.say $1 Votekick "!vote" if u want that $mta.name($1,$4) shall be kicked.[ $calc($left($did(mta,$1 $+ 21),2) / 2) votes needed] [30 sec]
       .timervote [ $+ [ $1 ] ] 1 30 mta.vote $1
     }
     else mta.say $1 Give up an exisiting ID-number: "!votekick <#ID">
   }
   else mta.say $1 Another votekick is running: $mta.name($1,%vote.nick. [ $+ [ $1 ] ])
 }
 if (($3 == !vote) && (%vote.nick. [ $+ [ $1 ] ] != $null)) {
   if ($2 !isin %vote.voters. [ $+ [ $1 ] ]) {
     %vote.voters [ $+ [ $1 ] ] = %vote.voters. [ $+ [ $1 ] ] $2
     mta.say $1 $numtok(%vote.voters. [ $+ $1 ] ],32 votes for $mta.name($1,%vote.nick. [ $+ [ $1 ] ])
     if ($numtok(%vote.voters. [ $+ [$1 ] ],32 >= $calc($left($did(mta,$1 $+ 21),2) / 2)) {
       mta.say $1 $mta.name($1,%vote.nick. [ $+ [ $1 ] ]) $numtok(%vote.voters. [ $+ [ $! ] ],32 votes ur out!
       mta.kick $1 %vote.nick. [ $+ [ $1 ] ]
       unset %vote.nick. [ $+ [ $1 ] ]
       unset %vote.voters. [ $+ [ $1 ] ]
       .timervote [ $+ [ $1 ] ] off
     }
   }
   else mta.say $1 $mta.name($1,$2) You have already voted
 }
}
alais mta.vote {
 mta.say $1 Vote kick cancelled: $mta.name($1,%vote.nick. [ $+ [ $1 ] ])
 unset %vote.nick. [ $+ $1 ] ]
 unset %vote.voters. [ $+ [ $1 ] ]
} 

ok i got the votekick to work but i need to know how to set the pecentage of votes needed to kick someone

alias checkpings {
 set %temp.i 0
 while (%temp.i < 26) {
   set %temp.ping $mta.ping(1, %temp.i)
   if ( (%temp.ping > 1000) || (%temp.ping < 0) ) { halt }
   if (%temp.ping != $null) {
     inc %loop. [ $+ [ %temp.i ] ] 1
     if (%loop. [ $+ [ %temp.i ] ] > 12) {
       set %loop. [ $+ [ %temp.i ] ] 1
     }
     set %ping. [ $+ [ %temp.i ] $+ . $+ [ %loop. [ $+ [ %temp.i ] ] ] ] %temp.ping
     if (%ping. [ $+ [ %temp.i ] $+ . $+ ] 12 != $null) {
       set %temp.j 1
       set %temp.average 0
       while (%temp.j <= 12) {
         inc %temp.average %ping. [ $+ [ %temp.i ] $+ . $+ [ %temp.j ] ] 
         inc %temp.j 1
       }
       set %temp.average $calc(%temp.average / 12)
       set %average. [ $+ [ %temp.i ] ] %temp.average
       if (%temp.average >= %max) {
         /mta.say 1 Kicking $mta.name(1, %temp.i) for having average ping over %max
         /mta.kick 1 %temp.i
       }
     }
   }
   inc %temp.i 1
 }
 unset %temp.*
}
alias mta.start {
 timerping 0 10 checkpings
}
alias mta.join {
 unset %ping. [ $+ [ $2 ] $+ ] *
 set %loop [ $+ [ $2 ] ] 0
}

Link to comment
i have a problem with two script's i'm tryin to test can someone see if they can find an error

ok i got the votekick to work but i need to know how to set the pecentage of votes needed to kick someone

if ($3 == !votekick) {
  %vote.percentage = 50
   if (%vote.nick. [ $+ [ $1 ] ] == $null) {
     if ($ini($+(".$scriptdir,$1,.ini,"),ID $+ $4)) {
       set %vote.nick. [ $+ [ $1 ] ] $4
       set %vote.voters. [ $+ [ $1 ] ] $null
       mta.say $1 Votekick "!vote" if u want that $mta.name($1,$4) shall be kicked.[ $calc($left($did(mta,$1 $+ 21),2) / 2) votes needed] [30 sec]
       .timervote [ $+ [ $1 ] ] 1 30 mta.vote $1
     }
     else mta.say $1 Give up an exisiting ID-number: "!votekick <#ID">
   }
   else mta.say $1 Another votekick is running: $mta.name($1,%vote.nick. [ $+ [ $1 ] ])
 }
 if (($3 == !vote) && (%vote.nick. [ $+ [ $1 ] ] != $null)) {
   if ($2 !isin %vote.voters. [ $+ [ $1 ] ]) {
     %vote.voters [ $+ [ $1 ] ] = %vote.voters. [ $+ [ $1 ] ] $2
     mta.say $1 $numtok(%vote.voters. [ $+ $1 ] ],32 votes for $mta.name($1,%vote.nick. [ $+ [ $1 ] ])
     if ($calc($numtok(%vote.voters. [ $+ [$1 ] ],32) / $mta.players($1) *100)  >= %vote.percentage) {
       mta.say $1 $mta.name($1,%vote.nick. [ $+ [ $1 ] ]) $numtok(%vote.voters. [ $+ [ $! ] ],32 votes ur out!
       mta.kick $1 %vote.nick. [ $+ [ $1 ] ]
       unset %vote.nick. [ $+ [ $1 ] ]
       unset %vote.voters. [ $+ [ $1 ] ]
       .timervote [ $+ [ $1 ] ] off
     }
   }
   else mta.say $1 $mta.name($1,$2) You have already voted
 }
}
alias mta.vote {
 mta.say $1 Vote kick cancelled: $mta.name($1,%vote.nick. [ $+ [ $1 ] ])
 unset %vote.nick. [ $+ $1 ] ]
 unset %vote.voters. [ $+ [ $1 ] ]
} 

'alais mta.vote {' :arrow: 'alias mta.vote {'

'if ($numtok(%vote.voters. [ $+ [ $1 ] ],32 >= $calc($left($did(mta,$1 $+ 21),2) / 2)) {' :arrow: 'if ($numtok(%vote.voters. [ $+ [ $1 ] ],32) >= $calc($left($did(mta,$1 $+ 21),2) / 2)) {'

'if ($numtok(%vote.voters. [ $+ [ $1 ] ],32) >= $calc($left($did(mta,$1 $+ 21),2) / 2)) {' :arrow: 'if ($calc($numtok(%vote.voters. [ $+ [$1 ] ],32) / $mta.players($1) *100) >= %vote.percentage) {'

'%vote.percentage = 50' added

Link to comment

HI all, not working me 3 scripts. Can you help me ?

1. I have this

/set %life. [ $+ [ $2 ] ] $ctime

}

in scripts.mrc in mta.join and this not working and all scripts in mta.text not working. WHY ?

2. I have this

if ($mta.kills($1,$3) == 10) mta.say $1 No,no koles o imieniu $mta.name($1,$3) uwalil juz 10 frajerow !

if ($mta.kills($1,$3) == 20) mta.say $1 No,no koles o imieniu $mta.name($1,$3) uwalil juz 20 frajerow, uwazajcie na niego !

if ($mta.kills($1,$3) == 30) mta.say $1 No,no koles o imieniu $mta.name($1,$3) uwalil juz 30 frajerow, oj oj naginajcie od niego !

}

in mta.kill and this not working , why ?

3. I have this

alias checkpings {

set %temp.i 0

while ( %temp.i < 26 ) {

set %temp.ping $mta.ping(1, %temp.i)

if ( ( %temp.ping > 1000 ) || ( %temp.ping < 0 ) ) { halt }

if ( %temp.ping != $null ) {

inc %loop. [ $+ [ %temp.i ] ] 1

if ( %loop. [ $+ [ %temp.i ] ] > 12 ) {

set %loop. [ $+ [ %temp.i ] ] 1

}

set %ping. [ $+ [ %temp.i ] $+ . $+ [ %loop. [ $+ [ %temp.i ] ] ] ] %temp.ping

if ( %ping. [ $+ [ %temp.i ] $+ . $+ ] 12 != $null ) {

set %temp.j 1

set %temp.average 0

while ( %temp.j <= 12 ) {

inc %temp.average %ping. [ $+ [ %temp.i ] $+ . $+ [ %temp.j ] ]

inc %temp.j 1

}

set %temp.average $calc( %temp.average / 12 )

set %average. [ $+ [ %temp.i ] ] %temp.average

if ( %temp.average >= %max ) {

/mta.say 1 Kicking $mta.name(1, %temp.i) for having average ping over %max

/mta.kick 1 %temp.i

}

}

}

inc %temp.i 1

}

unset %temp.*

}

alias mta.start {

timerping 0 10 checkpings

}

alias mta.join {

unset %ping. [ $+ [ $2 ] $+ ] *

set %loop. [ $+ [ $2 ] ] 0

}

in scripts.mrc and this not working. I don't know where i must giv this: /set %max 300 , but i want this have all in scripts.mrc.

CAN YOU HELP ME ?? :idea:

Link to comment

ha stupid mistakes thx aeron

and the highping kicker just doesn't react at all i duuno why

alias checkpings {
 set %temp.i 0
 while (%temp.i < 26) {
   set %temp.ping $mta.ping(1, %temp.i)
   if ( (%temp.ping > 1000) || (%temp.ping < 0) ) { halt }
   if (%temp.ping != $null) {
     inc %loop. [ $+ [ %temp.i ] ] 1
     if (%loop. [ $+ [ %temp.i ] ] > 12) {
       set %loop. [ $+ [ %temp.i ] ] 1
     }
     set %ping. [ $+ [ %temp.i ] $+ . $+ [ %loop. [ $+ [ %temp.i ] ] ] ] %temp.ping
     if (%ping. [ $+ [ %temp.i ] $+ . $+ ] 12 != $null) {
       set %temp.j 1
       set %temp.average 0
       while (%temp.j <= 12) {
         inc %temp.average %ping. [ $+ [ %temp.i ] $+ . $+ [ %temp.j ] ]
         inc %temp.j 1
       }
       set %temp.average $calc(%temp.average / 12)
       set %average. [ $+ [ %temp.i ] ] %temp.average
       if (%temp.average >= %max) {
         /mta.say 1 Kicking $mta.name(1, %temp.i) for having average ping over %max
         /mta.kick 1 %temp.i
       }
     }

   }
   inc %temp.i 1
 }
 unset %temp.*
}
alias mta.start {
 timerping 0 10 checkpings
}
alias mta.join {
 unset %ping. [ $+ [ $2 ] $+ ] *
 set %loop [ $+ [ $2 ] ] 0
}

and the votekick works good but i was wonder how would i put a timer on it, so if no one votes it would stop itself

Link to comment
...

and the votekick works good but i was wonder how would i put a timer on it, so if no one votes it would stop itself

Eeuh if you didn't notice: it already does...

And for the ping kicker: it seems it is made for server 1 if you have it on another server it doesn't work

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

    • No registered users viewing this page.

×
×
  • Create New...