Timiimit Posted January 30, 2012 Share Posted January 30, 2012 Hi! Why THE **** DO I GET AN ERROR THAT SAYS "getPedOccupiedVehcle" HAS BAD ARGUMANT theVehicle = getPedOccupiedVehicle( source ) Link to comment
mjau Posted January 30, 2012 Share Posted January 30, 2012 there is no source since you didnt use an event handler and a function... you can put it inside a function and use a event for event parameters read the wiki Link to comment
NeXTreme Posted January 30, 2012 Share Posted January 30, 2012 Uhm yeah it's kinda hard for us to help if you post just one line of code? Link to comment
Timiimit Posted January 30, 2012 Author Share Posted January 30, 2012 lua: theVehicle = getPedOccupiedVehicle( source ) function rndColors() local color = {} color[1] = math.random(0,126) color[2] = math.random(0,126) color[3] = math.random(0,126) color[4] = math.random(0,126) setVehicleColor ( theVehicle, color[1], color[2], color[3], color[4] ) outputChatBox( "Enjoy the PARTY!", source, 0, 255, 0 ) end function makeTimer() if ( theVehicle == false ) then outputChatBox ( "Get into a vehicle first!", getRootElement(), 255, 50, 0, true ) else setTimer( rndColors, 100, 1 ) outputChatBox ( "You are in vehicle!!", getRootElement(), 255, 50, 0, true ) end end addCommandHandler(" discovehicle", makeTimer ) Link to comment
Sparrow Posted January 30, 2012 Share Posted January 30, 2012 local theVehicle = getPedOccupiedVehicle function rndColors() local color = {} color[1] = math.random(0,126) color[2] = math.random(0,126) color[3] = math.random(0,126) color[4] = math.random(0,126) setVehicleColor ( theVehicle, color[1], color[2], color[3], color[4] ) outputChatBox( "Enjoy the PARTY!", source, 0, 255, 0 ) end function makeTimer() if ( theVehicle == false ) then outputChatBox ( "Get into a vehicle first!", getRootElement(), 255, 50, 0, true ) else setTimer( rndColors, 100, 1 ) outputChatBox ( "You are in vehicle!!", getRootElement(), 255, 50, 0, true ) end end addCommandHandler(" discovehicle", makeTimer ) Link to comment
NeXTreme Posted January 30, 2012 Share Posted January 30, 2012 Uhm, yeah... function rndColors() local color = {} color[1] = math.random(0,126) color[2] = math.random(0,126) color[3] = math.random(0,126) color[4] = math.random(0,126) setVehicleColor ( theVehicle, color[1], color[2], color[3], color[4] ) outputChatBox( "Enjoy the PARTY!", source, 0, 255, 0 ) end function makeTimer(player,command) theVehicle = getPedOccupiedVehicle( player ) if ( theVehicle == false ) then outputChatBox ( "Get into a vehicle first!", player, 255, 50, 0, true ) else setTimer( rndColors, 100, 1 ) outputChatBox ( "You are in vehicle!!", player, 255, 50, 0, true ) end end addCommandHandler(" discovehicle", makeTimer ) Thar? Link to comment
BinSlayer1 Posted January 30, 2012 Share Posted January 30, 2012 @NeXTreme your script will fail hard if more people type /discovehicle at the same time function rndColors(player, theVehicle) local color = {} color[1] = math.random(0,126) color[2] = math.random(0,126) color[3] = math.random(0,126) color[4] = math.random(0,126) setVehicleColor ( theVehicle, color[1], color[2], color[3], color[4] ) outputChatBox( "Enjoy the PARTY!", player, 0, 255, 0 ) end function makeTimer(player,command) theVehicle = getPedOccupiedVehicle( player ) if ( theVehicle == false ) then outputChatBox ( "Get into a vehicle first!", player, 255, 50, 0, true ) else setTimer( rndColors, 100, 1, player, theVehicle ) outputChatBox ( "You are in vehicle!!", player, 255, 50, 0, true ) end end addCommandHandler("discovehicle", makeTimer ) Link to comment
NeXTreme Posted January 30, 2012 Share Posted January 30, 2012 Yeah I realize that. I just attempted to fix the problem, not create a working script 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