MR.Kingos Posted May 21, 2019 Share Posted May 21, 2019 Eu venho procurando a muito tempo uma proteção admin o (godmode) o que acontece é que, o "Headshot" é de "Stealth" portando não importa qual PROTEÇÃO eu insira no servidor, sendo HS, irá morrer imediatamente. Então minha duvida é, como seria o resource pra evitar isso? Já que sendo somente no corpo ele "protege" o ped, mas na cabeça morre. Client da Proteção addEventHandler ( "onClientPlayerDamage",root, function () if getElementData(source,"invincible") then cancelEvent() end end) addEventHandler("onClientPlayerStealthKill",localPlayer, function (targetPlayer) if getElementData(targetPlayer,"invincible") then cancelEvent() end end) Server: function toggleGodMode ( thePlayer ) local account = getPlayerAccount ( thePlayer ) if ( not account or isGuestAccount ( account ) ) then return end local accountName = getAccountName ( account ) if ( isObjectInACLGroup ( "user.".. accountName, aclGetGroup ( "Console" ) ) ) then local state = ( not getElementData ( thePlayer, "invincible" ) ) setElementData ( thePlayer, "invincible", state ) outputChatBox ( "God Mode is now ".. ( state and "Enabled" or "Disabled" ) ..".", thePlayer, 0, 255, 0 ) end end addCommandHandler ( "god", toggleGodMode ) Parte do Headshot Server: function MakePlayerHeadshot( attacker, weapon, bodypart, loss ) if attacker and getElementType ( attacker ) == "ped" then if bodypart == 9 then triggerEvent( "onPlayerHeadshot", source, attacker, weapon, loss ) setPedHeadless ( source, true ) killPed( source, attacker, weapon, bodypart ) setTimer( BackUp, 900, 1, source ) end end end function MakeHeadshot( source, attacker, weapon, loss ) triggerEvent( "onPlayerHeadshot", source, attacker, weapon, loss ) killPed( source, attacker, weapon, 9 ) setPedHeadless ( source, true ) setTimer( BackUp, 900, 1, source ) end function BackUp( source ) if getElementType ( source ) == "player" then setPedHeadless ( source, false ) end end function outputHeadshotIcon (killer, weapon, bodypart) if bodypart == 9 then cancelEvent() exports.killmessages:outputMessage ( {getPlayerName(killer),{"padding",width=3},{"icon",id=weapon},{"padding",width=3},{"icon",id=256},{"padding",width=3},{"color",r=r1,g=g1,b=b1},getPlayerName(source) }, getRootElement(),r2,g2,b2) end end addEvent ( "onServerHeadshot", true ) addEventHandler( "onPlayerDamage", getRootElement(), MakePlayerHeadshot ) addEventHandler( "onPlayerKillMessage", getRootElement(), outputHeadshotIcon ) addEventHandler( "onServerHeadshot", getRootElement(), MakeHeadshot ) Client: function sendHeadshot ( attacker, weapon, bodypart, loss ) if attacker == getLocalPlayer() then if bodypart == 9 then triggerServerEvent( "onServerHeadshot", getRootElement(), source, attacker, weapon, loss ) setElementHealth ( source, 0 ) setPedHeadless( source, true ) end end end addEventHandler ( "onClientPedDamage", getRootElement(), sendHeadshot ) addEventHandler ( "onClientPlayerDamage", getRootElement(), sendHeadshot ) Link to comment
Jonas^ Posted May 21, 2019 Share Posted May 21, 2019 Tente verificar nessa função com a data do godmod. function sendHeadshot ( attacker, weapon, bodypart, loss ) if attacker == getLocalPlayer() then if bodypart == 9 then if getElementData (source, "invincible") then return end triggerServerEvent( "onServerHeadshot", getRootElement(), source, attacker, weapon, loss ) setElementHealth ( source, 0 ) setPedHeadless( source, true ) end end end addEventHandler ( "onClientPedDamage", getRootElement(), sendHeadshot ) addEventHandler ( "onClientPlayerDamage", getRootElement(), sendHeadshot ) 1 Link to comment
MR.Kingos Posted May 21, 2019 Author Share Posted May 21, 2019 11 minutes ago, Jonas^ said: Tente verificar nessa função com a data do godmod. function sendHeadshot ( attacker, weapon, bodypart, loss ) if attacker == getLocalPlayer() then if bodypart == 9 then if getElementData (source, "invincible") then return end triggerServerEvent( "onServerHeadshot", getRootElement(), source, attacker, weapon, loss ) setElementHealth ( source, 0 ) setPedHeadless( source, true ) end end end addEventHandler ( "onClientPedDamage", getRootElement(), sendHeadshot ) addEventHandler ( "onClientPlayerDamage", getRootElement(), sendHeadshot ) Opa deu certo, muito obrigado!!! Link to comment
Jonas^ Posted May 21, 2019 Share Posted May 21, 2019 Não esquece de deixar o like pra ajudar @MR.Kingos 1 Link to comment
MTA Anti-Cheat Team Dutchman101 Posted May 21, 2019 MTA Anti-Cheat Team Share Posted May 21, 2019 Muito ineficiente script.. Melhorado, mas faz o mesmo Headshot: addEvent "onPlayerHeadshot" addEventHandler("onPlayerDamage", getRootElement(), function (attacker, weapon, bodypart, loss) if getElementData(source, "invincible") then return end if bodypart == 9 then local result = triggerEvent("onPlayerHeadshot", source, attacker, weapon, loss) if result == true then killPed(source, attacker, weapon, bodypart) setPedHeadless(source, true) end end end ) addEventHandler("onPlayerSpawn", getRootElement(), function() if isPedHeadless(source) then setPedHeadless(source, false) end end ) Godmode server: function toggleGodMode(p) if not isPlayerStaff(p) then return end local state = not getElementData (p, "invincible") setElementData (p, "invincible", state) outputChatBox ("God Mode is now ".. (state and "Enabled" or "Disabled") ..".", p, 0, 255, 0) end addCommandHandler("god", toggleGodMode) local staffACLs = { aclGetGroup("Admin"), aclGetGroup("Console"), } function isPlayerStaff(p) local acc = getPlayerAccount(p) if not acc then return false end if isGuestAccount(acc) then return false end local object = getAccountName(acc) for _,group in ipairs(staffACLs) do if isObjectInACLGroup("user."..object,group) then return true end end return false end Godmode client (seu próprio código) addEventHandler ("onClientPlayerDamage", root, function () if getElementData(source, "invincible") then cancelEvent() end end) addEventHandler("onClientPlayerStealthKill", localPlayer, function (targetPlayer) if getElementData(targetPlayer, "invincible") then cancelEvent() end end) 2 Link to comment
MR.Kingos Posted May 22, 2019 Author Share Posted May 22, 2019 1 hour ago, Dutchman101 said: Muito ineficiente script.. Melhorado, mas faz o mesmo Headshot: addEvent "onPlayerHeadshot"addEventHandler("onPlayerDamage", getRootElement(), function (attacker, weapon, bodypart, loss) if getElementData(source, "invincible") then return end if bodypart == 9 then local result = triggerEvent("onPlayerHeadshot", source, attacker, weapon, loss) if result == true then killPed(source, attacker, weapon, bodypart) setPedHeadless(source, true) end end end)addEventHandler("onPlayerSpawn", getRootElement(), function() if isPedHeadless(source) then setPedHeadless(source, false) end end) Godmode server: function toggleGodMode(p)if not isPlayerStaff(p) then return end local state = not getElementData (p, "invincible") setElementData (p, "invincible", state) outputChatBox ("God Mode is now ".. (state and "Enabled" or "Disabled") ..".", p, 0, 255, 0)endaddCommandHandler("god", toggleGodMode)local staffACLs ={ aclGetGroup("Admin"), aclGetGroup("Console"),}function isPlayerStaff(p) local acc = getPlayerAccount(p) if not acc then return false end if isGuestAccount(acc) then return false end local object = getAccountName(acc) for _,group in ipairs(staffACLs) do if isObjectInACLGroup("user."..object,group) then return true end end return falseend Godmode client (seu próprio código) addEventHandler ("onClientPlayerDamage", root,function () if getElementData(source, "invincible") then cancelEvent() endend)addEventHandler("onClientPlayerStealthKill", localPlayer,function (targetPlayer) if getElementData(targetPlayer, "invincible") then cancelEvent() endend) Link to comment
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