Jump to content


  • Posts

  • Joined

  • Last visited

Everything posted by TwicH

  1. works perfect, thank you so much
  2. im playing on a race server with this exact problem, my custom objects work but it bugs the object for the next map, i also tried engineRestoreCOL but it does nothing and the only fix i know is to restart MTA tldr: i think its a bug in mta
  3. hi scripters of mta, I had an idea to make a platform cj would automatically "slide" on for my parkour server. so here is what i did: function standingcheck() local slide_platform = getElementModel (getPedContactElement ( localPlayer )) --get the model of the object cj is standing on if slide_platform == 8558 then --if its this object then local x,y,z = getElementRotation ( localPlayer ) --do some math with z variable here :D setElementVelocity ( localPlayer, 0, 0, 0) --push cj the way hes facing somehow end end addEventHandler ( "onClientPreRender", root, standingcheck ) thank you in advance.
  4. now they don't punch at all
  5. I'm sorry to bother you but it seems like every time you fix a bug there is another one coming up, now they don't even follow me unless I get close to them. would you mind we talk on skype?
  6. now the zombies punch me once but wont punch again until i get far away from them
  7. function follow() for i=0,maxzombies do local x,y,z = getElementPosition (localPlayer) local zpx,zpy,zpz = getElementPosition (zombie[i]) local zombie_angle = (360 - math.deg(math.atan2((zpx - x), (zpy - y)))) % 360 local dist = getDistanceBetweenPoints2D(x, y, zpx, zpy) if (dist > 2) then setPedCameraRotation (zombie[i],-zombie_angle) setPedControlState(zombie[i], "backwards", true) elseif (dist < 2) then setPedCameraRotation (zombie[i],-zombie_angle) setPedControlState(zombie[i], "fire", false) setPedControlState(zombie[i], "fire", true) end end end I have fixed the problem but now the zombies just punch me once when they get close and never punch me again
  8. still not working, 9: unexpected symbol near '['
  9. Hello guys could somebody tell me where I went wrong with the tables? I'm basically trying to give each zombie an id so they can follow the player local maxzombies = 30 local zombiecount = 0 zombie{} function spawn() local x,y,z = getElementPosition (localPlayer) zombie[tostring(zombiecount)] = zombiecount local zombie[zombiecount] = createPed (20,x+math.random(-7,7),y+math.random(-7,7),z) end function follow() zpx,zpy,zpz = getElementPosition (zombie[zombiecount]) local zombie_angle = (360 - math.deg(math.atan2((zpx - x), (zpy - y)))) % 360 local dist = getDistanceBetweenPoints2D(x, y, zpx, zpy) if (dist > 2) then setPedCameraRotation (zombie[zombiecount],zombie_angle) setPedControlState(zombie[zombiecount], "forwards", true) elseif (dist < 2) then setPedControlState(zombie[zombiecount], "forwards", false) setPedControlState(zombie[zombiecount], "fire", true) end end setTimer (follow, 1000, 0) function zombie_check() if (zombiecount < maxzombies) then spawn() zombiecount = zombiecount + 1 end end setTimer (zombie_check, 100, 0) function zombie_died() zombiecount = zombiecount - 1 end addEventHandler("onClientPedWasted", getRootElement(), zombie_died)
  10. Hello guys, I'm just starting to learn to script and I've been stuck on this issue for a while now local x,y,z = getElementPosition (localPlayer) local zombie = createPed (20,x+math.random(-4,4),y+math.random(-4,4),z) function follow() x,y,z = getElementPosition (localPlayer) zpx,zpy,zpz = getElementPosition (zombie) local a = zpx - x local b = y - zpy local c = a*a + b*b local sinlaw = 90/math.sin(b) local zangel = math.sin(a)*sinlaw setPedCameraRotation (zombie,zangel) setPedControlState(zombie, "forwards", true) end setTimer ( follow, 500, 0) the code made sense the first time that I wrote it and since then I've just messed with a few variables without really thinking hoping that it would bring me an easy solution. also please don't ask me why I did the math the way I did, I'm very bad at it and that's what I came up with.
  11. I tried this but player dosent work some friend told me to use this code: function MarkerHit ( hitPlayer, matchingDimension ) if hitPlayer == localPlayer then setPedAnimation( hitPlayer, "ped", "WOMAN_walknorm") end end addEventHandler ( "onClientMarkerHit", getRootElement(), MarkerHit ) it works but i dont know why..
  12. hey guys im trying to get into scripting and i have some problem with a simple script i put together function MarkerHit ( hitPlayer, matchingDimension ) setPedAnimation( player, "ped", "WOMAN_walknorm") end addEventHandler ( "onClientMarkerHit", getRootElement(), MarkerHit ) here is the code can you explain to me whats wrong?
  13. My bad, thanks for notifying me ill will open a new one right away.
  14. Hello everybody, me and my partner are looking for a scripter who is capable of making a leveling system for our server. we are willing to pay good money for it. contact me on skype: noamben1
  15. Hello everybody I have a simple question, how can I make a resource automatically start when the server starts?
  16. TwicH

    gamemode help

    yes well its too hard for me
  17. TwicH

    gamemode help

    Hello everybody I need someone who knows to script to make an on foot race gamemode, something like run in FFS server. contact me on skype: noamben1 thank you for your time
  • Create New...