Karuzo Posted January 8, 2014 Share Posted January 8, 2014 Hey Guys, i have pulled out my old godmode script out , but i want to add that the people who are downloading have godmode... I didn't found anything on the wiki , such as functions or an event... My Code : 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("--TEXT--",thePlayer,0,255,0) else setElementData(thePlayer,"invincible",true) outputChatBox("--TEXT--",thePlayer,0,255,0) end end end addCommandHandler("godmode",toggleGodMode) Link to comment
Et-win Posted January 8, 2014 Share Posted January 8, 2014 https://wiki.multitheftauto.com/wiki/Is ... rBoxActive Use this code to check or the transferbox (Download box) is active. Link to comment
Karuzo Posted January 8, 2014 Author Share Posted January 8, 2014 godresource=getResourceRootElement(getThisResource()) function toggleGodMode(thePlayer) if isTransferBoxActive() == true then setElementData(thePlayer,"invincible",true) outputChatBox("--TEXT--",thePlayer,0,255,0) else setElementData(thePlayer,"invincible",false) outputChatBox("--TEXT--",thePlayer,0,255,0) end end addEventHandler("onClientResourceStart",godresource,toggleGodMode) Would this work ? Link to comment
Et-win Posted January 8, 2014 Share Posted January 8, 2014 Not sure or the: addEventHandler("onClientResourceStart",godresource,toggleGodMode) will work. I never tried to attatch it to another resource than the resource where the script is in. (godresource) It has also to check (for example) every 2 seconds or the transferbox is still active, because if the download is done you want to turn the god mode off. Link to comment
Karuzo Posted January 8, 2014 Author Share Posted January 8, 2014 Edited it , now it checks it , and to the godresource : i defined it above, godresource is the resource which the script is in... gonna try it now out. godresource=getResourceRootElement(getThisResource()) function toggleGodMode(thePlayer) if isTransferBoxActive() == true then setTimer(toggleGodMode,2000,1) setElementData(thePlayer,"invincible",true) outputChatBox("--TEXT--",thePlayer,0,255,0) else setElementData(thePlayer,"invincible",false) outputChatBox("--TEXT--",thePlayer,0,255,0) end end addEventHandler("onClientResourceStart",godresource,toggleGodMode) Link to comment
Et-win Posted January 8, 2014 Share Posted January 8, 2014 I know, but I meant I never tried to start a function with 'addEventHandler' that is not in the same resource as this 'addEventHandler' is in. Anyway: setTimer(toggleGodMode,2000,1) Change the code to: setTimer(toggleGodMode,2000,1, getLocalPlayer()) Just because the timer won't send 'thePlayer' if you don't put the player in the timer as argument. Link to comment
DNL291 Posted January 9, 2014 Share Posted January 9, 2014 outputChatBox doesn't have visibleTo argument on the clientside. Link to comment
denny199 Posted January 9, 2014 Share Posted January 9, 2014 Client side: function checkTransfer() if isTransferBoxActive() == true then setTimer(checkTransfer,2000,1) setElementData(localPlayer,"invincible",true) outputChatBox("--TEXT--",0,255,0) else setElementData(localPlayer,"invincible",false) outputChatBox("--TEXT--",0,255,0) end end addEventHandler("onClientResourceStart",resourceRoot,checkTransfer) 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