View Issue Details

IDProjectCategoryView StatusLast Update
0004016Multi Theft Auto : San AndreasServerpublic2009-05-10 12:58
ReporterDevan_LT Assigned To 
Status resolvedResolutionfixed 
Fixed in Version1.0 
Summary0004016: Contact client-side element and getElementPosition()

When player is standing on a client-side entity, getElementPosition() returns wrong coordinates like player is somewhere around center of the map. This happens only in the server side.

TagsNo tags attached.



2009-02-13 14:13

administrator   ~~0008366

If it was so markers/colshapes would not work on custom maps. Willy couldn't reproduce this too. Maybe you could give some script where this can get reproduced?


2009-02-14 09:16

viewer   ~~0008371

local px,py,pz = getElementPosition(source)
pz = pz-1
px = math.floor(px100)/100
py = math.floor(py
pz = math.floor(pz100)/100
local pang = getPedRotation(source)
pang = math.floor(pang
outputChatBox("x=\""..px.."\" y=\"""\" z=\""..pz.."\" ang=\""..pang.."\"")

When server side function returns: x="0.03" y="1.12" z="2.38" ang="359.78"
client side function (no math.floor and anything like that) returns: 0.030984837561846 6.1292781829834 4.387638092041 359.78979492188

I just tried this with object: additional_objects[4] = createObject(2946,0,5,1)
I realized server-side getElementPosition() returns position starting from contact element (if it's object), not center of the map. Because client-side position - server-side position = object position: 6.12 - 1.12 = 5


2009-03-07 16:11

administrator   ~~0008487

"centre of the map"? Do you mean centre of the object.


2009-05-10 12:55

reporter   ~~0009124

It is caused by the server receiving their position relative to an element that it doesn't know about (a client-side element). As it doesn't know that the element exists, it cannot add the element's position on to the player's.

I've submitted a patch at:

Issue History

Date Modified Username Field Change