lolman Posted June 23, 2015 Posted June 23, 2015 Hello, I've a problem with my script. function engine() local vehicle = getPedOccupiedVehicle ( getLocalPlayer() ) local health = getElementHealth ( vehicle ) if vehicle and ( health == 250 ) then outputChatBox ("Worked!",255,0,0,thePlayer) setVehicleEngineState ( vehicle, false ) end end addEventHandler ("onPlayerVehicleEnter", getRootElement(), engine) --addCommandHandler("123", engine) Here in this script I want that you can't drive the car (setengine false) when you enter the car if it has 25% health (as you can see there is (health == 250). everything works fine with the command if I use it but if i want it on playervehicleenter, it doesnt work, please help needed ! Futuristic Gaming RPG http://adf.ly/1KwDeT
iMr.Dawix~# Posted June 23, 2015 Posted June 23, 2015 try this .. function engine() local vehicle = getPedOccupiedVehicle(source) local health = getElementHealth ( vehicle ) if vehicle and ( health == 250 ) then outputChatBox ("Worked!",source,255,0,0,true) setVehicleEngineState ( vehicle, false ) end end addEventHandler ("onPlayerVehicleEnter", getRootElement(), engine) --addCommandHandler("123", engine) My E-mails: [ [email protected] ],[ [email protected] ],[ [email protected] ] " Manners Maketh Man " " الأخلاق تصنع الرجل " ░░░░░███████ ]▄▄▄▄▄▄▄▄ BooM ! ▂▄▅█████████▅▄▃▂ ███████████████████]. ◥⊙▲⊙▲⊙▲⊙▲⊙▲⊙▲⊙◤
lolman Posted June 23, 2015 Author Posted June 23, 2015 Nop... didn't work.... btw my server is client sided... Futuristic Gaming RPG http://adf.ly/1KwDeT
iMr.Dawix~# Posted June 23, 2015 Posted June 23, 2015 Nop... didn't work.... btw my server is client sided... ah, ok .. use this function engine() local vehicle = getPedOccupiedVehicle(source) local health = getElementHealth (vehicle) if vehicle and ( health == 250 ) then outputChatBox ("Worked!",255,0,0,true) setVehicleEngineState (vehicle, false ) end end addEventHandler ("onClientPlayerVehicleEnter",root, engine) --addCommandHandler("123", engine) My E-mails: [ [email protected] ],[ [email protected] ],[ [email protected] ] " Manners Maketh Man " " الأخلاق تصنع الرجل " ░░░░░███████ ]▄▄▄▄▄▄▄▄ BooM ! ▂▄▅█████████▅▄▃▂ ███████████████████]. ◥⊙▲⊙▲⊙▲⊙▲⊙▲⊙▲⊙◤
lolman Posted June 23, 2015 Author Posted June 23, 2015 dude... YOU'RE AMAZING ! thank you so much !! Futuristic Gaming RPG http://adf.ly/1KwDeT
iMr.Dawix~# Posted June 23, 2015 Posted June 23, 2015 dude... YOU'RE AMAZING ! thank you so much !! You're Welcome ^ ^ My E-mails: [ [email protected] ],[ [email protected] ],[ [email protected] ] " Manners Maketh Man " " الأخلاق تصنع الرجل " ░░░░░███████ ]▄▄▄▄▄▄▄▄ BooM ! ▂▄▅█████████▅▄▃▂ ███████████████████]. ◥⊙▲⊙▲⊙▲⊙▲⊙▲⊙▲⊙◤
lolman Posted June 23, 2015 Author Posted June 23, 2015 btw how can you set the engine off while driving the car and the car gets 25% health? Futuristic Gaming RPG http://adf.ly/1KwDeT
iMr.Dawix~# Posted June 23, 2015 Posted June 23, 2015 btw how can you set the engine off while driving the car and the car gets 25% health? try .. function Ecollision() local vehicle = getPedOccupiedVehicle(localPlayer) if source == vehicle then local health = getElementHealth (vehicle) if health <= 250 then setVehicleEngineState (vehicle, false ) end end end addEventHandler ("onClientVehicleCollision",root,Ecollision) My E-mails: [ [email protected] ],[ [email protected] ],[ [email protected] ] " Manners Maketh Man " " الأخلاق تصنع الرجل " ░░░░░███████ ]▄▄▄▄▄▄▄▄ BooM ! ▂▄▅█████████▅▄▃▂ ███████████████████]. ◥⊙▲⊙▲⊙▲⊙▲⊙▲⊙▲⊙◤
lolman Posted June 23, 2015 Author Posted June 23, 2015 Man, really, thank you for your time for helping me out ! It worked !! Futuristic Gaming RPG http://adf.ly/1KwDeT
iMr.Dawix~# Posted June 24, 2015 Posted June 24, 2015 Man, really, thank you for your time for helping me out ! It worked !! Any Time <3 My E-mails: [ [email protected] ],[ [email protected] ],[ [email protected] ] " Manners Maketh Man " " الأخلاق تصنع الرجل " ░░░░░███████ ]▄▄▄▄▄▄▄▄ BooM ! ▂▄▅█████████▅▄▃▂ ███████████████████]. ◥⊙▲⊙▲⊙▲⊙▲⊙▲⊙▲⊙◤
tosfera Posted June 24, 2015 Posted June 24, 2015 Why would you handle the engine on the client side..? That'll cause desync at a certain point. If you want to contact me directly concerning Advanced-Gaming, please contact me at [email protected]
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