Trust aka Tiffergan Posted May 22, 2020 Posted May 22, 2020 I want to do something that if we have a skin id == 200, we can swim as much as we want, and I did something that works for freeroam, but I do DayZ server and on DayZ server i get damage function stopDrown ( attacker, damage_type) if ( getElementType(source) == "player" ) then skin = getPedSkin(localPlayer) if skin == 200 and damage_type == 53 then cancelEvent() end end end addEventHandler ( "onClientPlayerDamage", getLocalPlayer(), stopDrown )
Spakye Posted May 22, 2020 Posted May 22, 2020 Hello, i dont think you need to use getElementType since the source of the event will always be the player that got dammaged. Also use getElementModel() instead of getPedSkin. any error ?
Moderators IIYAMA Posted May 22, 2020 Moderators Posted May 22, 2020 (edited) 6 hours ago, LOOah said: and I did something that works for freeroam, but I do DayZ server and on DayZ server i get damage Either the anti cheat (DayZ) or a custom damage script (DayZ). Try to search for getPedOxygenLevel inside of all the scripts from DayZ. Or search for isElementInWater instead. And try to disable it there. With notepad++ you can search in directories instead of file by file. (But make sure to filter on .Lua files only, else you will also be searching inside of binary files like images and mods, which takes long...) Edited May 22, 2020 by IIYAMA 1
Trust aka Tiffergan Posted May 22, 2020 Author Posted May 22, 2020 3 hours ago, Spakye said: Hello, i dont think you need to use getElementType since the source of the event will always be the player that got dammaged. Also use getElementModel() instead of getPedSkin. any error ? No there is no erros as i said that script is working on freeroam/play but on dayz isn't 2 hours ago, IIYAMA said: Either the anti cheat (DayZ) or a custom damage script (DayZ). Try to search for getPedOxygenLevel inside of all the scripts from DayZ. Or search for isElementInWater instead. And try to disable it there. With notepad++ you can search in directories instead of file by file. (But make sure to filter on .Lua files only, else you will also be searching inside of binary files like images and mods, which takes long...) when i was searching getPedOxygenLevel there is 0 hits but when i was searching isElementInWater was 1 hit with that addEventHandler("onPlayerRefillWaterBottle", root, function(itemName) if isElementInWater(source) then if getElementData(source,itemName)<=0 then return end setElementData(source, "Water Bottle", getElementData(source, "Water Bottle") + 1); setElementData(source, itemName, getElementData(source, itemName) - 1); triggerClientEvent(source, "displayClientInfo", source, "You filled 1 x "..itemName, 22, 255, 0); triggerClientEvent(source, "refreshInventoryManual", source); else triggerClientEvent(source, "displayClientInfo", source, "You must be in water!", 255, 22, 0); end end);
Moderators IIYAMA Posted May 22, 2020 Moderators Posted May 22, 2020 15 minutes ago, LOOah said: when i was searching getPedOxygenLevel there is 0 hits but when i was searching isElementInWater was 1 hit with that That is not it. hmmm Maybe: testLineAgainstWater https://wiki.multitheftauto.com/wiki/TestLineAgainstWater
Trust aka Tiffergan Posted May 22, 2020 Author Posted May 22, 2020 o i got it thanks for help man if soemone wanna now how this is it : function stopDrown () skin = getPedSkin(localPlayer) if skin == 200 then cancelEvent() end end addEventHandler ( "onClientPlayerDamage", getLocalPlayer(), stopDrown )
Tekken Posted May 23, 2020 Posted May 23, 2020 In core_client.Lua (survivorSystem_client.Lua) you may find the event onClientPlayerDamage and there you will see what happens when in water as if you add another that may create conflicts within the scripts. Also remplace getPedSkin with getElementModel as getPedSkin it's no longer a supported function. 1
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now