Jump to content

MTAMA Experiment: $mta.area(<Serv>,<ID>)


Aeron

Recommended Posts

I'm currently working on the $mta.area(,) identifer which tells you in what area the given player is. Ex "Basketball-field Chinatown Portland".

I ask advanced MTA:mA users to set up area's for GTA:VC and GTA:3

Here is the code to set up area's:

; Area Pointer script v1.0
;This script is for setting up area's
alias -l mta.location {
 ;This function is not needed when v3.08 is out.
 !tokenize $1-3 $dll($scriptdirmta.dll,location,$1-2)
 if ($4 == $null) !return Unknown
 elseif ($3 == x) !return $4
 elseif ($3 == y) !return $5
 elseif ($3 == z) !return $6
 else !return $4-
}
alias mta.command {
 if (!c == $3) {
   !unset %area
   mta.say $1 Points cleared.
 }
 if (!p == $3) {
   %area = %area $+ $chr(44) $+ $mta.location($1,$2,x) $+ $chr(44) $+ $mta.location($1,$2,y)
   mta.say $1 $calc($count(%area,$chr(44)) /2) area point(s) set 
 }
 if (!s == $3) {
   var %a
   if ($did(mta,$1 $+ 33) == GTA:3) %a = AREA1
   elseif ($did(mta,$1 $+ 22) == Stunt) %a = AREA2
   else %a = AREA3
   !writeini " $+ $scriptdirmta.area.ini" %a %area $4-
   !unset %area
   mta.say $1 Area saved as " $+ $4-"
 }
 if (!a == $3) {
   mta.say $1 $mta.area($1,$2)
 }
}
alias mta.area {
 ;This function is maybe not needed when v3.08 is out.
 var %a,%b = 1,%c = $mta.location($1,$2,x),%d = $mta.location($1,$2,y),%e
 if ($did(mta,$1 $+ 33) == GTA:3) %a = AREA1
 elseif ($did(mta,$1 $+ 22) == Stunt) %a = AREA2
 else %a = AREA3
 while %b <= $ini($scriptdirmta.area.ini,%a,0) {
   %e = $ini($scriptdirmta.area.ini,%a,%b)
   if ($inpoly(%c,%d, [ %e ] )) !return $readini($scriptdirmta.area.ini,%a,%e)
   !inc %b
 }
 !return Unknown
}

Commands:

!c - clears the current set pointers

!p - sets a area point

!s - saves the area to mta.area.ini (Please define as: Building Neighbourhood Island)

!a - Tells you in which area you are.

Some notes:

I dont help you with this, i recommend only advanced MTA:mA users to handle this script

This is a function in development it might not be included in the next version (v3.08 )

Use only 4 or more points to set up a area

Don't make comments over my english spelling ;)

I gonna own some CS players on Campzone now (Campzone = Big LAN-party with ~1800 peeps in tents, campers)

Futher dump ur mta.area.ini HERE (in this topic) and comments.

Link to comment

yes 6.16 is the latest version.

i don't have the invalid $inpoly i changed it to elseif instead of if and now it doesn't give me that but still getting the unkown for the x/y coordinates in the mta.area.ini file. that seems to be the only prob and not to sure how to fix it

Link to comment

ok i've tried all kinds of shit and i have no clue why it says unknown

:(:(

so if anyone else knows about scripting pls try to fix this prob cuz its a great idea and could lead to a whole bunch of new shit if we could get a working copy

EDIT------ ok thx to oli we got a working portion of this script

alias mta.command { 
 if (!c == $3) { 
   !unset %area 
   mta.say $1 Points cleared. 
 } 
 if (!p == $3) { 
   %area = %area $+ $chr(44) $+ $gettok($mta.location($1,$2),1,32) $+ $chr(44) $+ $gettok($mta.location($1,$2),2,32)
   mta.say $1 $calc($count(%area,$chr(44)) /2) area point(s) set 
 } 
 if (!s == $3) { 
   var %a 
   if ($did(mta,$1 $+ 33) == GTA:3) %a = AREA1 
   elseif ($did(mta,$1 $+ 22) == Stunt) %a = AREA2 
   else %a = AREA3 
   !writeini " $+ $scriptdirmta.area.ini" %a %area $4- 
   !unset %area 
   mta.say $1 Area saved as " $+ $4-" 
 } 
 if (!a == $3) {
   mta.say $1 $mta.area($1,$2)
 }
}

now the only thing that remains is making the rest of it to work

Link to comment
  • 2 weeks later...
  • 10 months later...

This is a huge bump but i have a question about this

Area-setup script

;This scripts makes costum area that are not defined yet.

;Steps to set a area:

;Clear the buffer, type: !c

;Stand in every corner of the area and type: !p

;Save the area with: !s

;Name the area as followed:

This is for setting custom areas that have NOT been set...

What would I need to do to change an area that is most likely defined as more than one area in the current mta.data.ini?

This is for a stand alone script not running with the GRS so should I take an old mtadata and define my own few areas?

I would prefer to use the well defined script but I want to push out some of the borders.

Link to comment

Ok, easiest and quickest thing to do, would be to use this script, and then save the area as a new name...then go into the mta.data.ini and move it from the bottom to the top of the section ([AREA1] for gta3, [AREA2] for vc).

Or, you could edit this area saving script, and output the areas to a new ini, or new ini section, then copy the mta.area alias and edit it to suit your new file.

That way your new areas will be in a seperate ini, and won't get overwritten.

eg:

on *:SIGNAL:mta.command: {
 ;!c clears the buffer with pointers
 if (!c == $3) {
   !unset %area
   mta.say $1 Area cleared.
 }
 ;!p sets a area point
 if (!p == $3) {
   %area = %area $+ $chr(44) $+ $round($mta.location($1,$2,x),4) $+ $chr(44) $+ $round($mta.location($1,$2,y),4)
   mta.say $1 $calc($count(%area,$chr(44)) /2) point(s) set 
 }
 ;!s saves the area to my.data.ini
 if (!s == $3) {
   var %a
   if ($did(mta,$1 $+ 33) == GTA:3)  !writeini " $+ $scriptdirmy.data.ini" AREA1 $right(%area,-1) $4-
   elseif ($did(mta,$1 $+ 22) == Stunt) !writeini " $+ $scriptdirmy.data.ini" AREA2 $right(%area,-1) $4-
   else {
     !writeini " $+ $scriptdirmy.data.ini" AREA2 $right(%area,-1) $4-
     !writeini " $+ $scriptdirmy.data.ini" AREA3 $right(%area,-1) $4-
   }
   !unset %area
   mta.say $1 Area saved as " $+ $4-"
 }
 ;!a Tells you in which area you are
 if (!a == $3) {
   mta.say $1 $my.area($1,$2)
 }
}

alias my.area {
 if (!$readini($scriptdirmy.ini,$1,admin+)) !return Disabled
 var %a,%b = 1,%c = $dll($scriptdirmta.dll,location,$1-2 x),%d = $dll($scriptdirmta.dll,location,$1-2 y),%e
 if (%c == Unknown) !return Unknown
 if ($did(mta,$1 $+ 33) == GTA:3) %a = AREA1
 else %a = AREA2
 while (%b <= $ini($scriptdirmy.data.ini,%a,0)) {
   %e = $ini($scriptdirmy.data.ini,%a,%b)
   if ($inpoly(%c,%d, [ %e ] )) !return $readini($scriptdirmy.data.ini,%a,%e)
   !inc %b
 }
 !return $iif($did(mta,$1 $+ 33) == GTA:3,Liberty-City,Vice-City)
}

Link to comment
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...