Smallo Posted January 30, 2008 Share Posted January 30, 2008 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
Guest Posted January 30, 2008 Share Posted January 30, 2008 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
Smallo Posted January 30, 2008 Author Share Posted January 30, 2008 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
szlend Posted January 30, 2008 Share Posted January 30, 2008 You didn't put any parameters to the function "getVehicleID ( )" and "getVehicleName ( )" http://development.mtasa.com/index.php? ... tVehicleID http://development.mtasa.com/index.php? ... ehicleName Link to comment
Capsinurass Posted January 30, 2008 Share Posted January 30, 2008 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
tma Posted January 30, 2008 Share Posted January 30, 2008 Also, if id = 451 then should be if id == 451 then Link to comment
Smallo Posted February 1, 2008 Author Share Posted February 1, 2008 thanks for your help guys but still no luck Link to comment
Capsinurass Posted February 2, 2008 Share Posted February 2, 2008 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
Smallo Posted February 2, 2008 Author Share Posted February 2, 2008 kool thank-you but it still doesnt seem to work in my server its saying im not in a car all the time. Link to comment
Capsinurass Posted February 2, 2008 Share Posted February 2, 2008 have you tried /debugscript 3 and restarting the resource? Link to comment
Smallo Posted February 2, 2008 Author Share Posted February 2, 2008 yes i restarted the script and there were no errors in the debug! i dont know whats wrong. should it be a client script or a server script?? Link to comment
Capsinurass Posted February 2, 2008 Share Posted February 2, 2008 hmmmm that really should work.... do you have anything else runing on the script? Link to comment
Smallo Posted February 2, 2008 Author Share Posted February 2, 2008 sh!t just found the problem i had it running as a client script when it should only be a server script it works now thanks for all your help and troubles!plan to see it in our server soon Link to comment
Capsinurass Posted February 2, 2008 Share Posted February 2, 2008 lol that was my next question. well np Link to comment
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