Akenture Posted September 16, 2016 Posted September 16, 2016 Hi, i made a move object script with OMG(object movement generator) and i created a file.lua and put the name in meta.xml but in the game the object doesn't exist!(and not move) i wrote /debugscript 3 script: function omg_plat1() plat1 = createObject(3095, 3052.1999511719, -973.59997558594, 1.6000000238419, 0, 0, 0) plat1Attach1 = createObject(3498, 3044, -973.40002441406, 1.5, 0, 90, 0) attachElements(plat1Attach1, plat1, -8.1999511719, 0.1999511718775, -0.1000000238419, 0, 90, 0) plat1Attach2 = createObject(3095, 3056.1999511719, -973.59997558594, -2.4000000953674, 0, 90, 0) attachElements(plat1Attach2, plat1, 3.999999999975, 2.5011104298756e-012, -4.0000001192093, 0, 90, 0) plat1Attach3 = createObject(3095, 3052.1999511719, -977.59997558594, -2.4000000953674, 90, 0, 0) attachElements(plat1Attach3, plat1, -2.5011104298756e-011, -3.9999999999975, -4.0000001192093, 90, 0, 0) plat1Attach4 = createObject(3095, 3052.1999511719, -969.59997558594, -2.4000000953674, 270, 0, 0) attachElements(plat1Attach4, plat1, -2.5011104298756e-011, 4.0000000000025, -4.0000001192093, -90, 0, 0) omgMoveplat1(1) end outputChatBox("#FF3300Se inicio el moveObject", 255, 255, 255, true) function omgMoveplat1(point) if point == 1 then moveObject(plat1, 3000, 3052.2001953125, -945.40002441406, 1.6000000238419, 0, 0, 0) setTimer(omgMoveplat1, 3000+500, 1, 2) elseif point == 2 then moveObject(plat1, 3000, 3052.1999511719, -973.59997558594, 1.6000000238419, 0, 0, 0) setTimer(omgMoveplat1, 3000+500, 1, 1) end end addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), omg_plat1)
Dealman Posted September 16, 2016 Posted September 16, 2016 Could you show your meta file? Do note that onResourceStart is a server-sided event and as such, you need to make sure the script is listed as a server-sided script in the meta.
Gravestone Posted September 16, 2016 Posted September 16, 2016 3 hours ago, Akenture said: function omg_plat1() plat1 = createObject(3095, 3052.1999511719, -973.59997558594, 1.6000000238419, 0, 0, 0) plat1Attach1 = createObject(3498, 3044, -973.40002441406, 1.5, 0, 90, 0) attachElements(plat1Attach1, plat1, -8.1999511719, 0.1999511718775, -0.1000000238419, 0, 90, 0) plat1Attach2 = createObject(3095, 3056.1999511719, -973.59997558594, -2.4000000953674, 0, 90, 0) attachElements(plat1Attach2, plat1, 3.999999999975, 2.5011104298756e-012, -4.0000001192093, 0, 90, 0) plat1Attach3 = createObject(3095, 3052.1999511719, -977.59997558594, -2.4000000953674, 90, 0, 0) attachElements(plat1Attach3, plat1, -2.5011104298756e-011, -3.9999999999975, -4.0000001192093, 90, 0, 0) plat1Attach4 = createObject(3095, 3052.1999511719, -969.59997558594, -2.4000000953674, 270, 0, 0) attachElements(plat1Attach4, plat1, -2.5011104298756e-011, 4.0000000000025, -4.0000001192093, -90, 0, 0) omgMoveplat1(1) end This function is not being handled. Add an event handler to it or try this: function omg_plat1() plat1 = createObject(3095, 3052.1999511719, -973.59997558594, 1.6000000238419, 0, 0, 0) plat1Attach1 = createObject(3498, 3044, -973.40002441406, 1.5, 0, 90, 0) attachElements(plat1Attach1, plat1, -8.1999511719, 0.1999511718775, -0.1000000238419, 0, 90, 0) plat1Attach2 = createObject(3095, 3056.1999511719, -973.59997558594, -2.4000000953674, 0, 90, 0) attachElements(plat1Attach2, plat1, 3.999999999975, 2.5011104298756e-012, -4.0000001192093, 0, 90, 0) plat1Attach3 = createObject(3095, 3052.1999511719, -977.59997558594, -2.4000000953674, 90, 0, 0) attachElements(plat1Attach3, plat1, -2.5011104298756e-011, -3.9999999999975, -4.0000001192093, 90, 0, 0) plat1Attach4 = createObject(3095, 3052.1999511719, -969.59997558594, -2.4000000953674, 270, 0, 0) attachElements(plat1Attach4, plat1, -2.5011104298756e-011, 4.0000000000025, -4.0000001192093, -90, 0, 0) omgMoveplat1(1) end setTimer(omg_plat1, 1000, 1)
Akenture Posted September 16, 2016 Author Posted September 16, 2016 7 hours ago, Dealman said: Could you show your meta file? Do note that onResourceStart is a server-sided event and as such, you need to make sure the script is listed as a server-sided script in the meta. <meta> <file src="archivos/vgshseing28.txd"></file> <file src="archivos/vgncarshade1.txd"></file> <script src="objetos.lua" type="client"></script> --txd loader <script src="trampas.lua" type="client"></script> --there is the moveObject <script src="trial.lua" type="client"></script> <info gamemodes="race" type="map" version="1.0.0"></info> <map src="akentureV5.map" dimension="0"></map> <settings> <setting name="#skins" value='[ "cj" ]'></setting> <setting name="#maxplayers" value="[ 128 ]"></setting> <setting name="#useLODs" value="[ false ]"></setting> <setting name="#gamespeed" value="[ 1 ]"></setting> <setting name="#ghostmode" value='[ "false" ]'></setting> <setting name="#time" value="5:30"></setting> <setting name="#vehicleweapons" value='[ "false" ]'></setting> <setting name="#minplayers" value="[ 0 ]"></setting> <setting name="#respawntime" value="[ 5 ]"></setting> <setting name="#gravity" value="[ 0.0080000004 ]"></setting> <setting name="#waveheight" value="[ 0 ]"></setting> <setting name="#weather" value="[ 0 ]"></setting> <setting name="#locked_time" value="[ true ]"></setting> <setting name="#duration" value="[ 1800 ]"></setting> <setting name="#respawn" value='[ "timelimit" ]'></setting> </settings> <script src="mapEditorScriptingExtension_s.lua" type="server"></script> <script src="mapEditorScriptingExtension_c.lua" type="client" validate="false"></script> </meta>
Dealman Posted September 16, 2016 Posted September 16, 2016 6 hours ago, Gravestone said: This function is not being handled. Add an event handler to it or try this: That function is being handled, but the event handler is at the bottom of the script. 28 minutes ago, Akenture said: <script src="trampas.lua" type="client"></script> --there is the moveObject There's your problem, as I already told you it needs to be set as a server script. Because you're using the event onResourceStart which is server only.
Akenture Posted September 16, 2016 Author Posted September 16, 2016 (edited) Thanks guys worked fine now i have another problem when i add a CreateMarker (i think is that) the rest of the script don't work i don't know why when add this script(i edited xyz of the createmarker) -- change the marker's coordinates, its size and text which will be displayed local marker = createMarker(x, y, z,"corona", size, 0, 0, 0, 0) local Text = "TEXT_HERE" --optional local size = 2 local text_duration = 5 -- seconds local animation_speed = 1000 local scaling_speed = 0.015 -- Don't change anything below local tick = getTickCount() local time, t_duration = 0, 0 local sx, sy = guiGetScreenSize() function onRender() progress = (getTickCount() - tick) tick = getTickCount() time = time + progress if DisplayText and DisplayText ~= nil then dxDrawText(""..DisplayText.."", sx / 2, 200, sx / 2, 200, tocolor(255, 255, 255, 255), size, "pricedown", "center", "center", false, false, true, true, false) if time > animation_speed then time = 0 t_duration = t_duration + 1 end if t_duration%2 == 0 then size = size + scaling_speed* else size = size - scaling_speed end if t_duration >= text_duration then resetStrings() end end end addEventHandler ( "onClientRender", getRootElement(), onRender) function onMarker (player) if player == getLocalPlayer() and isPedInVehicle(player) then if source == marker then resetStrings() DisplayText = Text tick = getTickCount() end end end addEventHandler("onClientMarkerHit", getRootElement(), onMarker) function resetStrings() DisplayText = nil size = 2 time = 0 t_duration = 0 end Edited September 16, 2016 by Akenture
Dealman Posted September 16, 2016 Posted September 16, 2016 size = size + scaling_speed* -- Might wanna remove that * If you use debugscript 3 you'll see errors like this.
Dealman Posted September 16, 2016 Posted September 16, 2016 You have a misplaced quotation mark just after the Z parameter for createMarker.
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