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

ok, this is a simple script that calculates the 3d coord vector between 2 players in vc. This script requires Admin+ to be active and will not function without it being on.

To use simple put the aliases anywhere in the blank parts of your script and put the !distance part under mta.command.

Here is the script for under mta.command:

   elseif (($3 == !distance) && ($mta.admin+($1) == $true)) {
     if ($4 != $null) {
       if ($5 != $null) {
         distance.calc.x $1-
         distance.calc.y $1-
         distance.calc.z $1-
         mta.say $1 $mta.name($1,$mta.getid($1,$4)) is $round($sqrt($calc($calc(%x * %x) + $calc(%y * %y) + $calc(%z * %z))),2) Metres from $mta.name($1,$mta.getid($1,$5))
       }
       else {
         mta.say $1 Syntax: !distance 
       }
     }
     else {
       mta.say $1 Syntax: !distance 
     }
   }

Here are the aliases it links to:

alias distance.calc.x {
 if ($gettok($mta.location($1,$mta.getid($1,$4)),1,32) < $gettok($mta.location($1,$mta.getid($1,$5)),1,32)) {
   set %x $calc($gettok($mta.location($1,$mta.getid($1,$5)),1,32) - $gettok($mta.location($1,$mta.getid($1,$4)),1,32))
 }
 else {
   set %x $calc($gettok($mta.location($1,$mta.getid($1,$4)),1,32) - $gettok($mta.location($1,$mta.getid($1,$5)),1,32))
 }
}
alias distance.calc.y {
 if ($gettok($mta.location($1,$mta.getid($1,$4)),2,32) < $gettok($mta.location($1,$mta.getid($1,$5)),2,32)) {
   set %y $calc($gettok($mta.location($1,$mta.getid($1,$5)),2,32) - $gettok($mta.location($1,$mta.getid($1,$4)),2,32))
 }
 else {
   set %y $calc($gettok($mta.location($1,$mta.getid($1,$4)),2,32) - $gettok($mta.location($1,$mta.getid($1,$5)),2,32))
 }
}
alias distance.calc.z {
 if ($gettok($mta.location($1,$mta.getid($1,$4)),3,32) < $gettok($mta.location($1,$mta.getid($1,$5)),3,32)) {
   set %z $calc($gettok($mta.location($1,$mta.getid($1,$5)),3,32) - $gettok($mta.location($1,$mta.getid($1,$4)),3,32))
 }
 else {
   set %z $calc($gettok($mta.location($1,$mta.getid($1,$4)),3,32) - $gettok($mta.location($1,$mta.getid($1,$5)),3,32))
 }
}

Link to comment

I can't figure this out... is there a way to determine when a player is within a certain area via XY coordinates? Such as ...

alias mta.hotzone
if ((404 < [X value] < 425) && (617 < [Y value] < 645)) {
 mta.say $1 whatever
 }
}

I've tried a few things, none of which worked. I can't figure out how to seperate the X,Y,Z values. Help would be much appreciated.

Link to comment

alias mta.pm {
if ($3 == uva) {  
 mta.uvamsg $1-
}
}

alias mta.uvamsg { 
 set %playerid 0 
 while ( $mta.maxplayers($1) > %playerid ) { 
  if ([uVA] isin $mta.name($1, %playerid)) {
   mta.msg $1 %playerid $mta.name($1,$2) : $4-
  }
  %playerid = %playerid + 1 
 }
 unset %playerid
}

made this recently and thought other people may find it rather useful. if you havn't guessed it will send a message to everyone on the server with the clan tag that you put in it. i give people the right to change it and use it as they want to

Link to comment

I tryed to make a new script for my server but if i do !weapon

the server alway's say <(SFA)James has a Punch/Kick>

Can comeone help me with this one :?

 if $3 == !weapon {
   if $4 == $null mta.say $1 Error - Syntax: !weapon 
   elseif $mta.weapon($1,$4).name == knive mta.say $1 WHAAAA $mta.name($1,$4) has a knive LOOK OUT!!!! 
   else mta.say $1 $mta.name($1,$4) has a $mta.weapon($1,$4).name
  }

Link to comment

mta.weapon works off weapon id NOT player id, just a hint ;)

and here is a more advanced clan PM feature. The format is:

/msg clan

  if ($3 == clan) {
   if ($4 != $null) {
     set %playerid 0 
     while ( $mta.maxplayers($1) > %playerid ) { 
       if (($4 isin $mta.name($1, %playerid)) && $mta.name($1,$2) != $mta.name($1, %playerid)) { 
         mta.msg $1 %playerid $mta.name($1,$2) $+ : $5- 
       } 
       %playerid = %playerid + 1 
     } 
     mta.msg $1 $2 Message delivered to all members of $4
     unset %playerid 
   }
   else {
     mta.msg $1 $2 Syntax: /msg clan 
   }
 }

Link to comment

yeah but im waiting for 3.08 to be out before i release it.

As for the weapon thing, its so simple.

alias mta.kill {
 mta.say $1 $mta.name($1,$3) killed $mta.name($1,$2) with a $mta.weapon ($1,$4)
}

there is a tiny example for u, that should help clear things up

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

    • No registered users viewing this page.

×
×
  • Create New...