[Include] DynamicMaps (In Game) v0.1
#1


This include allows you create GTA San Andreas maps (made of 4 object-parts), attach to them differrent points, marks, etc. and edit them (move, change object index, change size, set position on the map pointing to world coordinates x,y).
To make it more clear, i made a video:

[ame]http://www.youtube.com/watch?v=ht4K7YmKAyI[/ame]

I. Functions
DynamicMap:CreateDynamicMap(Float:_center_x, Float:_center_y, Float:_center_z, Float:_rotation_z, _vw = -1, _i = -1)
Creates a DynamicMap formed from 4 GTA objects, having the center - the first 3 paramaters.
Parameters:
Float:_center_x, Float:_center_y, Float:_center_z - center coordinates of the map

Float:_rotation_z - R-Z rotation of the whole map
_vw - virutal world of the map (by default -1 - all virtual worlds)
_i - map interior (by default -1 - all interiors)

Returns:
DynamicMap:mapid, if the map was successfully created.
INVALID_MAP_ID, failed to created (mapid exceeds MAX_MAPS)
Note: You have to use all virtual worlds or all interiors in order to have points in different virtual worlds or interiors attached to the same map.
DestroyDynamicMap(DynamicMap:mapid)
Destroys a DynamicMap and all the points attached to it.
Parameters:
DynamicMap:mapid - the id of the map to destroy.

Returns:
0 - failed, map is not created.
1- successfully destroyed.
Point:CreatePointForDynamicMap(DynamicMap:mapid, point_object, Float:_point_size=0.0, Float:p_realC_x = 0.0, Float:p_realC_y = 0.0, _vw = -1, _i = -1)
Creates and attaches a point to the dynamicmap having the specified object index, point size (distance from map), interior and virtual world, accroding to the world coordinates x, y.
Parameters:
DynamicMap:mapid - the id of the map the point will be attached to.
point_object - object index of the point (use defined object indexes).
_point_size - the distance between map and center of the point (use defined sizes).
Float:p_realC_x = 0.0, Float:p_realC_y = 0.0 - real coordinates the point will represent on map (by defaul center of the map).
_vw = -1, _i = -1 - virtual world and interior (by default - map interior and virtual world).
Returns:
INVALID_POINT_ID - failed to create point (pointid exceeds MAX_POINTS)
Point:pointid - successfully created.
DestroyPoint(Point:_pointid)
Destroys a point.
Parameters:
Point:_pointid - the id of the point to destroy.

Returns:
0 - failed, point is not created.
1- successfully destroyed.
SetPointSize(Point:_pointid, Float:_pt_size)
Changes the distance between point and map(size) to _pt_size. Works on moving points.
Parameters:
Point:_pointid - the id of the point.
Float:_pt_size - new size of the point (use defined sizes).

Returns:
0 - failed, point is not created.
1- size changed.
2- size changed while point was moving.
SetPointObject(Point:_pointid, pointobject)
Changes the object index of the point. If the point is moving, it will stop on it's current position.
Parameters:
Point:_pointid - the id of the point.
pointobject - the new object index.

Returns:
0 - failed, point is not created.
1 - object index changed.
AssignPointToPos(Point:_pointid, Float:real_x, Float:real_y)
Assigns the point position on map to real_x and real_y parameters.
Parameters:
Point:_pointid - the id of the point.
Float:real_x, Float:real_y - real x and real y world coordinates.

Returns:
0 - failed, point is not created.
1 - successfully.
MovePointForPos(Point:_pointid, Float:real_mx, Float:real_my, Float:movespeed = 0.1)
Smoothly mooves the point (with the specified movespeed) from it's current position, to the map position pointing to the real mx and my world coordinates.
Parameters:
Point:_pointid - the id of the point.
Float:real_mx, Float:real_my - real x and real y world coordinates.
Float:movespeed = 0.1 - movespeed (by default 0.1).
Returns:
0 - failed, point is not created.
1 - successfully.
GetDynamicMapCoords(Float:x,Float:y, DynamicMap:mapid, &Float:on_map_x,&Float:on_map_y,&Float:on_map_z , Float:_point_size)
Gets a point coordinates on the specified map according to real x, real y and point size, and stores them in Float:on_map_x, Float:on_map_y, Float:on_map_z.
Parameters:
Float:x,Float:y - real x and y world coordinates.
DynamicMap:mapid - the id of the map.
&Float:on_map_x,&Float:on_map_y,&Float:on_map_z - the variables to store point coordinates in.
_point_size - the distance between coordinates and map.
Returns:
The function doesn't return a value.
v 0.2:

GetDynamicMapPointRealCoords(DynamicMap:_mapid, Float:on_map_x, Float:on_map_y, Float:on_map_z, &Float:real_x, &Float:real_y)
This function gets the real coordinates which the specified coordinates point to on a certain dynamic map and passes them to variables on_map_x, on_map_y.

Parameters:
DynamicMap:_mapid - id of the map
Float:on_map_x, Float:on_map_y, Float:on_map_z - varibales which store the map coordinates.
&Float:on_map_x,&Float:on_map_y,&Float:on_map_z - variables to which the function will return the real coordinates.
Returns:
The function doesn't return a value.
II. Defined constants
Point object indexes:
PHP код:
POINT_WHITE
POINT_GREEN
POINT_RED
POINT_ORANGE
POINT_YELLOW 
Point sizes:
PHP код:
TINY_POINT,
SMALL_POINT,
MEDIUM_POINT,
BIG_POINT,
HUGE_POINT 
III. Notes
  • Include requires Streamer Plugin.
  • You have to include DynamicMaps after a_samp and streamer.
  • You can manualy define MAX_MAPS and MAX_POINTS before including DynamicMaps to save memory.
IV.Download
Pastebin - CLICK

Reply
#2

You need to set an objects position after it moves otherwise it might get out of sync for some players.
Reply
#3

Quote:
Originally Posted by [uL]Pottus
Посмотреть сообщение
You need to set an objects position after it moves otherwise it might get out of sync for some players.
Didn't know about this, perhaps StopDynamicObject before changing position may fix it?
Reply
#4

Wow, it's really cool
Reply
#5

Thanks!
Reply
#6

Very nice.
Also, you made the thread look very decent and clear.
Reply
#7

Nice, also functions documented well. +REP
Reply
#8

Thanks!
Reply
#9

Good work.
Reply
#10

It is very nice although I'm having some trouble finding a use for it.

I was thinking of using it to locate buses or something that go around San Andreas. Any other ideas?
Reply
#11

Quote:
Originally Posted by JacobEdwards
Посмотреть сообщение
It is very nice although I'm having some trouble finding a use for it.

I was thinking of using it to locate buses or something that go around San Andreas. Any other ideas?
Was finking to release a system of a unique RolePlay cop pursuit at the same time with the new update - getting the real coordinates of the bullet that hit certain map. The idea of the cop pursuit is that when someone wanted uses a telephone (for RolePlay purposes) - a moving red point is created on the map pointing to that' someone real coordinates. A police traffic controller will ask for reinforcements and the police officers accepting the call will see a checkpoint according to the place where the traffic controller will shoot (with any bullet gun, from RP point of view - a laser) to point out where the wanted player is going. If the wanted player is not captured within 5 minutes - the red point dissapears. The cops (or cop cars) are aswell marked on the map with points of different colour. Sounds weird, but i'm sure this will look cool .
Reply
#12

Quote:
Originally Posted by SmileySmile
Посмотреть сообщение
Was finking to release a system of a unique RolePlay cop pursuit at the same time with the new update - getting the real coordinates of the bullet that hit certain map. The idea of the cop pursuit is that when someone wanted uses a telephone (for RolePlay purposes) - a moving red point is created on the map pointing to that' someone real coordinates. A police traffic controller will ask for reinforcements and the police officers accepting the call will see a checkpoint according to the place where the traffic controller will shoot (with any bullet gun, from RP point of view - a laser) to point out where the wanted player is going. If the wanted player is not captured within 5 minutes - the red point dissapears. The cops (or cop cars) are aswell marked on the map with points of different colour. Sounds weird, but i'm sure this will look cool .
Oh that'd be really cool!
Reply
#13

UPD: v0.2
* Added new function: GetDynamicMapPointRealCoords.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)