zombienation Posted January 1, 2012 Posted January 1, 2012 hello, i'd like to know how to make it able for admins not to die, does anybody have a resource or script for this? thank you ps: i know i've bin asking much on this forum, but soon when i finnish some mission scripts i will upload them on mta community
FatalTerror Posted January 1, 2012 Posted January 1, 2012 Hi, I don't know if someone have allready made this script. But i think you can made it youself Example, when the player are domaged, we check if is an admin and if it's an admin, we cancel the event. So he are not domaged I think it work... addEventHandler ( "onPlayerDamage", getRootElement (), function(attacker, weapon, bodypart, loss) local accName = getAccountName ( getPlayerAccount ( source ) ) -- get his account name if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then cancelEvent() end end
TAPL Posted January 1, 2012 Posted January 1, 2012 Hi,I don't know if someone have allready made this script. But i think you can made it youself Example, when the player are domaged, we check if is an admin and if it's an admin, we cancel the event. So he are not domaged I think it work... addEventHandler ( "onPlayerDamage", getRootElement (), function(attacker, weapon, bodypart, loss) local accName = getAccountName ( getPlayerAccount ( source ) ) -- get his account name if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then cancelEvent() end end no it's not work, the event can't be canceled. https://wiki.multitheftauto.com/wiki/OnPlayerDamage It should also be noted that canceling this event has no effect. Cancel the client-side event onClientPlayerDamage instead.
Mefisto_PL Posted January 1, 2012 Posted January 1, 2012 @UP Hmm You think that's working? addEventHandler ( "onClientPlayerDamage", getRootElement (), function(attacker, weapon, bodypart, loss) local accName = getAccountName ( getPlayerAccount ( source ) ) -- get his account name if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then cancelEvent() end end
GanJaRuleZ Posted January 1, 2012 Posted January 1, 2012 addEventHandler ( "onPlayerDamage", getRootElement (), function(attacker, weapon, bodypart, loss) local thePlayer = getPlayerName ( thePlayer ) local accName = getAccountName ( getPlayerAccount ( source ) ) -- get his account name if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then setElementHealth ( thePlayer , 100 ) end end You can instead set his health to 100...
TAPL Posted January 1, 2012 Posted January 1, 2012 @UPHmm You think that's working? addEventHandler ( "onClientPlayerDamage", getRootElement (), function(attacker, weapon, bodypart, loss) local accName = getAccountName ( getPlayerAccount ( source ) ) -- get his account name if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then cancelEvent() end end No, because the functions: getAccountName getPlayerAccount isObjectInACLGroup aclGetGroup is server-side, and the event 'onClientPlayerDamage' is Client-side
Mefisto_PL Posted January 1, 2012 Posted January 1, 2012 Hmm I have suggestion. Make only onClientPlayerDamage, cancelEvent and command. Next add to acl group Admin <right name="command.godmode" access="true"></right>
bandi94 Posted January 1, 2012 Posted January 1, 2012 server side function admin () local accName = getAccountName ( getPlayerAccount ( source ) ) -- get his account name if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then setElementData(source,"admin",true) end end addEventHandler("onPlayerLogin",resourceRoot,admin) client side addEventHandler ( "onClientPlayerDamage", getRootElement (), function(attacker, weapon, bodypart, loss) if getElementData(source,"admin") then cancelEvent() end end)
FatalTerror Posted January 1, 2012 Posted January 1, 2012 server side function admin () local accName = getAccountName ( getPlayerAccount ( source ) ) -- get his account name if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then setElementData(source,"admin",true) end end addEventHandler("onPlayerLogin",resourceRoot,admin) client side addEventHandler ( "onClientPlayerDamage", getRootElement (), function(attacker, weapon, bodypart, loss) if getElementData(source,"admin") then cancelEvent() end end) Fuccckin pro o_O
Mefisto_PL Posted January 1, 2012 Posted January 1, 2012 Yeah it's cool, but can you add command to toggle it please? :
FatalTerror Posted January 1, 2012 Posted January 1, 2012 Yeah it's cool, but can you add command to toggle it please? :< addCommandHandler("godoff", function() if (getElementData(source, "admin") == true) then setElementData(source, "admin", false) end end)
Castillo Posted January 1, 2012 Posted January 1, 2012 -- server side: 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 ( "Admin" ) ) ) then if getElementData(thePlayer,"invincible") then setElementData(thePlayer,"invincible",false) outputChatBox("God Mode is now Disabled.",thePlayer,0,255,0) else setElementData(thePlayer,"invincible",true) outputChatBox("God Mode is now Enabled.",thePlayer,0,255,0) end end end addCommandHandler("godmode",toggleGodMode) -- client side: 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)
FatalTerror Posted January 1, 2012 Posted January 1, 2012 -- server side: 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 ( "Admin" ) ) ) then if getElementData(thePlayer,"invincible") then setElementData(thePlayer,"invincible",false) outputChatBox("God Mode is now Disabled.",thePlayer,0,255,0) else setElementData(thePlayer,"invincible",true) outputChatBox("God Mode is now Enabled.",thePlayer,0,255,0) end end end addCommandHandler("godmode",toggleGodMode) -- client side: 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) Castillo comes and fucck everybody Great
Mefisto_PL Posted January 1, 2012 Posted January 1, 2012 How can I add rights to use this commands? ;x I want to add Admin and HeadAdmin
zombienation Posted January 1, 2012 Author Posted January 1, 2012 wow thx mate i created the meta, server and client files, gonna test it now
zombienation Posted January 17, 2012 Author Posted January 17, 2012 hey, i have added a part for godmode for moderators in it original /godmode command for admins is still the same command for moderators is /god here is server script thx again solidsnake 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 ( "Admin" ) ) ) then if getElementData(thePlayer,"invincible") then setElementData(thePlayer,"invincible",false) outputChatBox("God Mode is now Disabled.",thePlayer,0,255,0) else setElementData(thePlayer,"invincible",true) outputChatBox("God Mode is now Enabled.",thePlayer,0,255,0) end end end addCommandHandler("godmode",toggleGodMode) 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 ( "Moderator" ) ) ) then if getElementData(thePlayer,"invincible") then setElementData(thePlayer,"invincible",false) outputChatBox("God Mode is now Disabled.",thePlayer,0,255,0) else setElementData(thePlayer,"invincible",true) outputChatBox("God Mode is now Enabled.",thePlayer,0,255,0) end end end addCommandHandler("god",toggleGodMode)
12p Posted January 17, 2012 Posted January 17, 2012 Very messed, lemme help. 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 ( "Admin" ) ) or isObjectInACLGroup ( "user.".. accountName, aclGetGroup ( "Moderator" ) ) then setElementData(thePlayer,"invincible",not getElementData(thePlayer,"invincible")) if getElementData(thePlayer,"invincible") then outputChatBox("God Mode is now Disabled.",thePlayer,0,255,0) else outputChatBox("God Mode is now Enabled.",thePlayer,0,255,0) end end addCommandHandler("godmode",toggleGodMode) addCommandHandler("god",toggleGodMode)
zombienation Posted January 17, 2012 Author Posted January 17, 2012 Very messed, lemme help. 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 ( "Admin" ) ) or isObjectInACLGroup ( "user.".. accountName, aclGetGroup ( "Moderator" ) ) then setElementData(thePlayer,"invincible",not getElementData(thePlayer,"invincible")) if getElementData(thePlayer,"invincible") then outputChatBox("God Mode is now Disabled.",thePlayer,0,255,0) else outputChatBox("God Mode is now Enabled.",thePlayer,0,255,0) end end addCommandHandler("godmode",toggleGodMode) addCommandHandler("god",toggleGodMode) ah thx i tried it first to make it work without making the codes double, but here it is now
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