SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Plugin Development

Reply
 
Thread Tools Display Modes
Old 10/01/2010, 02:26 PM   #1
Kalcor
SA-MP Developer
 
Join Date: Apr 2005
Posts: 619
Reputation: 1905
Lightbulb MapAndreas plugin v1.0 beta

Plugin :: MapAndreas v1.0 beta

This plugin is designed to read provided data regarding the San Andreas map and provide that information to SA-MP pawn scripts.

This version contains a height map of the San Andreas geometry and provides a function to obtain the highest ground position from a provided 2D point. It is expected that future versions could include other types of maps, such as water maps and road maps.



Important: This plugin uses approximately 70MB of RAM. If you are using shared hosting or a VPS, please confirm with your host that this is okay. A version that uses less RAM is planned although it won't have the same level of accuracy.

Possible uses:

This plugin potentially has many uses although here are some obvious examples:

Teleporting:
When the server wants to teleport a player or vehicle to another player, right now the scripts will usually pick a point on the same Z position as the other player. It is only luck most of the time that prevents you from being teleported in to a building or wall, or even below the ground. Using the data made available by this plugin, the server could search around player to find a suitable ground position for teleporting.

Anti-cheat:
Using this plugin you can tell the difference between someone still on top of a building and someone still floating in the air.

Dynamic object placement:
You can potentially use this plugin to determine the ground position around a player for placing objects.

Pawn Natives:

pawn Code:
native MapAndreas_Init(mode); // Used to initalise the data files in to memory - should be called at least once before any other function.
native MapAndreas_FindZ_For2DCoord(Float:X, Float:Y, &Float:Z); // return highest Z point (ground level) for the provided X,Y co-ordinate.

Limitations of MapAndreas_FindZ_For2DCoord()

- San Andreas is a 3D world, although the output provided by this plugin only represents a single dimension. It will only return the highest Z co-ord for the X,Y position you provide. As an example, someone could be standing underneath a bridge and you won't be able to find the ground level which they are standing on. That means it's valid for a player to be beneath the highest ground level. Although using a height map has some serious drawbacks compared to 3D data, it is extremely fast and you can call this function almost as often as you like.
- The Z return value is accurate to 1.0 square world unit (1mē) for the entire San Andreas landmass (6kmē).
- The Z return value is accurate to within a few centimeters from the actual ground surface position.
- There is no data about heights below sea level (0.0Z). The function will always return 0.0 for those areas.
- There are parts of San Andreas below sea level that do not contain water. ie the quarry in LV and the underground airport terminal in LS.
- The SA map has small holes in some places. They are fairly rare, although these holes are often not big enough to fall through. The function will return 0.0 for these co-ords. You can potentially check neighbouring co-ordinates if you want to check if the 0.0 return value is a hole.
- This works only in interior 0 (main SA world) and cannot handle areas with custom objects.

Installation:

- Extract the contents of the zip in to your SA-MP server folder/directory.
- Windows Server: edit server.cfg and add the line: plugins MapAndreas
- Linux Server: edit server.cfg and add the line: plugins MapAndreas.so
- To test everything is working, you can load the mapandreas_test filterscript and use the /glvl command.

Downloads:

MapAndreas plugin v1.0 beta (28.2MB)
MapAndreas plugin v1.0 beta source code

Revision history:

v1.0 beta
---------
Initial test version.

Included files:

plugins/MapAndreas.dll - The Windows dll plugin.
plugins/MapAndreas.so - The linux shared object plugin.
scriptfiles/SAfull.hmap - The San Andreas heightmap data.
scriptfiles/SAfull.jpg - A graphical representation of the heightmap data.
pawno/include/mapandreas.inc - The pawn include for the MapAndreas plugin natives.
filterscripts/mapandreas_test.amx - A filterscript with a test command /glvl
filterscripts/mapandreas_test.pwn - Pawn script source for the above filterscript.
Kalcor is offline   Reply With Quote
Old 10/01/2010, 02:32 PM   #2
`FuTuRe-
Big Clucker
 
Join Date: Dec 2009
Posts: 111
Reputation: 0
Default Re: [REL,beta] MapAndreas plugin v1.0

nice job!
`FuTuRe- is offline   Reply With Quote
Old 10/01/2010, 03:32 PM   #3
Correlli
Godfather
 
Correlli's Avatar
 
Join Date: May 2009
Posts: 7,035
Reputation: 103
Default Re: [REL,beta] MapAndreas plugin v1.0

Great job Kye.
Correlli is offline   Reply With Quote
Old 10/01/2010, 03:33 PM   #4
cyber_punk
Gangsta
 
Join Date: Feb 2008
Location: Det. Mi. USA.....
Posts: 588
Reputation: 9
Default Re: [REL,beta] MapAndreas plugin v1.0

Damn nice, kinda sucks about that ram usage but should provide some nice uses. Thanks!
__________________
cyber_punk is offline   Reply With Quote
Old 10/01/2010, 03:43 PM   #5
Karlip
High-roller
 
Join Date: Oct 2007
Location: Click To Show
Posts: 1,883
Reputation: 100
Default Re: [REL,beta] MapAndreas plugin v1.0

Good job Kye!
__________________
Karlip is offline   Reply With Quote
Old 10/01/2010, 03:45 PM   #6
Westie
Gangsta
 
Westie's Avatar
 
Join Date: Jul 2009
Posts: 877
Reputation: 58
Default Re: [REL,beta] MapAndreas plugin v1.0

Awesome.
Westie is offline   Reply With Quote
Old 10/01/2010, 03:52 PM   #7
dice7
High-roller
 
Join Date: Apr 2009
Location: Slovenia
Posts: 2,244
Reputation: 13
Default Re: [REL,beta] MapAndreas plugin v1.0

Couldn't you do something like this with SetPlayerPosFindZ and a random player or even a bot ?
dice7 is offline   Reply With Quote
Old 10/01/2010, 04:00 PM   #8
Rac3r
Gangsta
 
Join Date: May 2007
Posts: 700
Reputation: 32
Default Re: [REL,beta] MapAndreas plugin v1.0

Excellent Kye.
Hopefully this will help with our grids, atm it's a static height then the others cars are dropped (or in some cases fall though floor).

Climbing too will be possible now, even if the building is a skyscraper. Perfect parkour mod.

I'm already loving this and I haven't even downloaded it yet.

Thanks a million. Let's hope KJ allows it for an update plugin install

Quote:
Originally Posted by dice7
Couldn't you do something like this with SetPlayerPosFindZ and a random player or even a bot ?
Speed and accuracy would be poor. Unless you got a genius way of doing it?
Rac3r is offline   Reply With Quote
Old 10/01/2010, 04:01 PM   #9
dice7
High-roller
 
Join Date: Apr 2009
Location: Slovenia
Posts: 2,244
Reputation: 13
Default Re: [REL,beta] MapAndreas plugin v1.0

Why would speed and accuracy be poor ? It would be instant
dice7 is offline   Reply With Quote
Old 10/01/2010, 04:02 PM   #10
Balon
Big Clucker
 
Join Date: Oct 2007
Posts: 177
Reputation: 2
Default Re: [REL,beta] MapAndreas plugin v1.0

Quote:
Originally Posted by dice7
Couldn't you do something like this with SetPlayerPosFindZ
pawn Code:
stock
  SetPlayerFindPosZ(playerid, Float:x, Float:y)
{
  new
    Float:z;

  MapAndreas_FindZ_For2DCoord(x, y, z);
  SetPlayerPos(playerid, x, y, z);
}
Balon is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[FilterScript] [FS] IRC Administrator and Echo FS for Jacobs IRC plugin (using zcmd beta) Zezombia Filterscripts 100 21/06/2014 02:39 PM
[FilterScript] [FS] Bomber script / MapAndreas usage example krisk Filterscripts 33 11/07/2011 11:02 AM
mapandreas.dll problem ? Rocky Balboa Help Archive 6 11/07/2010 05:45 PM
[FilterScript] [FS] Anti-Airbreak Proof of Concept ( Using MapAndreas plugin ) StunTEvo Filterscripts 5 17/01/2010 06:44 PM
Where can i get the beta of samp 0.3 ? reashaun14 Client Support 1 20/09/2009 11:53 PM


All times are GMT. The time now is 02:58 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.