Jump to content

Tails

Members
  • Posts

    741
  • Joined

  • Days Won

    16

Everything posted by Tails

  1. Adding the quotation marks didn't help. The reason I added the freeze function is because I don't want the player to be able to cancel the animation. Also, why does the player sometimes not spawn the second time? local DieingPed1 = createPed ( 2336.5439453125, -1172.0966796875, 1031.96875, mySkin ) function deathCheck ( ) local x,y,z = getElementPosition ( source ) if ( isPedDead ( source ) ) then outputChatBox ("Type /respawn to respawn immediately.", getRootElement ( ), 255,0,0,true ) setTimer ( setElementInterior, 2900, 1, source, 5 ) setTimer ( spawnPlayer, 3000, 1, source, 2000.9599609375, -1402.8125, 17.690458297729, 0, mySkin ) setTimer ( setElementFrozen, 3000, 1, source, true ) end if ( isElementFrozen ( source ) ) then setPedAnimation ( source, "GANGS", "leanIDLE" ) setTimer ( setElementPosition, 12000, 1, source, 2030.2861328125, -1418.5458984375, 16.9921875 ) setTimer ( setElementFrozen, 12000, 1, source, false ) fadeCamera ( source, true, 3, 0,0,0 ) setCameraTarget ( source, source ) end end addEventHandler ( "onPlayerWasted", root, deathCheck )
  2. Ok, I put in some different functions. The freezing is working, respawn the second time works sometimes, and the Animation isn't working. local DieingPed1 = createPed ( 2336.5439453125, -1172.0966796875, 1031.96875, mySkin ) function deathCheck() local x,y,z = getElementPosition(source) if (isPedDead(source)) then outputChatBox("Type /respawn to respawn immediately.", getRootElement(), 255,0,0,true) setTimer ( setElementInterior, 2900, 1, source, 5) setTimer ( spawnPlayer, 3000, 1, source, 2000.9599609375, -1402.8125, 17.690458297729, 0, mySkin) setTimer (setElementFrozen, 3000, 1, source, true ) end if (isElementFrozen ( source )) then setPedAnimation(source, GANGS, leanIDLE) setTimer ( setElementPosition, 12000, 1, source, 2030.2861328125, -1418.5458984375, 16.9921875) setTimer (setElementFrozen, 12000, 1, source, false) fadeCamera(source, true, 3, 0,0,0) setCameraTarget(source, source) end end addEventHandler ("onPlayerWasted", root, deathCheck)
  3. Hi there it's me again! Once again I'm completely lost. What I'm trying to create is that when you die, I want to give the player a time out and send them to hospital. But for that I just want to have the players camera targeted at a sleeping ped (with their skin) on a bed, inside an interior. Can anyone help me out with this? Thanks in advance. local DieingPed1 = createPed ( 2336.5439453125, -1172.0966796875, 1031.96875, mySkin ) function deathCheck() local x,y,z = getElementPosition(source) DieingPed2 = getElementPosition(DieingPed1) if (isPedDead(source)) then setElementInterior ( DieingPed1, 5) setTimer( setCameraTarget, 10000, 1, source, DieingPed2) outputChatBox("Type /respawn to respawn immediately.", getRootElement(), 255,0,0,true) setTimer ( spawnPlayer, 4500, 1, source, 2030.2861328125, -1418.5458984375, 16.9921875, 0, mySkin) fadeCamera(source, true, 3, 0,0,0) setCameraTarget(source, source) end end addEventHandler ("onPlayerWasted", root, deathCheck)
  4. Thank you very much. Why does it say source in ,1000, 0, source ?
  5. Ty Solidsnake14. Do I need to put type="client" in the meta file, server or none? function Starve(thePlayer) setTimer( function() setElementHealth( thePlayer, getElementHealth(thePlayer) - 2 ) , 1000, 0) end end addEventHandler("onPlayerSpawn", getRootElement(), Starve) Right now it's saying unexpected symbol near "," when debugging. Can you also explain me a little bit as to why I need to put a 2nd argument in the eventHandler while on other scripts I don't? And what exactly means rootElement and what is the different between root and getRootElement? Thanks in advance! It is much appreciated!
  6. Hi, I'm trying to create a script that lets the players health gradually drop by -1, kind of as if they were starving. I have no idea how to learn this because the wiki doesn't explain me this. function Starve(thePlayer) setTimer(function() SetElementHealth( thePlayer, getElementHealth(thePlayer) - 2 ), 1000, 0) end end addEventHandler("onResourceStart", Starve)
  7. Read the wiki It's really easy.
  8. Tails

    script gate

    I am still a noobee myself, but I think you'll have to use the createObject function. https://wiki.multitheftauto.com/wiki/CreateObject
  9. Tails

    Coordinates

    Ah, I noticed I forgot the capital since it wasn't outputting anything at all. And wow. Thank you all! The script just makes so much sense now.
  10. Tails

    Coordinates

    Sorry, am lost once again. function getCoord() local x,y,z = getElementPosition(thePlayer) outputChatbox("Coordinates: " .. getElementPosition(thePlayer) .."", getRootElement(), 255,0,255, true) end addCommandHandler("coord", getCoord) function getCoord() local x,y,z = getElementPosition(thePlayer) outputChatbox("Coordinates:", getRootElement(), 255,0,255, true, x, y, z) end addCommandHandler("coord", getCoord)
  11. Tails

    Coordinates

    Yeah, I figured I could Let's see if I can if not I'll come back here and ask for help
  12. Tails

    Coordinates

    Hi, I was wondering if there is quick way to fetch coordinates from your ingame ped position? Like print them to the console for example. Thanks in advance.
  13. Another question, what exactly is the 0 standing for in this line: setTimer ( spawnPlayer, 2500, 1, source, x, y, z, 0, mySkin ) ?
  14. Thanks you guys. I appreciate the help so much. I learn something new every time when I'm here!
  15. Sorry for the many questions, (I am such a noob), but can you help me figure out how to put a respawn timer in the script below? function deathCheck() local x,y,z = getElementPosition(source) if (isPedDead(source)) then spawnPlayer(source, x,y,z) setPedSkin (source, mySkin) outputChatBox("Type /respawn to respawn immediately.", getRootElement(), 255,0,0,true) setTimer ( spawnPlayer, 2500, 1, source) end end addEventHandler ("onPlayerWasted", root, deathCheck)
  16. Maybe because my element was dead?
  17. Thank you guys. @Teteomar, the setElementPosition did not work, the ped got stuck and the respawn didn't work. I changed it back to spawnPlayer and it worked.
  18. Nope , doesn't work. Only thing that lets me respawn is by typing /respawn I want the respawn to happen automatically after I die. Edit: This is the full script maybe that helps: local spawnX, spawnY, spawnZ = 1713.02, 917.98, 10.80 local mySkin = 50 function joinHandler() spawnPlayer(source, spawnX, spawnY, spawnZ) fadeCamera(source, true) setCameraTarget(source, source) setPedSkin ( source, mySkin ) outputChatBox("Welcome to My Server", source) end addEventHandler("onPlayerJoin", getRootElement(), joinHandler) function respawn(source) local x,y,z = getElementPosition(source) spawnPlayer(source, x, y, z) setPedSkin (source, mySkin) end addCommandHandler("respawn", respawn) function deathCheck() local x,y,z = getElementPosition(source) if (isPedDead(source)) then spawnPlayer(source, x,y,z) end end addEventHandler("onPlayerWasted", deathCheck) function killcommand(source) killPed (source, source) outputChatBox("Type /respawn to respawn immediately.", getRootElement(), 255,0,0,true) end addCommandHandler("kill", killcommand) -- retrieve a table with all flag elements local flagElements = getElementsByType ( "tdm" ) -- loop through them for key, value in pairs(flagElements) do -- get our info local posX = getElementData ( value, "posX" ) local posY = getElementData ( value, "posY" ) local posZ = getElementData ( value, "posZ" ) end
  19. local mySkin = 50 I just did this to see if it would work. The script doesn't let me respawn when I die or type /kill /respawn works.
  20. Huh, so what do I need to do? This is what I have: function respawn(source) local x,y,z = getElementPosition(source) spawnPlayer(source, x, y, z) setPedSkin (source, mySkin) end addCommandHandler("respawn", respawn) function deathCheck() local x,y,z = getElementPosition(source) if (isPedDead(source)) then spawnPlayer(source, x,y,z) end end addEventHandler("onPlayerWasted", deathCheck) function killcommand(source) killPed (source, source) outputChatBox("Type /respawn to respawn immediately.", getRootElement(), 255,0,0,true) end addCommandHandler("kill", killcommand)
  21. So I want the player to respawn automatically after he dies, on the same position. function deathCheck(source) local x,y,z = getElementPosition(source) if (isPedDead(source)) then spawnPlayer(source, x,y,z) end end addEventHandler("onPlayerWasted", deathCheck) What am I doing wrong? Also, how do I attach a timer to the respawn? Thanks in advance
  22. Thank you. Do you know if there is a way to put markers in the map via the editor? And if so how do I access them so I can edit its properties? I've tried putting in spawn points using the TDM definition but it doesn't let me spawn on them. Gamemode lua: local spawnX, spawnY, spawnZ = 1713.02, 917.98, 10.80 function joinHandler() spawnPlayer(source, spawnX, spawnY, spawnZ) fadeCamera(source, true) setCameraTarget(source, source) setPedSkin ( source, 50 ) outputChatBox("Welcome to My Server", source) end addEventHandler("onPlayerJoin", getRootElement(), joinHandler) -- retrieve a table with all flag elements local flagElements = getElementsByType ( "tdm" ) -- loop through them for key, value in pairs(flagElements) do -- get our info local posX = getElementData ( value, "posX" ) local posY = getElementData ( value, "posY" ) local posZ = getElementData ( value, "posZ" ) end
  23. That didn't work, it broke the teleport ! haha
  24. How do I stop vehicles from triggering the setElementInterior ? -- loool -- blips function blips ( ) createBlip ( 1713.02, 917.98, 10.80, 27 ) -- mechanic createBlip ( 1381.99, 1019.81, 10.82, 51 ) -- store storeMarker = createMarker ( 1374.50, 1020, 12.5, 'arrow', 2.5, 72, 118, 255, 250 ) mechMarker = createMarker ( 1713, 913, 12.0, 'arrow', 2.0, 72, 118, 255, 250 ) mechMarkerBack = createMarker ( 2333.10, -1077.7, 1050.02, 'arrow', 2.0, 72, 118, 255, 250 ) setElementInterior ( mechMarkerBack, 6) gunInsideMech = createPickup (2342.25, -1063.91, 1049.02, 2, 22, 3000 ) -- Pistol inside mech house setElementInterior ( gunInsideMech, 6) armorInsideMech = createPickup (2340.25, -1063.91, 1049.02, 1, 100, 3000) -- Armor inside mech house setElementInterior ( armorInsideMech, 6) end addEventHandler ( "onResourceStart", resourceRoot, blips ) -- markers function MarkerHit ( thePlayer, matchingDimension ) local elementType = getElementType ( thePlayer ) if ( elementType == "player" ) then if ( source == storeMarker ) then outputChatBox ( "You hit the marker", thePlayer, 255,0,0 ) givePlayerMoney ( thePlayer, 5000 ) elseif ( source == mechMarker ) then outputChatBox ( "You entered the safe house.", thePlayer, 255,0,0 ) setElementInterior ( thePlayer, 6, 2333.0330, -1073.9600, 1049.0230 ) elseif ( source == mechMarkerBack ) then outputChatBox ( "You left the safe house.", thePlayer, 255,0,0 ) setElementInterior ( thePlayer, 0, 1713.02, 917.98, 10.80 ) end end end addEventHandler ( "onMarkerHit", root, MarkerHit )
  25. Thank you very much Solidsnake14!
×
×
  • Create New...