xXMADEXx Posted February 2, 2013 Share Posted February 2, 2013 How can i make it, so that when a player gets hit that they follow the police officer when they get hit? Or, like how can i make it so that they have no control over they player, and the player follows the other player. Link to comment
DiSaMe Posted February 2, 2013 Share Posted February 2, 2013 toggleControl setControlState Link to comment
AMARANT Posted February 2, 2013 Share Posted February 2, 2013 Why do you need to reinvent the wheel? Just use the old community script or see and learn how it's done there. Link to comment
DiSaMe Posted February 2, 2013 Share Posted February 2, 2013 If that means reinventing, then I spend a lot of time reinventing. There is one thing which can only exist as long as it's reinvented: originality. Link to comment
xXMADEXx Posted February 2, 2013 Author Share Posted February 2, 2013 I have made this script: function arrest(weapon, _, _, _, _, _, hitElement) local job = getElementData(source,"Job") if (hitElement) and (getElementType(hitElement) == "player") and (weapon == 3) then if (job=="Swat") or (job=="Military") or (job=="Police") or (job=="FBI") then showCursor(hitElement, true) end end end addEventHandler("onPlayerDamage",root,arrest) but it won't work, and nothing will show in debugscript... Link to comment
Castillo Posted February 2, 2013 Share Posted February 2, 2013 Read arguments of onPlayerDamage: https://wiki.multitheftauto.com/wiki/OnPlayerDamage Link to comment
xXMADEXx Posted February 2, 2013 Author Share Posted February 2, 2013 Thanks, but what is the function to make the source follow the attacker? Link to comment
Puma Posted February 2, 2013 Share Posted February 2, 2013 It's not a function, you have to script it yourself and it's not an easy script if you want to do it properly. Link to comment
xXMADEXx Posted February 2, 2013 Author Share Posted February 2, 2013 K, i got this fixed, but i'm not sure what function to use to make the source follow the attacker. function arrest ( attacker, weapon, bodypart, loss ) local job = getTeamName(getPlayerTeam(attacker)) local wanted = getPlayerWantedLevel(source) if (source) and (getElementType(source) == "player") and (weapon == 3) then if (job=="Swat") or (job=="Military") or (job=="Police") or (job=="FBI") then if wanted > 0 then showCursor(source, true) end end end end addEventHandler("onPlayerDamage",root,arrest) Link to comment
Puma Posted February 3, 2013 Share Posted February 3, 2013 There is no function for that, unless you make it yourself. Link to comment
xXMADEXx Posted February 3, 2013 Author Share Posted February 3, 2013 There is no function for that, unless you make it yourself. Well, how can i make it? Link to comment
DiSaMe Posted February 3, 2013 Share Posted February 3, 2013 toggleControl setControlState If that doesn't make it clear for you, maybe I should also add these: setPedRotation https://wiki.multitheftauto.com/wiki/FindRotation Link to comment
Baseplate Posted February 3, 2013 Share Posted February 3, 2013 If you want the ped to exactly walk into your steps at a distance, I would recommend this:onClientRender/onClientPreRender/setTimer: Let ped face towards you using https://wiki.multitheftauto.com/wiki/FindRotation (fill in your x,y and ped's x,y). Get distance between you and the ped using getDistanceBetweenPoints3D. When distance < x (followdistance), use setPedControlState to make the ped running, if he isn't already running to you. When distance > x, use setPedControlState to stop the ped from running, if he is still running. Ped will always be looking at you, when you are getting too far away, he will keep running to you until distance between you and him < x. I already asked for help and Puma answered with this which helped me 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