multitheftauto / mtasa-blue

Multi Theft Auto is a game engine that incorporates an extendable network play element into a proprietary commercial single-player game.
https://multitheftauto.com
GNU General Public License v3.0
1.38k stars 427 forks source link

createBuilding optional arguments not handled correctly #3738

Open Proxy-99 opened 1 week ago

Proxy-99 commented 1 week ago

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

TracerDS commented 1 week ago

createBuilding expects 7 parameters image

Providing just the model and position works though

Proxy-99 commented 1 week ago

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

TracerDS commented 1 week ago

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

Proxy-99 commented 1 week ago

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

TracerDS commented 1 week ago

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

Proxy-99 commented 1 week ago

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)
TracerDS commented 1 week ago

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.