Killer... Posted November 8, 2014 Share Posted November 8, 2014 Hello, i have got problems whit a Vehicle Upgrade script. function consoleAddUpgrade ( thePlayer, commandName, id ) if ( isPedInVehicle ( thePlayer ) ) then local id = tonumber ( id ) local theVehicle = getPedOccupiedVehicle ( thePlayer ) local success = addVehicleUpgrade ( theVehicle, id ) if ( success ) then outputConsole ( getVehicleUpgradeSlotName ( id ) .. " modificacion anadida.", thePlayer ) else outputConsole ( "((Fallo al tunear)).", thePlayer ) end else outputConsole ( "((Tienes que estar en un vehiculo!))", thePlayer ) end end -- add the function as a handler for the "addupgrade" command addCommandHandler ( "tunear", consoleAddUpgrade ) Te problem is that, [2014-11-08 19:34:44] WARNING: mechanic/mechanic-s.lua:10: Bad argument @ 'addVehicleUpgrade' [Expected number at argument 2, got nil] Link to comment
abu5lf Posted November 8, 2014 Share Posted November 8, 2014 ./tunear [The id of the upgrade you wish to add. (1000 to 1193), see Vehicle Upgrades] Link to comment
Enargy, Posted November 8, 2014 Share Posted November 8, 2014 fixed.. function consoleAddUpgrade ( thePlayer, commandName, id ) if ( isPlayerInVehicle ( thePlayer ) ) then local id = tonumber ( id ) if not tonumber (id) then return end local theVehicle = getPedOccupiedVehicle ( thePlayer ) local success = addVehicleUpgrade ( theVehicle, id ) if ( success ) then outputConsole ( getVehicleUpgradeSlotName ( id ) .. " modificacion anadida.", thePlayer ) else outputConsole ( "((Fallo al tunear)).", thePlayer ) end else outputConsole ( "((Tienes que estar en un vehiculo!))", thePlayer ) end end -- add the function as a handler for the "addupgrade" command addCommandHandler ( "tunear", consoleAddUpgrade ) 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