Jump to content

will this work


joedajoester

Recommended Posts

function sendMessage2( messageclean, messageType, commandName, ... ) 
    if (string.find(messageclean, "i") and string.find(messageclean, "a") and string.find(messageclean, "infernus")) then 
      local x, y, z = getElementPosition ( sourcePlayer ) -- get the player's position 
      local rotZ = getPedRotation ( sourcePlayer ) -- get the player's rotation around the Z axis in degrees 
      x = x + ( ( math.cos ( math.rad ( rotZ ) ) ) * distance ) -- calculate the X position of the vehicle 
      y = y + ( ( math.sin ( math.rad ( rotZ ) ) ) * distance ) -- calculate the Y position of the vehicle 
      local vehicleName = table.concat({...}, " ") 
      local vehicleID = getVehicleModelFromName ( vehicleName ) 
      if vehicleID then 
            local newVehicle = createVehicle ( vehicleID, x, y, z, 0, 0, rotZ ) 
            if not newVehicle then 
               outputConsole ( "Failed to create vehicle.", sourcePlayer ) 
        end 
      end 
    end 
end 
addEventHandler("onPlayerChat",root,sendMessage2) 

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