Jump to content

dumb question


joedajoester

Recommended Posts

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

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 by Guest
Link to comment

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
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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...