Jump to content

Dzsozi (h03)

Members
  • Posts

    696
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by Dzsozi (h03)

  1. Well, I try something, if it's not working I'll post my code that I've tried. Thanks!
  2. Hello community! I was thinking about how could I check if a player joins first and registers a new account. Because I want to make a little movie for the new players, a little introduction thingy. So for example if you have already played on the server, have an account and saved data, then you just spawn if you logged in. But if you come up to the server, and if you haven't registered an account and played yet, then if you register a new account and log in a little movie will play. I hope you understand me! Thanks for the help in advance! P.S.: Sorry for the bad English if there was something written wrong, I'm from Hungary!
  3. Oh my god, finally, thank you! I appreciate it!
  4. I've got this problem again with another script. I can't define the player, I've tried thePlayer, player, source, but nothing seems to work. Why? What's the problem? (full code) local hospitalPositions = { --{name, x, y, z, r, cx, cy, cz} {"Los Santos Market", 1178.291015625, -1324.1884765625, 14.112809181213, 270.10269165039, 1219.5555419922, -1350.3894042969, 15.35106754303}, {"Los Santos Jefferson", 2033.3256835938, -1407.6052246094, 17.178876876831, 155.35185241699, 1995.7249755859, -1463.2962646484, 17.878829956055}, {"Flint County", -595.72711181641, -1077.2752685547, 23.602161407471, 266.27713012695, -591.57257080078, -1131.4045410156, 41.221168518066}, {"Red County", -942.13061523438, -533.36236572266, 25.953638076782, 310.40444946289, -964.28985595703, -549.99957275391, 36.916095733643}, {"Santa Flora", -2656.9560546875, 631.52252197266, 14.453125, 180.42951965332, -2575.8940429688, 561.90728759766, 21.209178924561}, {"Angel Pine", -2202.5417480469, -2254.626953125, 30.681533813477, 216.4725189209, -2200.2456054688, -2275.5190429688, 38.479064941406}, {"Montgomery", 1244.2723388672, 331.79971313477, 19.5546875, 334.32315063477, 1272.0018310547, 345.42361450195, 30.568145751953}, {"Blueberry", 207.5835723877, -62.355804443359, 1.7481514215469, 179.15745544434, 231.66580200195, -91.108108520508, 18.604141235352}, {"Fort Carson", -318.32772827148, 1052.3748779297, 20.340259552002, 330.99075317383, -293.86444091797, 1075.7722167969, 20.491537094116}, {"Las Venturas Airport", 1604.7628173828, 1821.8123779297, 10.8203125, 352.52377319336, 1570.9233398438, 1859.9248046875, 11.351891517639}, {"Las Payasadas", -251.56652832031, 2602.4379882813, 62.858154296875, 311.32571411133, -226.53842163086, 2567.9504394531, 69.399459838867}, {"El Quebrados", -1515.0689697266, 2521.9731445313, 55.841911315918, 359.86227416992, -1506.4434814453, 2546.1689453125, 56.440139770508} }; function onWasted(totalAmmo, killer, killerWeapon, bodypart, stealth) if not( isGuestAccount (getPlayerAccount(source)) ) then local theSkin = getPedSkin(source) local theTeam = getPlayerTeam(source) local theWeapon = getPedWeapon (source) local weaponAmmo = getPedTotalAmmo (source) local px, py, pz = getElementPosition(source) local nearest = 1 for k, v in pairs(hospitalPositions) do if(getDistanceBetweenPoints3D(v[2], v[3], v[4], px, py, pz) < getDistanceBetweenPoints3D(hospitalPositions[nearest][2], hospitalPositions[nearest][3], hospitalPositions[nearest][4], px, py, pz))then nearest = k end end fadeCamera(source, false, 2) setTimer( function() setCameraMatrix(source, hospitalPositions[nearest][6], hospitalPositions[nearest][7], hospitalPositions[nearest][8], hospitalPositions[nearest][2], hospitalPositions[nearest][3], hospitalPositions[nearest][4]) fadeCamera(source, true, 2) setTimer( function() fadeCamera(source, false, 2) end, 2000, 1) end, 2000, 1) setTimer( function() spawnPlayer(source, hospitalPositions[nearest][2], hospitalPositions[nearest][3], hospitalPositions[nearest][4], hospitalPositions[nearest][5], theSkin, 0, 0, theTeam) giveWeapon(source, theWeapon, weaponAmmo) setCameraTarget(source) end, 6000, 1) end end addEventHandler ("onPlayerWasted", root, onWasted)
  5. Thank you, works, this is what I was looking for! Thanks!
  6. Is it okay if we continue the conversation in PM?
  7. Could you please explain why I have to post my full code if there's only problem within the function that I've posted? I'm just curious.
  8. Hello everybody! I have a little problem with my script. I don't know how to name the player who is in a spawned car. It's not working. I mean I've got this on server side: function missionFailed(thePlayer) if (isElement(Vehicles.car)) then triggerClientEvent(thePlayer, "mission:Failed", thePlayer) createRandomCar() toggleControl(thePlayer, "enter_exit", true) destroyElement(missionTimer) for i,v in pairs(Vehicles) do destroyElement(v) end for i,v in pairs(Markers) do destroyElement(v) end for i,v in pairs(Blips) do destroyElement(v) end end end And I have this error: Why? I've even tried source instead of thePlayer, but I always got this problem. Everything is fine except this. Car, marker and blip are being deleted, a new car is being spawned, but I don't get the mission failed client event (there's no problem on the client side) and I can't enter vehicles (enter_exit is still being disabled). Could someone help me in this? I never understand this thing on server side, how to name a player when there's no onMarkerHit event or something like this. Thank you in advance!
  9. Thank you, but I have one more problem. How could I count which city has more players in it?
  10. Hello community! I'm making a mission, and I want to get the count of the players in the cities. Because I want to spawn the mission to the city that has more players, for exmaple if there's 10 players on the server, 8 of 10 are in LS and 2 of 10 are in LV then the mission would spawn to a specified position inside LS. Hope you understand me! So my question is: How could I get this number? I think I should use these functions: getZoneName getElementsByType ( "player" ) getElementPosition But I don't know how to get the players count in the cities. I would appreciate it if someone could help me, thanks in advance!
  11. What do you mean by spawned? Novo wrote the isPedDead function in his script. You can use his script or edit mine to make it show and disappear when a player is dead. I don't understand what do you mean by spawned, the players are always spawned in the game.
  12. It should, try it again, maybe you wrote something wrong, but if not then it look's like it's a bug or it doesn't freeze the player. But I think you would get the same result with setElementFrozen as with setting updatePosition to false. Sorry for bad English, hope you understand me!
  13. You could try this function: bool setElementFrozen ( element theElement, bool freezeStatus ) while animation is being applied on someone.
  14. I can't test it right now, but hope this helps. local hudIsVisible = false local hudButton = "" -- If you want to you can write a button here, so you can bind the visibility changing of the hud. If you don't want to bind it then just leave it blank. function toggleHud (state) if (state == true) then if (not hudIsVisible) then addEventHandler('onClientRender', root, render) -- Don't forget to change the function's name, I just wrote render, but change it to your's function name! hudIsVisible = true else hudIsVisible = false outputChatBox("You've #FF0000disabled #FFFFFFthe hud!", 255, 255, 255, true) end elseif (state == false) then if (hudIsVisible) then removeEventHandler('onClientRender', root, render) -- Change function name here as well. hudIsVisible = false else hudIsVisible = true outputChatBox("You've #00FF00enabled #FFFFFFthe hud!", 255, 255, 255, true) end end end local bool = true toggleHud(bool) addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), function () if hudButton ~= "" then bindKey(hudButton, "down", function () bool = (not hudIsVisible) toggleHud(bool) end) end end ) If you want to make an export function, to disable and enable the hud from other resources you can add this line to the meta.xml: function="toggleHud" type="client" /> So this will look like this in other resources: exports.hudresourcename:toggleHud(false) -- Disables the hud, true will enable it.
  15. Thank you, it fixed the problem! Thank's again!
  16. Hello! I made a script that adds a little "bullet smoke" effect for the guns, I made it to fade away then remove the rendering. My only problem is that if I keep shooting then sometimes it's not visible, or it's just visible for a little time. How could I fix it? I used @Dealman's (Click) and the wiki's example and mixed it. local fadingAlpha = 200; -- Set this to the value where you want it to start fading from. local fadingAlphaFrom = fadingAlpha; local fadingDuration = 250; -- Set this for how long you want it to go from fully visible to not visible (255 -> 0). Milliseconds. local fadingInterval = 50; -- Set this for how often it should detract the increments. 50 ms minimum. Less = Smoother local timesToRun = (fadingDuration/fadingInterval); -- This is just to make the code below somewhat auto, so you don't have to change values everywhere. local fadeIncremental = (fadingAlphaFrom/timesToRun); -- This is just to make the code below somewhat auto, so you don't have to change values everywhere. function OnPlayerFire(w,a,aC,hX,hY,hZ,hE) --setTimer(function() local sx,sy,sz = getPedWeaponMuzzlePosition(source)-- get the WeaponMuzzlePosition of the Player who shot Position = {sx,sy,sz,hX,hY,hZ} -- save it in a table so we can use it later in 'onClientRender'function --removeEventHandler("onClientRender", root, onRender) addEventHandler("onClientRender",root,onRender) -- add the onClientRender-Event to the function onRender alphaHandler() setTimer(function() removeEventHandler("onClientRender", root, onRender) end, fadingDuration, 1); --end, 250, 0); end addEventHandler("onClientPlayerWeaponFire",root,OnPlayerFire); function onRender() if Position then -- check if there are Positions available local startX,startY,startZ,endX,endY,endZ = unpack(Position)-- unpack the Position table dxDrawLine3D( startX,startY,startZ,endX,endY,endZ,tocolor(150,150,150,fadingAlpha),0.75) -- draws the 3D line between start-Position and end-Position end -- end of if end function alphaHandler() fadingAlpha = 200; setTimer(function() fadingAlpha = fadingAlpha-fadeIncremental end, fadingInterval, timesToRun); end Thank you in advance!
  17. Én, de a magyar részlegbe ritkán nézek be mert mindig csak a Valhallás RP szerver hirdetések meg szinte csak Valhallával kapcsolatos segítségkérések vannak.
  18. I made the Hungarian version. Hope this helped. [ [ { "languageCode": "hu", "friendlyName": "Hungarian (magyar)", "helpButton": "Segítség", "l10nButton": "Nyelv", "loadButton": "URL betöltése", "removeSong": "Zene eltávolítása", "clearList": "Lista kiürítése", "gridlistURL": "URL", "gridlistNP": "Currently Playing", "prevSong": "Előző", "nextSong": "Következő", "pauseSong": "Megállítás/Folytatás", "vehiRadio": "Jármű", "walkRadio": "Walkman", "boomRadio": "Boombox", "artistLabel": "Előadó", "albumeLabel": "Album", "songLabel": "Zene", "tooltips": { "helpButton": "Ki illetve bekapcsolja ezeket a segítségeket", "l10nButton": "Megváltoztatja a rádió kezelőpaneljének nyelvét", "inputField": "A zene URL-jét ide kell bemásolni", "loadButton": "Betölti a bemásolt URL-t", "removeSong": "Eltávolítja a kijelölt zenét a listáról", "clearList": "Eltávolítja az egész lejátszási listát", "playlist": "Itt jelennek meg a lejátszható zenék", "prevSong": "Lejátssza az előző zenét, vagy a jelenlegit újraindítja ha már tovább szólt az 5 másodpercnél", "nextSong": "Lejátssza a következő zenét a listáról", "pauseSong": "Megállítja vagy lejátssza a zenét, ha egy online rádió szól akkor megállítja vagy elindítja a playback-et", "vehiRadio": "A zene a kocsiból fog szólni ha vezetsz", "walkRadio": "A zene egy fülesen fog szólni ha vezetsz vagy sétálsz", "boomRadio": "A zene egy rádióból/boombox-ból fog szólni ha gyalog vagy" } }, ] ]
  19. Maybe setElementPosition and setElementRotation would be a good way to script it? I mean if you press forwards button then a custom binded fuction, in this case setElementPosition would be incrased with setElementPosition + 5 or I don't know, something like that.
  20. Hello community! Today I was thinking about if is this possible to script a submarine in MTA SA. So, is this possible shomehow? If so, what functions should I use? Thanks in advance!
  21. For the chat you will need showChat.
  22. For the sniper you could try to disable the first person function while the player is holds the aiming button, then if the player releases the button put it back to fps mode. This is what I would try firstly.
  23. Thank you very much, I fixed the problem by just removing the boxPadding from textWidth and textHeight. So now it looks perfect with long and short texts, thank you again very much! Three screenshots of the perfect notification box: Thank you again!
×
×
  • Create New...