kieran Posted June 9, 2017 Share Posted June 9, 2017 (edited) Hello, I am pretty new to scripting on MTA, I done some visual C in college and was wondering if anyone could direct me to a website/topic about spawning zombies client side, I have looked at other peoples scripting, but as I say, I'm inexperienced, so if there is even a script with comments saying the purpose of the functions etc... could you post the link? Thanks for reading! Edited June 9, 2017 by kieran Link to comment
AE. Posted June 9, 2017 Share Posted June 9, 2017 well, first you have to spawn some peds near the player so you need to use createPed() and you have to get the player position so use xx,yy,zz = getElementPosition() -- to get player position setElementPosition(xx+4,yy+3,zz) -- to set the zombie position near the player and then you have to make the ped go towards the player -- but first you need to make sure the ped is looking at the player myrot = getElementRotation(player) -- to get the player roatition setElementRotation (theped,-myrot) -- to make the ped look at the player --now to make the ped go towards the player you can use control state setPedControlState(theped,"forwards", true) and after that you can check if the ped is infront of the player then control state and hit the player note : there will be a lot of bugs you have to fix it but try to fix it yourself if you can't post and i will help Link to comment
kieran Posted June 9, 2017 Author Share Posted June 9, 2017 Thanks again bud :3 will mess with it and tell you result.... Might be a few days though... haha 1 Link to comment
kieran Posted June 10, 2017 Author Share Posted June 10, 2017 I still don't really get it, am I meant to make the function and then create the ped? All I need is it to spawn a ped close to player I can work from there. (Sorry, I am noob scripter) Link to comment
kieran Posted June 10, 2017 Author Share Posted June 10, 2017 function zombset (player) x,y,z = getElementPosition(player) -- to get player position myrot = getElementRotation(player) -- to get the player roatition zomb = createPed(1, x,y,z) setElementPosition(zomb, x+4,y+3,z) -- to set the zombie position near the player setElementRotation (zomb,-myrot) -- to make the ped look at the player --now to make the ped go towards the player you can use control state setPedControlState(zomb,"forwards", true) end addCommandHandler ("createPed", zombset) I don't think this is right... Link to comment
Moderators IIYAMA Posted June 10, 2017 Moderators Share Posted June 10, 2017 (edited) function zombset (player) -- this is clientside, not serverside! Use localPlayer instead of player. (you should be able to see a warning, if you do not use it.) local _, _, myrot = getElementRotation(localPlayer) Edited June 10, 2017 by IIYAMA 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