Jump to content

Help with Vehicle Cmd


Smallo

Recommended Posts

i am trying to make a code so when i type /carhelp a message goes into the chatbox and says

"Type /(vehiclename)-off To Turn The Custom Model Off"

"Or Type /(vehiclename)-on To Turn The Custom Model On"

ofcourse i am trying to use the GetVehicleName function and the GetVehicleId Function but seem to be having no luck at all. If anyone could help me to get this working it would be greatly appreciated.

heres the script

  
function carhelp ( ) 
local id = getVehicleID ( ) 
if id = 451 then 
       local vehiclename = getVehicleName ( ) 
       outputChatBox ( "Type /" .. vehiclename .. "-off To Turn The Custom Model Off",  0, 255, 0, true ) 
       outputChatBox ( "Type /" .. vehiclename .. "-on To Turn The Custom Model On",  0, 255, 0, true )  
          else 
       outputChatBox ( "This Vehicle Does Not Have A Custom Model." ,255,0,0 ) 
end 
end 
  
addCommandHandler ( "carhelp", carhelp ) 
  

and my Meta.xml

  
<meta> 
    <info author="Smallo" name="carhelp" version="1" type="script" /> 
    <script src="carhelp.lua" type="client" /> 
</meta>  
  

Link to comment

try

function carhelp ( )

local id = getVehicleID ( )

if id = 451 then

local vehiclename = getVehicleName ( )

outputChatBox ( "Type /" .. vehiclename "-off To Turn The Custom Model Off , 0, 255, 0, true )

outputChatBox ( "Type /" .. vehiclename "-on To Turn The Custom Model On , 0, 255, 0, true )

else

outputChatBox ( "This Vehicle Does Not Have A Custom Model." ,255,0,0 )

end

end

addCommandHandler ( "carhelp", carhelp )

or

function carhelp ( )

local id = getVehicleID ( )

if id = 451 then

local vehiclename = getVehicleName ( )

outputChatBox ( "Type /" .. vehiclename .. "-off To Turn The Custom Model Off , 0, 255, 0, true )

outputChatBox ( "Type /" .. vehiclename .. "-on To Turn The Custom Model On , 0, 255, 0, true )

else

outputChatBox ( "This Vehicle Does Not Have A Custom Model." ,255,0,0 )

end

end

addCommandHandler ( "carhelp", carhelp )

Link to comment

no offence but all you did was remove 2 of these "

which didn't solve the problem just made more thanks for your help anyways.

it think the problem is with GetVehicleId because it says when i am not in car 451 but when i am in car 451 is just doesnt say anything when i type.

Link to comment

smallo try this

function carhelp ( player )

local id = getVehicleID (getPlayerOccupiedVehicle ( player ))

if id = 451 then

local vehiclename = getVehicleName (getPlayerOccupiedVehicle ( player ) )

outputChatBox ( "Type /" .. vehiclename .. "-off To Turn The Custom Model Off", player , 255, 0, 0,true )

outputChatBox ( "Type /" .. vehiclename .. "-on To Turn The Custom Model On", player , 255, 0, 0, true )

else

outputChatBox ( "This Vehicle Does Not Have A Custom Model." , player ,255 ,0 ,0 )

end

end

addCommandHandler ( "carhelp", carhelp )

Link to comment

i just tested this and it works fine..

function carhelp ( player )

local veh = getPlayerOccupiedVehicle ( player )

if ( veh ) then

local id = getVehicleID ( veh )

if ( id == 451 ) then

local vehiclename = getVehicleName ( veh )

outputChatBox ( "Type /" .. vehiclename .. "-off To Turn The Custom Model Off", player , 255, 0, 0,true )

outputChatBox ( "Type /" .. vehiclename .. "-on To Turn The Custom Model On", player , 255, 0, 0, true )

else

outputChatBox ( "This Vehicle Does Not Have A Custom Model." , player ,255 ,0 ,0 )

end

else

outputChatBox ( "You Are Not In A Car." , player ,255 ,0 ,0 )

end

end

addCommandHandler ( "carhelp", carhelp )

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