LiOneLMeSsIShoT Posted November 23, 2013 Share Posted November 23, 2013 how to make the ped follows the player?.. Link to comment
Price. Posted November 23, 2013 Share Posted November 23, 2013 setPedControlState attachElements Link to comment
LiOneLMeSsIShoT Posted November 23, 2013 Author Share Posted November 23, 2013 setPedControlState attachElements would you mind if i get example from you for the script to make the ped follows the player? Link to comment
Price. Posted November 23, 2013 Share Posted November 23, 2013 viewtopic.php?f=102&t=35004 Link to comment
LiOneLMeSsIShoT Posted November 23, 2013 Author Share Posted November 23, 2013 https://forum.multitheftauto.com/viewtopic.php?f=102&t=35004 Alright ... i see server: ped = createPed ( 248, 0, 0, 5 ) triggerClientEvent ( root, "onControlState", ped ) client: addEvent ( "onControlState", true ) addEventHandler ( "onControlState", root, function () setPedControlState ( source, "fire", true ) end ) i tried it but got error: server trigger clientside event onControlState,but event is not added clientside whatever why you suggested me to do "attachElement"? Link to comment
TAPL Posted November 23, 2013 Share Posted November 23, 2013 https://forum.multitheftauto.com/viewtopic.php?f=91&t=67595 Link to comment
LiOneLMeSsIShoT Posted November 23, 2013 Author Share Posted November 23, 2013 https://forum.multitheftauto.com/viewtopic.php?f=91&t=67595 can you give me a script example? Link to comment
-.Paradox.- Posted November 24, 2013 Share Posted November 24, 2013 Try slothbot resource by slothman. https://wiki.multitheftauto.com/wiki/Slothman/Slothbot https://community.multitheftauto.com/index.php?p ... ils&id=672 https://forum.multitheftauto.com/viewtopic.php?f ... 52#p307652 Link to comment
TAPL Posted November 24, 2013 Share Posted November 24, 2013 https://forum.multitheftauto.com/viewtopic.php?f=91&t=67595 can you give me a script example? Example: ped = createPed(0, getElementPosition(localPlayer)) addEventHandler("onClientRender", root, function() local x, y, z = getElementPosition(localPlayer) local tx, ty, tz = getElementPosition(ped) local dis = getDistanceBetweenPoints2D(x, y, tx, ty) if dis > 2 then setPedControlState(ped, "forwards", true) else setPedControlState(ped, "forwards", false) end setPedRotation(ped, findRotation(tx, ty, x, y)) end) function findRotation(x1,y1,x2,y2) local t = -math.deg(math.atan2(x2-x1,y2-y1)) if t < 0 then t = t + 360 end return t end Link to comment
LiOneLMeSsIShoT Posted November 24, 2013 Author Share Posted November 24, 2013 https://forum.multitheftauto.com/viewtopic.php?f=91&t=67595 can you give me a script example? Example: ped = createPed(0, getElementPosition(localPlayer)) addEventHandler("onClientRender", root, function() local x, y, z = getElementPosition(localPlayer) local tx, ty, tz = getElementPosition(ped) local dis = getDistanceBetweenPoints2D(x, y, tx, ty) if dis > 2 then setPedControlState(ped, "forwards", true) else setPedControlState(ped, "forwards", false) end setPedRotation(ped, findRotation(tx, ty, x, y)) end) function findRotation(x1,y1,x2,y2) local t = -math.deg(math.atan2(x2-x1,y2-y1)) if t < 0 then t = t + 360 end return t end Thanks but i think i will use slothbot anyway THANKS A LOT! 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