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

Talk from the server to irc

 alias mta.text {
 if ( ( !irc isin $3 ) && ( $4 != $null ) ) {
   /msg #channel Msg from server: " $+ $mta.name($1,$2) $+ : $4- $+ "
 }
}

Send pm to irc

This one would msg your irc channel privately, just send a pm to yourself. With this you can let players alert the server admin about a cheater without scaring the cheater away before he can be banned.

alias mta.pm {
 if ( $3 == $mta.nick($1,$2) ) {
   /msg #your_own_channel Msg from server: " $+ $mta.name($1,$2) $+ : $4- $+ "
 }
}

Lifetimer

When a player is killed, tells how long he lived.

alias mta.join {
 /set %life. [ $+ [ $2 ] ] $ctime
}
alias mta.kill {
 /mta.say $1 $mta.name($1,$2) survived for $duration($calc($ctime - %life. [ $+ [ $2 ] ] ) )
 /set %life. [ $+ [ $2 ] ] $ctime
}

Statusflooder

This script would flood everything that happens on the server to a channel in irc.

Ops can also speak to the server with !say on the channel.

Now a !kick for the ops too. Check changes in mtajoin%part too.

(Note: The client running this script cant use !say, but he can use /ssay)

You need to add a variable %mychan that points to the right channel.

This you just type in mirc:

/set %mychan #your_own_channel

And this goes to bot.mrc

alias mta.text { /msg %mychan @ $mta.name($1,$2) $+ : $3- } 
alias mta.join {
 /msg %mychan @ $mta.name($1,$2) joined the game
 /set %name. [ $+ [ $replace($mta.name($1,$2), $chr(32), _) ] ] $2
} 
alias mta.part {
 /msg %mychan @ $mta.name($1,$2) left the game
 /unset %name. [ $+ [ $replace($mta.name($1,$2), $chr(32), _) ] ]
} 
alias mta.kill { 
 if ( ( $3 == 255 ) || ( $3 == 254 ) ) { /msg %mychan @ $mta.name($1,$2) died } 
 elseif ( $3 != $2 ) { /msg %mychan @ $mta.name($1,$3) killed $mta.name($1,$2) and has now $mta.kills($1,$3) kills } 
 elseif ( $2 == $3 ) { /msg %mychan @ $mta.name($1,$2) killed himself } 
} 
alias mta.admin { /msg %mychan @ Admin: $2- } 
alias mta.action { /msg %mychan @ * $mta.name($1,$2) $3- } 
;Uncomment this if you want to show pm's.
;alias mta.pm { /msg %mychan @ PM: $mta.name($1,$2) -> $3 $+ : $4- }

;Added this to allow %mychan ops to speak to the server #1
on 1:text:!say*:#:{
 if ( ( $chan == %mychan ) && ( $nick isop $chan ) ) {
   /mta.say 1 $nick @ $chan $+ : $2-
 }
}

;Added a wildcard name !kick with reason
;usage: !kick 
;Only one word in the nick!
;CHECK THE CHANGES IN mta.join&mta.part TOO!
on 1:text:!kick*:#:{
 if ( ( $chan == %mychan ) && ( $nick isop $chan ) ) {
   /mta.say 1 Kicking $mta.name(1, [ [ $var(%name. [ $+ * $+ [ $2 ] $+ * $+ ] ,1) ] ] ) / Reason: $3-
   /mta.kick 1 [ [ $var(%name. [ $+ * $+ [ $2 ] $+ * $+ ] ,1) ] ]
 }
}
alias ssay {
 /mta.say 1 $me @ $chan $+ : $1-
}

High ping kicker

This one I havent tested too much. It's a high ping kicker that calculates a 2 minute average of players ping and kicks him if its more than %max.

Please tell me if you have any suggestions about this script.

You need to set the %max ping value:

/set %max 300

And then write this to highping.mrc and load -rs it:

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
}

Edited by Guest
Link to comment

Color codes kick:

alias mta.join {
 if ($chr(1) isin $mta.name($1,$2)) {
   mta.say $1 $mta.name($1,$2) Reason: Color Codes
   mta.kick $1 $2
 }
}

alias mta.text {
 if ($chr(1) isin $3-) {
   mta.say $1 $mta.name($1,$2) Reason: Color Codes
   mta.kick $1 $2
 }
}

Votekick: ("!votekick " to activate, "!vote" to vote)

alias mta.text {
 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 existing 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. [ $+ [ $1 ] ],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 ] ]
}

Caps kick:

alias mta.text {
 if (($calc($len($3-) - $len($removecs($3-,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z))) >= $calc($len($3-) * 0.5)) && ($len($3-) >= 5)) {
   mta.say $1 $mta.name($1,$2) Reason: Caps
   mta.kick $1 $2
 }
}

Note:

You can't have 2 "alias mta.text" 's (And other aliases) in 1 script you need to put it together:


alias mta.text {

+

[code]
alias mta.text {

=

[code]
alias mta.text {

Edited by Guest
Link to comment
How can I do it so, it posts a MSG every X minutes. I tried but got lost :? A noob at MRC code you could say 8)

Cheeers

.timerBLAH 

.timerBLAH 0 60 mta.say 1 BLAAT

this commands say's endless every 60 seconds BLAAT in server #1

Link to comment
In wich file do i have to put these codes in?

I made a file and it worked fine :? Just make sure you load it :wink:

You can just write the commands straight to mirc. Or you could make a file like this and /load -rs it
alias startflood {
 timerflood 0 120 mta.say 1 Hello.
}
alias stopflood {
 timerflood off
}

Then use commands /startflood and /stopflood to enable and disable it...

Link to comment
How do i load a separate script also?

/load -rs votekick.mrc

how can i put this one on?

EDIT: Actually I was talking bs, what was I thinking. Check Aerons note in his long post. So you need to move all the if sentences from votekick.mrc and yourscript.mrc to same file under the same mta.texts and mta.joins...
Link to comment

Kicking inactive joined-users:

alias mta.join {
$+(.timerIK,$1,$2) 1 60 mta.kick $1 $2
}
alias mta.text {
$+(.timerIK,$1,$2) off
}
alias mta.kill {
$+(.timerIK,$1,$2) off
}
alias mta.action {
$+(.timerIK,$1,$2) off
}
alais mta.pm {
$+(.timerIK,$1,$2) off
}

(IK in timerIK stands for Idle Kick)

(Untested)

Link to comment

Aeron, it usually takes me that 60 seconds to get properly joined to the game after clicking Connect, so that is a really bad idea. Maybe a 5-10 minute timer restarting every time a player does anything, and then if the timer gets to its end, the player would be kicked. But I sometimes just drive around for ten minutes without saying anything, so that would kick me too even if I'm not idling.

Link to comment

Idle kick is a bad idea in my opinion, people should be free to play without talking, and not forced to kill / be killed if all they want to do is drive around or whatever. Wait until future admin connections have more game state information

Link to comment

Dealer NO, ffa means just that, free for all, players have the freedom to do whatever they wish in mta, be it kill, play taxi, role play, drive fast, run around staring at trees.. whatever they like, stunt server is a place people can go without worrying about weapons being in the mix.

Link to comment

a script request:

1on1:

a script where 2 people call a 1on1 match between eachother. and if anyone interferes by killing them, then they are kicked/temp banned, and if the duelers attack anyone else, they get kicked/temp banned (both of them at once)

add to that a scoring system

i realize this isn't practical for large servers, too much could go wrong, but it would still be nice for a small server

Link to comment

I've written a couple of scripts which I hope people will find useful.

1) MTAMA Multiplexer http://www.mapnest.org/mta/mta_multiplex.zip

Basically, this script allows you to have multiple mta.event aliases (ex. mta.join) With it, you can define (via an ini file) multiple aliases to be triggered by MTA events. The reason I made this was so you didn't have to merge your script with someone else's, just to make it work.

So, instead of messing up the manhunt code by merging in something you've done, you'd just rename mta.join in manhunt.mrc to manhunt.join, add an entry to the mta_multiplex.ini like so:

[manhunt]

join=1

And of course, make the mta.join in whatever you coded myjunk.join, along with an ini entry for your function

[myjunk]

join=1

Now both .join functions will execute when mta.join is called.

In any case, I hope I explained it satisfactorily.

2) MTAMA Admin-Auth http://www.mapnest.org/mta/mta_auth.zip

(This script includes and uses MTAMA Multiplexer)

A way of giving people different levels of access to your server by having them register a nick and password with you in IRC, then join your server and auth with their password.

Current levels of access include:

10 access to +admin_say

50 access to +kick

100 access to +say (server say), and +ban

This script also has the ability to reserve nicks by adding them as headings in an ini file. When you do this the person connecting will have 30 seconds to enter the password they set up in IRC, or they will be kicked.

The +commands are all done through /msg, so the server will kick people who connect usng the command trigger at the beginning of their nick. The command trigger can be cusomized through the ini file, so if you have a lot of people connecting with + beginning their names, you could change it to another character.

Link to comment
a script where 2 people call a 1on1 match between eachother.
Okay, I'm working on a script where player can challenge another player to a duel with !duel . The other player has to !accept in 10 seconds or the challenge is rejected and removed. During duel the duelers cant kill anyone but the one he is dueling with, or the duel is concidered to be over and the scores are announced. The duel ends when one of the duelers reach maxscore. The duel can also be canceled with !end. Duelers get 1 point for each kill and they lose 1 point for each suicide. They dont lose points if the other dueler or someone from outside the duel kills them. If an outsider kills a dueler, the outsider is kicked. Players who join the server during a duel get informed about ongoing duels so that they dont accidentally kill any duelers. Thats it. I'm kinda busy but I hope I get this ready and tested before the end of the week.
Link to comment
Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...