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

Posted

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))
 }
}

Proud member of Multi Theft Auto

Founder of Full Metal Jacket

mtateam5fq.png

fmjbar2hk.png

Creator of MTA:mA:GRS

http://www.mtafmj.com

http://www.full-fat.com

Posted

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.

whatever.jpg
Posted

opium do you check your email account you used to sign up for the mta scripts forum, i sent you an email...

sorry to keep posting off topic here but its the only way we can sort this once and for all and never hear about it again

NO..... You go to hell, You go to hell and you die!

x32staff.gif

koop.jpg

Posted

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

Posted

seems to me itd be much shorter and simpler to do:

alias mta.join {
 if ([TAG] isin $mta.name($1,$2)) {
   mta.msg $1 Hello farty pants!
 }
}

The artist formerly known as [MTA]MrBump

Posted

Actually ignore that, i just re-read your post and realised you are doing something different to an onjoin :)

The artist formerly known as [MTA]MrBump

Posted

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
  }

elseif ($3 == !offtropic ) {

mta.say $1 That's offtropic mta.name( $2 , $4 )

mta.kick $1 $4

}

elseif ($3 == !EN ) {

mta.say $1 Hi all, Sorry for my bad english :S

mta.ban $1 $4

}

Posted

:roll: Duh I did the weapon thing, maybe I must remove .name but that’s also no working.

[uVA]_ZZZ if you don’t now what you talking about pls don’t say anything

thanks :cry:

elseif ($3 == !offtropic ) {

mta.say $1 That's offtropic mta.name( $2 , $4 )

mta.kick $1 $4

}

elseif ($3 == !EN ) {

mta.say $1 Hi all, Sorry for my bad english :S

mta.ban $1 $4

}

Posted

Simple programming knowledge:

if (statement) {
 ; do if statement is True
} 
else {
 ; do if statement is False
}

Just look at your if statement... if has to be

 if (statement)

av.png

Posted
:roll:

[uVA]_ZZZ if you don’t now what you talking about pls don’t say anything

I blatantly know more than u, u cant even write 1 line ccorrect!

and im positive the $mta.weapon does not work (correctly)!

Posted

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 
   }
 }

Proud member of Multi Theft Auto

Founder of Full Metal Jacket

mtateam5fq.png

fmjbar2hk.png

Creator of MTA:mA:GRS

http://www.mtafmj.com

http://www.full-fat.com

Posted

yeh, dint think u could get name of weapon a person has!

i did a clan pm too,

i suppose urs is SLIGHTLY better! :P

u still doin that cops n robbers one?

Posted

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

Proud member of Multi Theft Auto

Founder of Full Metal Jacket

mtateam5fq.png

fmjbar2hk.png

Creator of MTA:mA:GRS

http://www.mtafmj.com

http://www.full-fat.com

Posted

well...

i want it to show the weapon a person is carrying at the time! not wot they killed with, is this possible?

i dint think it was!

Posted

ok i have now

 if $3 == !weapon {
   mta.say $1 You have a $mta.weapon($1,$2) 
  }

but if i change now my weapon i also see the message

That $mta.weapon($1,$2) is now work at my script :?

elseif ($3 == !offtropic ) {

mta.say $1 That's offtropic mta.name( $2 , $4 )

mta.kick $1 $4

}

elseif ($3 == !EN ) {

mta.say $1 Hi all, Sorry for my bad english :S

mta.ban $1 $4

}

Posted

OMG, dont u listen!

$mta.weapon(N, WEAPON ID)

this does not return the weapon a player has!

it returns the NAME of a weapon from the weapon ID!

...and even if it did work, that line is still wrong!

Posted

Has someone a list from all the weapon id's ??

elseif ($3 == !offtropic ) {

mta.say $1 That's offtropic mta.name( $2 , $4 )

mta.kick $1 $4

}

elseif ($3 == !EN ) {

mta.say $1 Hi all, Sorry for my bad english :S

mta.ban $1 $4

}

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

    • No registered users viewing this page.

×
×
  • Create New...