blinkerchris Posted March 19, 2014 Share Posted March 19, 2014 Hey, I have a problem with a training script, the problem is that when I write /RES, (I will go to my spawn zone with /RES). And then my car freezes for like 2 secounds, and then I can drive. How to make it with 0 delays/make it drive at the time I write /RES? It's quite annoying. I'll paste the command(s) below. function daspawnzon() if not spx then outputChatBox("#E3E8B7The command will be available once the map is restarted!", 0, 0, 0, true) else local car = getPedOccupiedVehicle(localPlayer) if not car then return end setElementFrozen(car, true) setElementModel(car, model) setTimer(setElementFrozen, 2500, 1000, car, false) setElementHealth(car, 1000) setElementPosition(car, spx, spy, spz) setElementRotation(car, sprx, spry, sprz) triggerServerEvent('syncModel', resourceRoot, car, spm) end end addCommandHandler("RES", daspawnzon) I hope you get my point. Thanks! Link to comment
Driggero Posted March 19, 2014 Share Posted March 19, 2014 function daspawnzon() if not spx then outputChatBox("#E3E8B7The command will be available once the map is restarted!", 0, 0, 0, true) else local car = getPedOccupiedVehicle(localPlayer) if not car then return end setElementFrozen(car, false) setElementModel(car, model) --setTimer(setElementFrozen, 2500, 1000, car, false) setElementHealth(car, 1000) setElementPosition(car, spx, spy, spz) setElementRotation(car, sprx, spry, sprz) triggerServerEvent('syncModel', resourceRoot, car, spm) end end addCommandHandler("RES", daspawnzon) Link to comment
blinkerchris Posted March 19, 2014 Author Share Posted March 19, 2014 Yes I get that you have to edit the setElementFrozen part, but to what numbers? I tried 0, 0, Thanks Link to comment
NeO_DUFFMAN Posted March 19, 2014 Share Posted March 19, 2014 You could try using this code as well, i just added a 50 ms delay along with certain adjustments that i use in one of my respawn scripts. function daspawnzon() if not spx then outputChatBox("#E3E8B7The command will be available once the map is restarted!", 0, 0, 0, true) else local car = getPedOccupiedVehicle(localPlayer) if not car then return end setElementVelocity(car,0,0,0) setVehicleTurnVelocity(car,0,0,0) setElementModel(car, model) fixVehicle(car) setElementPosition(car, spx, spy, spz) setElementRotation(car, sprx, spry, sprz) setElementHealth(car, 1000) setElementFrozen(car,true) setTimer(setElementFrozen,50,1,car,false) triggerServerEvent('syncModel', resourceRoot, car, spm) end end addCommandHandler("RES", daspawnzon) Link to comment
NeO_DUFFMAN Posted March 19, 2014 Share Posted March 19, 2014 Yes I get that you have to edit the setElementFrozen part, but to what numbers? I tried 0, 0,Thanks I guess you're mistaken about what setElementFrozen does. Here's the syntax: bool setElementFrozen ( element theElement, bool freezeStatus ) So basically all you do is set a boolean value ( Either true i.e The vehicle will be frozen or false i.e the vehicle will not be frozen ) to a particular element ( Which is a player's vehicle in this case ) Link to comment
blinkerchris Posted March 19, 2014 Author Share Posted March 19, 2014 function daspawnzon() if not spx then outputChatBox("#E3E8B7The command will be available once the map is restarted!", 0, 0, 0, true) else local car = getPedOccupiedVehicle(localPlayer) if not car then return end setElementFrozen(car, false) setElementModel(car, model) setTimer(setElementFrozen, 2500, 1000, car, false) setElementHealth(car, 1000) setElementPosition(car, spx, spy, spz) setElementRotation(car, sprx, spry, sprz) triggerServerEvent('syncModel', resourceRoot, car, spm) bool setElementFrozen ( element theElement, bool freezeStatus ) end So that would be wrong? Link to comment
blinkerchris Posted March 19, 2014 Author Share Posted March 19, 2014 Thanks NeO! That worked 100% ) cheers! Link to comment
Saml1er Posted March 19, 2014 Share Posted March 19, 2014 Spx,y,z is not defined anywhere in the script. Make sure you add this line: local spx,spy,spz = getElementPosition (localPlayer) Still this won't help, your code is a total mess. I'll help ya later but I know someone might fix your code till that time. Link to comment
NeO_DUFFMAN Posted March 19, 2014 Share Posted March 19, 2014 Thanks NeO! That worked 100% ) cheers! No problem man Spx,y,z is not defined anywhere in the script. Make sure you add this line: local spx,spy,spz = getElementPosition (localPlayer) Still this won't help, your code is a total mess. I'll help ya later but I know someone might fix your code till that time. I'm sure he has defined it somewhere (Probably as a global value. Can't say for sure lol). And also, why do you think that his code is a total mess ? Link to comment
Saml1er Posted March 19, 2014 Share Posted March 19, 2014 Spx,y,z is not defined anywhere in the script. Make sure you add this line: local spx,spy,spz = getElementPosition (localPlayer) Still this won't help, your code is a total mess. I'll help ya later but I know someone might fix your code till that time. I'm sure he has defined it somewhere (Probably as a global value. Can't say for sure lol). And also, why do you think that his code is a total mess ? Since I thought he didn't define coordinates and that "if not statement" for spx which wasn't set to true even after he sets the rotation and position of the element player so I thought its a mess but if the coordinates are defined globally then everything should work fine. 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