Jump to content

sirrjohn

Members
  • Posts

    28
  • Joined

  • Last visited

  • Days Won

    1

sirrjohn last won the day on August 30 2023

sirrjohn had the most liked content!

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

sirrjohn's Achievements

Advanced Member

Advanced Member (8/54)

4

Reputation

  1. oh that sounds like a good idea, a resource starter script!! Tyvm for the heads up i wasn't thinking about that. I can find out how to do it myself, to not bother you guys much more! Was a nice tip. Ty!
  2. I have a simple script that gets a .txt from my website, it fetches correctly the said key but takes awhile, making resources that uses that key fail to start as thats what the protection does, cancels onResourcesStart if it can't fetch the key or if it is wrong. I've tried onResourcePreStart but no success, also download priority on meta.xml. Is there a way to delay every other resource startup or dont make any of them load before it fetches? Or another way to solve this? Code below. Credits to Lord Henry for 98% of the code, I just edited to make it fetch a file not an ip from web, and some other stuff, but pretty much all the code is from him. P.s: if there is something wrong its my addition and my fault ok function startIPChecking () fetchRemote ("http://***.com/key.txt", myCallback, "", false) end addEventHandler ("onResourceStart", resourceRoot, startIPChecking) function myCallback (responseData, errors) if (errors == 0) then KEY = tostring(responseData) print("server authorized") else KEY = "error" print("server not authorized") end end function getKey() return KEY end Protected script addEventHandler("onResourceStart", resourceRoot, function() local keyy = exports["secur"]:getKey () if not keyy then return cancelEvent() end if keyy ~= "****" then return cancelEvent() else ---- code if verification OK ...
  3. Since i cant edit: Decided to do it a diff way, using imageSection health = exports["extra_health"]:getElementExtraHealth(peds) local healthround = math.ceil(health) local life_pc = (health / 1000) * 100 local vida_atual = life_pc*1.28 dxDrawImage(sx-60, sy- 70, 128, 16, "healthbarbg.png") dxDrawImageSection(sx-60, sy- 70, vida_atual, 16, 0, 0, vida_atual, 16, "healthbar.png") dxDrawText(healthround,sx-40+25,sy-70,sx, sy,tocolor ( 255, 255, 255, 255 ), 1,"sans") I just couldn't get the max health value so i had to put it manually, but it works. Problem now is when ped health reaches 0 it doesnt die... i need to shoot him a few more times, using extra_health script addEventHandler("onClientPedDamage", root, function(attacker, weapon, _, loss) if isElementInvulnerable(source) then cancelEvent() else local health = getElementExtraHealth(source) if health >= loss then setElementExtraHealth(source, health - loss) cancelEvent() end end end )
  4. For some reason this script when ped is with high health (im using extra_health resource), when u shoot him its life bar only visually lowers after his life is low... if his health is high it wont even move or visually reduce the health bar. PS: Health works fine issue is only with the bar. I'm sure the code is wrong, I just need a little help with calculations here I believe... not sure. local maxHealth = 1000000 local healthPercentage = health / maxHealth local lineLength = 150 * healthPercentage local healthBar = dxDrawRectangle(sx - 60, sy - 70, lineLength, 7, tocolor(255, 0, 0, 210)) Appreciate all the help, I'm trying to not bother you guys here and trying to do by myself but this issue got me.
  5. It works now, but with many DUPS... spawnedSounds = {} function playZombieSounds() local ped = getElementsByType("ped") for theKey,peds in ipairs(ped) do if ped and isElement(peds) and isElementStreamedIn(peds) then local Zx,Zy,Zz = getElementPosition(peds) zedSound = playSound3D(zombiesounds[math.random(1,#zombiesounds)], Zx, Zy, Zz, false) spawnedSounds[peds] = zedSound for theKey,theSound in pairs(spawnedSounds) do if getElementData(peds,"deadzombie") then stopSound(theSound) end end end end end setTimer(playZombieSounds,6000,0)
  6. It seems its working, but how to stop sound only when ped is dead? i tried this, didnt work spawnedSounds = {} function playZombieSounds() local ped = getElementsByType("ped") for theKey,peds in ipairs(ped) do if ped and isElement(peds) and isElementStreamedIn(peds) then local Zx,Zy,Zz = getElementPosition(peds) zedSound = playSound3D(zombiesounds[math.random(1,#zombiesounds)], Zx, Zy, Zz, false) spawnedSounds[ped] = zedSound for theKey,theSound in pairs(spawnedSounds) do if getElementData(ped,"deadman") or getElementData(ped,"Muerto") then stopSound(theSound) end end end end end setTimer(playZombieSounds,6000,0)
  7. Hey Bishop! Sadly it didnt work... I had the same code on a different zombie gamemode and there it worked fine... but on this one it doesnt.. zombies keep making sounds when dead
  8. I get the following error -- PLAY ZOMBIE SOUNDS local zombiesounds = { "Sonidos/zgroan (1).ogg", "Sonidos/zgroan (2).ogg", "Sonidos/zgroan (3).ogg", "Sonidos/zgroan (4).ogg", "Sonidos/zgroan (5).ogg", "Sonidos/zgroan (6).ogg", "Sonidos/zgroan (7).ogg", "Sonidos/zgroan (8).ogg", "Sonidos/zgroan (9).ogg", "Sonidos/zgroan (10).ogg", "Sonidos/zgroan (11).ogg", "Sonidos/zgroan (12).ogg", "Sonidos/zgroan (13).ogg", "Sonidos/zgroan (14).ogg", "Sonidos/zgroan (15).ogg", "Sonidos/zgroan (16).ogg", "Sonidos/zgroan (17).ogg", "Sonidos/zgroan (18).ogg", "Sonidos/zgroan (19).ogg", "Sonidos/zgroan (20).ogg", "Sonidos/zgroan (21).ogg", "Sonidos/zgroan (22).ogg", "Sonidos/zgroan (23).ogg", "Sonidos/zgroan (24).ogg", "Sonidos/zgroan (25).ogg", "Sonidos/zgroan (26).ogg", "Sonidos/zgroan (27).ogg", "Sonidos/zgroan (28).ogg", "Sonidos/zgroan (29).ogg", "Sonidos/zgroan (30).ogg", "Sonidos/zgroan (31).ogg", "Sonidos/zgroan (32).ogg", "Sonidos/zgroan (33).ogg", "Sonidos/zgroan (34).ogg", "Sonidos/zgroan (35).ogg", "Sonidos/zgroan (36).ogg", } zedSound = false function playZombieSounds() local ped = getElementsByType("ped") for theKey,peds in ipairs(ped) do if ped and isElement(peds) and isElementStreamedIn(peds) then local Zx,Zy,Zz = getElementPosition(peds) zedSound = playSound3D(zombiesounds[math.random(1,#zombiesounds)], Zx, Zy, Zz, false) setSoundMaxDistance(zedSound,5) end if getElementData(peds,"deadman") or getElementData(peds,"Muerto") then stopSound(zedSound) end end end setTimer(playZombieSounds,6000,0)
  9. For anyone who needs: For anyone who needs, put in clientside, tested and working function mutePeds() local peds = getElementsByType("ped") for _, ped in ipairs(peds) do setPedVoice(ped, "PED_TYPE_DISABLED") end setPedVoice(localPlayer, "PED_TYPE_DISABLED") end addEventHandler("onClientResourceStart",root,mutePeds)
  10. Hi, Is it possible to mute all peds from saying anything? including main player?
  11. Hey, same error [18:37:14] ERROR: Client (Sirr) triggered serverside event setAccount1, but event is not added serverside [18:37:24] ERROR: Client (Sirr) triggered serverside event setAccount2, but event is not added serverside I found out server was not even running thats why it says that message... i removed some other code i dont use from server.lua and it now works 100% !! thank you very much !!!!
  12. didnt work but I think its something about "my" code thats not right... like [13:10:16] ERROR: Client (Sirr) triggered serverside event getAccount, but event is not added serverside [13:10:26] ERROR: Client (Sirr) triggered serverside event setAccount2, but event is not added serverside why does it says that if both events are in my server.lua file? 100% sure as you can see in the script above
  13. Hey guys, I know this code is a mess, I've been messing around with it trying to get it to work but its not 100% working What does not work: - When player leaves the server its not saving his new "combattime" AccountData value to db (which if he was in combat mode when he left, it should be 1 when he logs back in, but its always 0) Appreciate any help server function spawn() setTimer(function(source) outputChatBox("This server is protected by BattlDayZ (V1.1), an anticheat system.",source,255,0,0) end,2000,1,source) local playerAccount = getPlayerAccount(source) if getAccountData(playerAccount,"combattime") == 1 then setTimer ( killhim, 7000, 1,source) end end addEventHandler("onPlayerLogin",root,spawn) function killhim(source) outputChatBox("you got killed for disconnecting during a fight!") exports.DayZ:setPlayerBlood(source,-5) setTimer(function(source) setAccountData(source,"combattime",0) end,5000,1,source) end function setAccount1(source) local playerAccount = getPlayerAccount(source) setAccountData(playerAccount,"combattime",1) end addEventHandler("setAccount1", root, setAccount1) addEvent("setAccount1", true) function setAccount2(source) local playerAccount = getPlayerAccount(source) setAccountData(playerAccount,"combattime",0) end addEventHandler("setAccount2", root, setAccount2) addEvent("setAccount2", true) function getAccount(source) local playerAccount = getPlayerAccount(source) getter = getAccountData(playerAccount,"combattime") end addEventHandler("getAccount", root, getAccount) addEvent("getAccount", true) client combatloglabel = guiCreateLabel(0.82, 0.00, 0.27, 0.04, "A", true) guiSetVisible(combatloglabel,false) function createLogLabel() guiSetVisible(combatloglabel,true) guiLabelSetColor(combatloglabel, 17, 249, 5) guiLabelSetHorizontalAlign(combatloglabel, "center", false) guiLabelSetVerticalAlign(combatloglabel, "center") guiSetText(combatloglabel,"[Out of combat]") end addEventHandler("onClientPlayerSpawn",localPlayer,createLogLabel) function onPlayerActivateCombatLog(attacker) triggerServerEvent("getAccount", source) outputChatBox("getAccount OK") if getter == 0 then guiSetText(combatloglabel,"[Out of combat]") guiLabelSetColor(combatloglabel,0,255,0) outputChatBox("getter == 0") else guiSetText(combatloglabel,"[In combat]\nDont disconnect or you will die") guiLabelSetColor(combatloglabel,255,0,0) outputChatBox("getter == 1") end setTimer(function(source) outputChatBox("timer") triggerServerEvent("setAccount2", source) end,10000,1,source) end addEventHandler("onClientPlayerDamage",root,onPlayerActivateCombatLog)
  14. Mas não teria que ter uma verificação em cima do elementdata "owner" e só se o jogador for dono da base aparecer o blip dela para ele?
×
×
  • Create New...