Jump to content

Help me with little script :c


Recommended Posts

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.

Link to comment
function fix () 
    local theVehicle = getPedOccupiedVehicle (localPlayer) 
       if ( theVehicle ) then 
         fixVehicle (theVehicle) 
         outputChatBox ("Your vehicle has been fixed !" , localPlayer) 
    end 
end 
addCommandHandler ("fix" , fix) 

Link to comment

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 by Guest
Link to comment
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

Link to comment
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 
 

Link to comment

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 
) 

Link to comment
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.

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...