All pastes #938608 Raw Edit

Miscellany

public text v1 · immutable
·published 2008-03-11 19:25 UTC
rendered paste body
function Vehicle_OnProduce(vehicle, user, menuitem)
--Menu items are numbers that refer to what choice is selected, there are 16 possible to have on vehicle producer.
--On vehicle file, menu items go from 1-16, in LUA they go from 0-15. 
	local pid = vehicle:vehicletypeid() -- this gets the id of the vehicle the user is selecting from.
	
	if (pid == 200) then --I used 200 out of air, look in vehicle file and use id of vehicle you want.
		if (menuitem == 0) then --If player selects first menu choice , lets say its trade 2 beer for 10 rifle ammo
			if (user:inventory_find("Beer" >= 2)) then --check for the beer
			user:inventory_modify("Beer", -2)  -- take beer away
			user:inventory_modify("Rifle Ammo", 10) -- give rifle ammo
			end
		end
	end
end