Jump to content

.:HyPeX:.

Members
  • Posts

    1,255
  • Joined

  • Last visited

Everything posted by .:HyPeX:.

  1. .:HyPeX:.

    Sound Balancing

    Hello, one of my speakers died (my left one), how can i balance the sound in order to hear them all on the right speaker? since i cant hear car sounds for example.
  2. Yeah, after i just posted i realized and fixed it, the nil part you told me before to remove it, but as while i was fixing it i readed https://wiki.multitheftauto.com/wiki/DestroyElement and noticed the nil thingy.
  3. Of course you can, Solidsnake told you to use pairs instead of ipairs. Read this: http://www.luafaq.org/#T1.10 No that's not a copy of the marker at all, just a copy of it's reference. So you are destroying the same marker twice because the two references are pointing to the same marker ... And seriously, if more experienced developpers are telling you what's your script doing, just try to understand by reading carefully. Don't say they are wrong without testing it. You didn't even try ! I swear there is an error in debugscript 3 you didn't gave us that occurs at line 8. Regards, Citizen Well i missed that about just using pairs instead of ipairs, i quickly readed over it and didnt noticed the change. And, i did not got that error on that line. The only error i got was when the script tried to compare the marker with me when the marker did no longer exist. Anyways, i'm starting up my server to check if it works correctly after the fixes i've done according to pairs. EDIT: Just found out: fails to delete them local source = source if MedKit1[source] then destroyElement(MedKit[source]) end if MedKit2[source] then destroyElement(MedKit2[source]) end Error: attempt to index global 'MedKit' (a nil value) - Line 3 Marker creation: (works perfectly) function MedKits(player,cmd) if getElementData(player,"MediKits") > 0 then meds = getElementData(player, "MediKits") local x,y,z = getElementPosition(player) setElementData(player, "MediKits", meds - 1) outputChatBox("#0077ff[bF3]: MedKit Deployed! Medkits Left: ".. getElementData(player, "MediKits"), player,255,255,255,true) if MedKit1[player] then MedKit2[player] = createMarker(x,y,z,"corona", 1, 0,255,0,250, getPlayersInTeam(getPlayerTeam(player))) else MedKit1[player] = createMarker(x,y,z,"corona", 1, 0,255,0,250, getPlayersInTeam(getPlayerTeam(player))) end else outputChatBox("#0077ff[bF3]: You dont have any MedKits left!", player,255,255,255,true) end end addCommandHandler("MedKit", MedKits, false,false)
  4. K, it took me a lot of time to understand your code since I just came in. First I just wanted to say that medkit3 and 4 are totally useless. As Solidsnake, there is no need to do a table numerical indexed ... And here is the problem. You are first doing this: if v == MedKit3[source] then so v and MedKit3[source] reference the same marker but you want to delete that marker twice: destroyElement(v) destroyElement(MedKit3[source]) So the 2nd call to destroyElement just fail since it's already destroyed so the script just stop there. Also, there is no need to set v to nil since it's a temp variable used by the loop. So just remove the lines 6-7 and 16-17 and it will work just fine. the fact is, that it does not loop the table if it is not numerically indexed (It only worked if i did so) oh and edit: note that im not deleting double, im destroying its copy, i insert MedKit3[source] into numerical table, so i destroy the numerical copy and the MedKit3[source] one to dont leave anything
  5. Just found out a problem: I cant destroy one of the markers, its just there, this is how i destroy upon onPlayerWasted.. The first marker is destroyed, however, the second isnt destroyed. local source = source if MedKit3[source] then for i,v in ipairs(MedKit1) do if v == MedKit3[source] then destroyElement(v) v = nil destroyElement(MedKit3[source]) MedKit3[source] = nil end end end if MedKit4[source] then for i,v in ipairs(MedKit2) do if v == MedKit4[source] then destroyElement(v) v = nil destroyElement(MedKit4[source]) MedKit4[source] = nil end end end
  6. Grenades, tear gas, satchels use the same slot. https://wiki.multitheftauto.com/wiki/Weapons Thanks!, i'll see what i can do then
  7. Just fixed myself, i wasnt checking X,Y,Z, i was checking elements this v1, v2, v3 = getElementPosition(v) k1,k2,k3 = getElementPosition(k) if getDistanceBetweenPoints3D(k1, k2, k3, v1,v2,v3) <= 15 then Thanks for the help!
  8. Spawn is given first, there should not be a problem with that, since it gives the other 2 weapons, of wich one is given before and the other is given after tearglass
  9. But it doesnt, since i dont get the output.. tried this, but says "Comparing with boolean with number" @GetDistanceBetweenPoints2D i do get the 3rd output Thought MedKit1 = {} MedKit2 = {} MedKit3 = {} MedKit4 = {} function MarkerCheckMed() outputChatBox("Checking Distance", getRootElement(), 255,255,255,true) for i,v in ipairs(getElementsByType("player")) do outputChatBox("Checking player "..getPlayerNametagText(v), getRootElement(), 255,255,255,true) for s, k in ipairs(MedKit1) do outputChatBox("Checking Player Marker ", getRootElement(), 255,255,255,true) if getDistanceBetweenPoints3D(k, v) <= 15 then outputChatBox("Distance Met!", getRootElement(), 255,255,255,true) if not getElementData(v, "Heal") then setElementData(v, "Heal", true) end else if getElementData(v, "Heal") then removeElementData(v, "Heal") end end end end end MarkerTim = setTimer(function() MarkerCheckMed() end, 1000, 0) function MedKits(player,cmd) if getElementData(player,"MediKits") > 0 then meds = getElementData(player, "MediKits") local x,y,z = getElementPosition(player) setElementData(player, "MediKits", meds - 1) outputChatBox("#0077ff[bF3]: MedKit Deployed! Medkits Left: ".. getElementData(player, "MediKits"), player,255,255,255,true) if MedKit1[player] then MedKit4[player] = createMarker(x,y,z,"corona", 1, 0,255,0,250, getPlayersInTeam(getPlayerTeam(player))) table.insert(MedKit2, MedKit3[player]) else MedKit3[player] = createMarker(x,y,z,"corona", 1, 0,255,0,250, getPlayersInTeam(getPlayerTeam(player))) table.insert(MedKit1, MedKit3[player]) end else outputChatBox("#0077ff[bF3]: You dont have any MedKits left!", player,255,255,255,true) end end addCommandHandler("MedKit", MedKits, false,false)
  10. Spawned it outputed before Press "G" thingy on the medic class.
  11. How could i index it correctly in this case? cant find a way arround.. EDIT: I know i can do table.insert, but how i assing a key to that value i inserted? Lets say i insert variable K, How i give K a value? (in this case CreateMarker)
  12. Nope. (Appart from the double outputchatbox spam, no ) EDIT: Visual failure:
  13. Spawning comes first, and the tear is before and after other 2 weapons wich are actually given so i've discarded this idea.
  14. This is basically the spawning function, tell me what more you need about it (too long for posting it entirely) The engineer class is not given teargas, the other weapons yes. function SpawnPlayer(player) bindKey(source, "R", "down", "reloadgun") local player = source ProtectionTable[source] = source timer = setTimer(function() ProtectionTable[player] = nil end, 5000, 1) if getPlayerTeam(player) == ATeam then local Spawned = #ASpawn local mathed = math.random(Spawned) spawnPlayer(player, ASpawn[mathed].X, ASpawn[mathed].Y, ASpawn[mathed].Z) setElementModel(source, 287) fadeCamera(source, true) class = getElementData(source, "Class") if class == "Medic" then giveWeapon ( source, 22, 60 , false ) giveWeapon ( source, 29, 180 , true ) outputChatBox("#0077FF[bF3]: You have selected medic, Press 'G' to drop a MedKit", source,255,255,255,true) setElementData(source, "MediKits", 2) setElementData(source, "Damage", 1) elseif class == "Assault" then giveWeapon ( source, 24, 180 , false ) giveWeapon ( source, 31, 600 , true ) setElementData(source, "Damage", 1) elseif class == "Sniper" then giveWeapon ( source, 23, 60 , false ) giveWeapon ( source, 34, 30 , true ) setElementData(source, "Damage", 2) elseif class == "Engineer" then giveWeapon ( source, 17, 90) giveWeapon (source, 39, 2) giveWeapon ( source, 27, 80 , true ) setElementData(source, "Damage", 1) end setCameraTarget (source, source) if isElementFrozen(source) then setElementFrozen(source, false) end Blips[source] = createBlipAttachedTo( source, 0, 2, 0, 255, 0, 255, 0, 99999, getPlayersInTeam(ATeam) ) setElementVisibleTo ( Blips[source], getRootElement(),false) for i, v in ipairs(getPlayersInTeam(ATeam)) do setElementVisibleTo ( Blips[source], v,true) end elseif getPlayerTeam(player) == BTeam then local Spawned = #BSpawn local mathed = math.random(Spawned) spawnPlayer(player, BSpawn[mathed].X, BSpawn[mathed].Y, BSpawn[mathed].Z) setElementModel(source, 285) Blips[source] = createBlipAttachedTo( source, 0, 2, 0, 255, 0, 255, 0, 99999, getPlayersInTeam(BTeam) ) setElementVisibleTo ( Blips[source], getRootElement(),false) for i, v in ipairs(getPlayersInTeam(BTeam)) do setElementVisibleTo ( Blips[source], v,true) end fadeCamera(source, true) class = getElementData(source, "Class") if class == "Medic" then giveWeapon ( source, 22, 60 , false ) giveWeapon ( source, 29, 180 , true ) setElementData(source, "MediKits", 2) setElementData(source, "Damage", 1) elseif class == "Assault" then giveWeapon ( source, 24, 180 , false ) giveWeapon ( source, 31, 600 , true ) setElementData(source, "Damage", 1) elseif class == "Sniper" then giveWeapon ( source, 23, 60 , false ) giveWeapon ( source, 34, 30 , true ) setElementData(source, "Damage", 2) elseif class == "Engineer" then giveWeapon ( source, 17, 20 , false ) giveWeapon (source, 39, 2, false) giveWeapon ( source, 27, 80 , true ) setElementData(source, "Damage", 1) end setCameraTarget (source, source) if isElementFrozen(source) then setElementFrozen(source, false) end end end addEvent("SpawnPlayer",true) addEventHandler("SpawnPlayer", getRootElement(), SpawnPlayer)
  15. Still same.
  16. Only first 2 outputs are done, the other 2 arent given every sec.. (I've already placed the 2 markers and see them) function MarkerCheckMed() outputChatBox("Checking Distance", getRootElement(), 255,255,255,true) for i,v in ipairs(getElementsByType("player")) do outputChatBox("Checking player "..getPlayerNametagText(v), getRootElement(), 255,255,255,true) for s, k in ipairs(MedKit1) do outputChatBox("Checking Player Marker ", getRootElement(), 255,255,255,true) if getDistanceBetweenPoints3D(k, v) <= 15 then outputChatBox("Distance Met!", getRootElement(), 255,255,255,true) if not getElementData(v, "Heal") then setElementData(v, "Heal", true) end else if getElementData(v, "Heal") then removeElementData(v, "Heal") end end end end end MarkerTim = setTimer(function() MarkerCheckMed() end, 1000, 0) MedKit1 = {} MedKit2 = {} function MedKits(player,cmd) if getElementData(player,"MediKits") > 0 then meds = getElementData(player, "MediKits") local x,y,z = getElementPosition(player) setElementData(player, "MediKits", meds - 1) if MedKit1[player] then MedKit2[player] = createMarker(x,y,z,"corona", 1, 0,255,0,250, getPlayersInTeam(getPlayerTeam(player))) else MedKit1[player] = createMarker(x,y,z,"corona", 1, 0,255,0,250, getPlayersInTeam(getPlayerTeam(player))) end end end addCommandHandler("MedKit", MedKits, false,false)
  17. Hey guys, i cant give myself teargass, (giveWeapon ( source, 17, 90)), and i cant see why, its just not giving me it.
  18. I'm using both and its pretty good, but if someone is going for the no cache stuff, then the encryption is just another step..
  19. you should note that g_ForcedNextMap is a variable inside the race wich you cant modify from outside of it. (it is even only modified from the actually core script of the race.) Umm drop it, he's just using a random variable as a way to count.
  20. is this inside the race resource? if no then you should make a trigger to it or add the script there, you cant use global variables from other resources. You should also note that if you have any map buying system you should make the code over that basis.
  21. Bump, im struck at the interval, help?
  22. It outputs that it might stop working on a future version, wich i dont want to happen.
  23. Ofc lol, im making an entire gamemode, and suddenly login stops working, its like i would obiously have done that -.- So much hate coming from some members these days This guy just tried to help you out with little informations you gave us. That kind of reply is totally disrespectful. "No, I already checked my meta, everything is fine." This is the kind of reply you (guys asking for help) have to post. Wishing you luck to find out the solution. Regards, Citizen It is annoying when you are obligated to use a compiler wich doesnt works correctly and not let otherst that do work, after i used back everything without compiling it worked perfectly, and it just dives a bit mad, i've said it stopped working after i just changed luac, if im doing something compiled it is supposed to be atleast a bit advanced and suppose i've checked any debug errors before posting.
  24. Ofc lol, im making an entire gamemode, and suddenly login stops working, its like i would obiously have done that -.-
  25. Hey guys, my script worked perfectly, until i compiled it with mtasa's compiler, it stopped working, simply. More detailed explanation: upon loggin in, a triggerClientEvent is sent to event "onClientPlayerLogin" wich displays a gui. This worked perfectly, and after going luac it stopped working. Reason? Hell no idea. What could i do?
×
×
  • Create New...