Polak0 Posted January 14, 2022 Share Posted January 14, 2022 Hello, I want to create a test script for unique vehicle using "engineRequestModel". I have problem, because i don't know how I can give vehicle ID from c.side to s.side. c. side script. [lua] function sultan_create (heatchback) id_sultan = engineRequestModel("vehicle", 560) local txd = engineLoadTXD("sultan.txd") engineImportTXD(txd, id_sultan) local dff = engineLoadDFF("sultan.dff") engineReplaceModel(dff, id_sultan, true) outputChatBox("created") end addEvent( "sultan:heatchback", true ) addEventHandler( "sultan:heatchback", localPlayer, sultan_create, id_sultan, heatchback ) [/lua] s. side script: [lua] addCommandHandler ( "sultan_heachback", function (thePlayer ) local x,y,z = getElementPosition(thePlayer) heatchback = createVehicle(560, x, y+2.5, z+0.5, 0, 0, 0) triggerClientEvent ( thePlayer, "sultan:heatchback", thePlayer, id_sultan, heachback) end) [/lua] Link to comment
Shady1 Posted January 14, 2022 Share Posted January 14, 2022 (edited) Hello Polak0,Unfortunately, you cannot create a rideable vehicle on the server side at the moment, but you can do it on the client side. local id_sultan addEventHandler("onClientResourceStart", resourceRoot, function() id_sultan = engineRequestModel("vehicle", 411) local txd = engineLoadTXD("sultan.txd") engineImportTXD(txd, id_sultan) local dff = engineLoadDFF("sultan.dff") engineReplaceModel(dff, id_sultan) outputDebugString("Custom sultan id: "..id_sultan) end ) addCommandHandler ("sultan", function () triggerServerEvent("requestCreateCustomSultan", root, id_sultan) end) addEvent("createCustomSultan", true) addEventHandler("createCustomSultan", root, function() createVehicle(id_sultan, 0, 0, 3) end ) this is sample code. server : addEvent("requestCreateCustomSultan", true) addEventHandler("requestCreateCustomSultan", root, function() triggerClientEvent(root, "createCustomSultan", root) end ) Edited January 14, 2022 by eoL|Shady 1 Link to comment
Shady1 Posted January 14, 2022 Share Posted January 14, 2022 (edited) you can thank me for helping @Polak0 Edited January 14, 2022 by eoL|Shady 1 Link to comment
The_GTA Posted January 15, 2022 Share Posted January 15, 2022 Sounds like you want to use this MTA library resource: How about you try creating a script that uses this resource by @FernandoMTA? 1 Link to comment
Polak0 Posted February 1, 2022 Author Share Posted February 1, 2022 On 15/01/2022 at 01:17, The_GTA said: Sounds like you want to use this MTA library resource: How about you try creating a script that uses this resource by @FernandoMTA? I heard about this script, but I don't wanna use it. I want to create script just for one vehicle that I can drive, spawn whenever I want - and I don't know how I can do it. I tried something with setElementModel, but it still not working. Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now