Jump to content

Help me with little script :c


Recommended Posts

Posted

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.

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

- New , Kill System

- New, GameMode Intro

- Leve / Exp System

- New nametag showing style

- New , Hud For Players

- Skin Selection from SA-MP

- Money System / Buy Weapons

- Drop Weapons

- New, Flood System

- New , Group Assign

- Gun license For Weapons

- Random Rule System For Money

Posted (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 by Guest

"If debugging is the process of removing software bugs, then programming must be the process of putting them in."

Posted
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

"If debugging is the process of removing software bugs, then programming must be the process of putting them in."

Posted
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 
 

- New , Kill System

- New, GameMode Intro

- Leve / Exp System

- New nametag showing style

- New , Hud For Players

- Skin Selection from SA-MP

- Money System / Buy Weapons

- Drop Weapons

- New, Flood System

- New , Group Assign

- Gun license For Weapons

- Random Rule System For Money

Posted

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 
) 

My in-game name: Jaysds1

Retired CMG Scripter

World Of Tanks GameMode (Open-Source): https://github.com/Jaysds1/mtasa-wot-gamemode

Online GUI-Editor (WIP): https://forum.mtasa.com/topic/47678-online-gui-editor/

 

sE5Qm.png

TiV3C.png

img.php?id=0&text=Lua%20Scripter

Posted
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.

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...