mtasa-blue icon indicating copy to clipboard operation
mtasa-blue copied to clipboard

createBuilding optional arguments not handled correctly

Open Proxy-99 opened this issue 1 year ago • 7 comments

Describe the bug

doing code below will throw error for arg 5 expect vector get none

Steps to reproduce

createBuilding ( 3534, -2412.30884, -601.68127, 132.56250) or createBuilding ( 3534, -2412.30884, -601.68127, 132.56250,90) without rz or ry gives error

Version

No response

Additional context

No response

Relevant log output

No response

Security Policy

  • [X] I have read and understood the Security Policy and this issue is not security related.

Proxy-99 avatar Sep 19 '24 18:09 Proxy-99

createBuilding expects 7 parameters image

Providing just the model and position works though

TracerDS avatar Sep 19 '24 18:09 TracerDS

createBuilding expects 7 parameters image

Providing just the model and position works though

but doing createBuilding ( 3534, -2412.30884, -601.68127, 132.56250,90,0) will break it xd

Proxy-99 avatar Sep 19 '24 18:09 Proxy-99

createBuilding expects 7 parameters image Providing just the model and position works though

but doing createBuilding ( 3534, -2412.30884, -601.68127, 132.56250,90,0) will break it xd

because you need to provide full vector

TracerDS avatar Sep 19 '24 18:09 TracerDS

createBuilding expects 7 parameters image Providing just the model and position works though

but doing createBuilding ( 3534, -2412.30884, -601.68127, 132.56250,90,0) will break it xd

because you need to provide full vector

we should correct it anyway if not ry given it should be set 0 as for createObject does

Proxy-99 avatar Sep 19 '24 18:09 Proxy-99

we should correct it anyway if not ry given it should be set 0 as for createObject does

Then we should use x,y,z instead of CVector

TracerDS avatar Sep 19 '24 18:09 TracerDS

we should correct it anyway if not ry given it should be set 0 as for createObject does

Then we should use x,y,z instead of CVector

we still could use vectors but handled them in a correct way

if you look for

CClientObject* CStaticFunctionDefinitions::CreateObject(CResource& Resource, unsigned short usModelID, const CVector& vecPosition, const CVector& vecRotation,       bool bLowLod)

Proxy-99 avatar Sep 19 '24 19:09 Proxy-99

CStaticFunctionDefinitions::CreateObject is a terrible example. CVector is already constructed when you call CreateObject, whereas in createBuilding it is being constructed when calling the function from lua.

TracerDS avatar Sep 19 '24 19:09 TracerDS