Jump to content

Lil help for reading variables


'LinKin

Recommended Posts

Hi guys,

I wanna make a script so that the user can change his vehicle's doors state. I wanna make it so that for example when the use types /doors 0 4 , the hood turns missing, or if he types /doors 3 3 , the Front right door turns Ajar, damaged.

This is what I've done, but without success. I hope someone can help me.

function Doorless(localPlayer, doors, state, a, b)

local car = getPedOccupiedVehicle(localPlayer)

state = setVehicleDoorState ( car, tonumber(a), tonumber(b) )

outputChatBox("The reurn was: "..tostring(state))

end

addCommandHandler("doors", Doorless)

Regards,

LinKin

Link to comment

Try this; (Server-side!)

function Doorless(thePlayer, ...) 
    if(isPedInVehicle(thePlayer)) then 
    local theVehicle = getPedOccupiedVehicle(thePlayer) 
    local message = table.concat({...}, " ") 
    local arrayString = split(message, " ") 
        vehicleStates = setVehicleDoorState(theVehicle, tonumber(arrayString[1]), tonumber(arrayString[2])) 
    else 
        outputChatBox("[server]: #FF0000You must be in a Vehicle to use this!", thePlayer, 69, 69, 69, true) 
     end 
end 
addCommandHandler("doors", Doorless) 

Haven't tried it though :)

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