Subtixx Posted April 2, 2012 Share Posted April 2, 2012 local coreveh = createVehicle(411,0,0,5) setVehicleDamageProof(coreveh,true) local coreped = createPed(252,0,0,0) warpPedIntoVehicle(coreped,coreveh,0) local blip = createBlipAttachedTo(coreveh,20) local px, py, pz = getElementPosition(getPlayerFromName("PLAYERNAME")) local rx, ry, rz = getElementRotation(getPlayerFromName("PLAYERNAME")) local abstand = 7 local newX = px + math.cos(math.rad(rz + 90)) * abstand local newY = py + math.sin(math.rad(rz + 90)) * abstand setElementPosition(coreveh,newX,newY,pz) function botAI(player) local veh = getPedOccupiedVehicle(player) if veh then local x,y,z = getElementVelocity(veh) setElementVelocity(coreveh,x,y,z) local rx, ry, rz = getElementRotation(veh) setElementRotation(coreveh,rx,ry,rz) else local x,y,z = getElementVelocity(player) setElementVelocity(coreveh,x,y,z) local rx, ry, rz = getElementRotation(player) setElementRotation(coreveh,rx,ry,rz) end setTimer(botAI,100,1,player) end botAI(getPlayerFromName("PLAYERNAME")) It's veeeeeeeeeeeeeeerryy basic... Can someone help me with the code? (driveToPosition - like function?) Link to comment
DNL291 Posted April 2, 2012 Share Posted April 2, 2012 worked for me 'PLAYERNAME' must be the name of the player. Link to comment
Subtixx Posted April 2, 2012 Author Share Posted April 2, 2012 It's my code -.-. But it's very basic, and i want to have a function like driveToPosition. SAUR RPG Intro like. (No code. but Ideas.) Link to comment
DNL291 Posted April 2, 2012 Share Posted April 2, 2012 What? you want ideas for the script? Link to comment
Subtixx Posted April 2, 2012 Author Share Posted April 2, 2012 I want an example of how to realize a function driveToCoordinate. Or an idea how to follow a boat to a player Link to comment
qaisjp Posted April 2, 2012 Share Posted April 2, 2012 function driveVehicle(veh, x,y,z, velocity=0.1, gpsmode=false) check if x y and z are numbers, check veh is element if gpsmode try and use an export using the gps resource to get the road map to drive and use velocity variable for setting velo. if not gpsmode, or no export then just rotate veh and drive directly, which in that case probably hit a wall end Link to comment
DNL291 Posted April 2, 2012 Share Posted April 2, 2012 I want an example of how to realize a function driveToCoordinate. you can make a table with the coordinates. if I understand well Or an idea how to follow a boat to a player i not understand Link to comment
Subtixx Posted April 2, 2012 Author Share Posted April 2, 2012 i want to make a function, like driveToCoordinate. do you know the Intro from SAUR RPG? (it's a Bot with ped that follows the player). Thats it. 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