joedajoester Posted February 17, 2012 Share Posted February 17, 2012 function sendMessage2( messageclean, messageType) local message = string.lower(messageclean) local x, y, z = getElementPosition ( source ) if (string.find(messageclean, "a ") and string.find(messageclean, "infernus")) then outputChatBox("Your car has spawned, enjoy!", source, 0, 255, 0) createVehicle ( 411, x, y+5, z + 10 ) warpPedIntoVehicle ( source, vehicle ) end end addEventHandler("onPlayerChat",root,sendMessage2) It wont warp me into the car. It says bad argument @ warppedintovehicle i think its because vehicle should be changed but i dont know what to change it to Link to comment
Sparrow Posted February 17, 2012 Share Posted February 17, 2012 (edited) try this function sendMessage2( messageclean, messageType) local message = string.lower(messageclean) local x, y, z = getElementPosition ( source ) if (string.find(messageclean, "a ") and string.find(messageclean, "infernus")) then outputChatBox("Your car has spawned, enjoy!", source, 0, 255, 0) vehicle = createVehicle ( 411, x, y+5, z + 10 ) warpPedIntoVehicle ( source, vehicle ) end end addEventHandler("onPlayerChat",root,sendMessage2) Edited February 17, 2012 by Guest Link to comment
Aibo Posted February 17, 2012 Share Posted February 17, 2012 you need to place a vehicle pointer to vehicle variable function sendMessage2( messageclean, messageType) local message = string.lower(messageclean) local x, y, z = getElementPosition ( source ) if (string.find(message, "a ") and string.find(message, "infernus")) then outputChatBox("Your car has spawned, enjoy!", source, 0, 255, 0) local vehicle = createVehicle ( 411, x, y+5, z + 10 ) warpPedIntoVehicle ( source, vehicle ) end end addEventHandler("onPlayerChat",root,sendMessage2) Link to comment
Kenix Posted February 17, 2012 Share Posted February 17, 2012 local uTimers = { } addEventHandler( 'onPlayerChat',root, function( messageclean, messageType ) local message = string.lower( messageclean ) local x, y, z = getElementPosition ( source ) if string.find( message, "a " ) and string.find( message, "infernus" ) then outputChatBox( "Your car has spawned, enjoy!", source, 0, 255, 0 ) local vehicle = createVehicle ( 411, x, y+5, z + 10 ) if isTimer( uTimers[ source ] ) then killTimer( uTimers[ source ] ) end uTimers[ source ] = setTimer( warpPedIntoVehicle,100,1, source, vehicle ) end end ) addEventHandler( 'onPlayerQuit',root, function( ) uTimers[ source ] = nil end ) Because need timer for warp player/ped. 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