joedajoester Posted January 16, 2012 Share Posted January 16, 2012 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
Kenix Posted January 16, 2012 Share Posted January 16, 2012 Your code is wrong variable sourcePlayer is nil and distance too. http://www.lua.org/manual/5.1/ https://wiki.multitheftauto.com/wiki/Event https://wiki.multitheftauto.com/wiki/Scr ... troduction https://wiki.multitheftauto.com/wiki/OnPlayerChat Link to comment
BriGhtx3 Posted January 16, 2012 Share Posted January 16, 2012 No, onPlayerChat has just 2 parameters 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