I want to ask how to make vehicle script like in |ExT| Happy Town, that has :
- Start/Stop engine
- Gear(Press F2 to gear down, Press F3 to gear up)
- Vehicle settings
Screenshot :
edited 1×, last 23.10.16 05:40:43 am
table.insert(table, [pos,] value)
table.remove(table, [pos])
for KEY, VALUE in ipairs ( TABLE ) do
player(id,"x")-math.sin(math.rad(player(id,"rot")-180)) [*SPEED]
player(id,"y")+math.cos(math.rad(player(id,"rot")-180)) [*SPEED]
local id = image("gfx/path.png",player(id,"x"),player(id,"y"),1)
function ServerActionHook(id, action) 	if ( action == 3 ) then -- The 3 value stands for F4 button in our case 		-- Start/Stop Engine code here... 	end end addhook('serveraction', 'ServerActionHook')
function ServerActionHook(id, action) 	if ( action == 3 ) then -- The 3 value stands for F4 button in our case 		-- Start/Stop Engine code here... 	elseif ( action == 1 ) then -- Now the 1 value stands for F2 button 		-- Gear Down code here... 	elseif ( action == 2 ) then -- Finally the 2 value stands for F3 button 		-- Gear Up code here... 	end end addhook('serveraction', 'ServerActionHook')
elseif. The fifth and seventh line must be replaced with an actual Gear function code.
function SayVehicleSettings(id, message) 	if ( string.sub(message, 1, 16) == '!vehiclesettings' ) then 		menu(id, 'Vehicle Settings, ..., ..., ...') 	end end function VehicleSettingsMenu(id, title, button) 	if ( title == 'Vehicle Setings' ) then -- Check if the title of the menu is Vehicle Settings 		if ( button == 1 ) -- Check if the player presses the first button within the menu. 			menu(id, 'Another menu, ..., ..., ...') -- Create a subsequent menu 		-- Repeat the same thing for other buttons at your choice... 		end 	end end addhook('say', 'SayVehicleSettings') addhook('menu', 'VehicleSettingsMenu')
...dots must be replaced with title buttons (i.e Vehicle Lights). Afterwards, within
VehicleSettingsMenufunction you must define each button their task (i.e Turn CD Player ON -> CD Player is turned ON) or create a subsequent menu for sub functions like I did in the code.