TheJamcof Posted June 6, 2014 Posted June 6, 2014 I am bad with scripts but I try my best (, I am just training). I tried to make script. And the idea was When some player will type command "fix" then her vehicle will be fixed. bool fixVehicle ( vehicle theVehicle ) addCommandHandler ( string "fix", function handlerFunction, [bool restricted = false, bool caseSensitive = true] ) Sorry about my bad english I hope I will get answer pretty fast, Thank you.
Max+ Posted June 6, 2014 Posted June 6, 2014 function fix () local theVehicle = getPedOccupiedVehicle (localPlayer) if ( theVehicle ) then fixVehicle (theVehicle) outputChatBox ("Your vehicle has been fixed !" , localPlayer) end end addCommandHandler ("fix" , fix)
ViRuZGamiing Posted June 6, 2014 Posted June 6, 2014 (edited) Bool isn't something you're supposed to write. you'll need something like this; function fixVeh (thePlayer) local theVehicle = getPlayerVehicle ( thePlayer ) if theVehicle then fixVehicle(theVehicle) else outputChatBox("You don't have vehicle", thePlayer) end addCommandHandler("fix", fixVeh) not tested. Edited June 6, 2014 by Guest
ViRuZGamiing Posted June 6, 2014 Posted June 6, 2014 function fix () local theVehicle = getPedOccupiedVehicle (localPlayer) if ( theVehicle ) then fixVehicle (theVehicle) outputChatBox ("Your vehicle has been fixed !" , localPlayer) end end addCommandHandler ("fix" , fix) Lol you were faster
Max+ Posted June 6, 2014 Posted June 6, 2014 Bool isn't something you're supposed to write.you'll need something like this; function fixVeh local vehicle = getPlayerVehicle ( player ) if vehicle then fixVehicle(vehicle) else outputChatBox("You don't have vehicle", thePlayer) end addCommandHandler("fix", fixVeh) not tested. getPlayerVehicle ( player ) -- not function name like this , and player isn't defined outputChatBox("You don't have vehicle", thePlayer) thPlayer, isn't defined
Jaysds1 Posted June 6, 2014 Posted June 6, 2014 Try this: addCommandHandler("fix", function(player) if isPedInVehicle(player) then local vehicle = getPedOccupiedVehicle(player) fixVehicle(vehicle) outputChatBox ("Your vehicle has been fixed !" , localPlayer) end end )
TheJamcof Posted June 6, 2014 Author Posted June 6, 2014 Try this:addCommandHandler("fix", function(player) if isPedInVehicle(player) then local vehicle = getPedOccupiedVehicle(player) fixVehicle(vehicle) outputChatBox ("Your vehicle has been fixed !" , localPlayer) end end ) Thx lot of! This is working.
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