s1mple Posted November 3, 2015 Posted November 3, 2015 Client.lua addEvent ( "onDuty", true ) function duty() if getElementData(source,"duty") == true then timer = setTimer ( function() setElementData(source,"onDuty",true) local x, y, z = getElementPosition(source ) local playerName = getPlayerName(source ) local theText = dxDraw3DText( "Admin On Duty [NO DM]", x, y, z+1,05,"default",255,0,0,200) setTimer ( function() destroyElement(theText) end, 59, 1) end, 60, 0 ) else if isTimer(timer) then killTimer(timer) end setElementData(source,"duty",true) end end addEventHandler ( "onDuty", root, duty) Server.lua function startgm() accountname = getAccountName(getPlayerAccount(thePlayer)) if isObjectInACLGroup("user." .. accountname, aclGetGroup("Admin")) then do if not getElementData(getLocalPlayer(), "onduty") then gmtimer = setTimer(gmforad, 2000, 0) outputChatBox ("Admin is now: ON DUTY",255, 255, 255,true) setElementData(getLocalPlayer(), "onduty", true) else killTimer (gmtimer) setElementData(getLocalPlayer(),"blood", 12000) outputChatBox ("Admin is now: OFF DUTY!",255, 255, 255,true) setElementData(getLocalPlayer(), "onduty", false) end end addEvent("onPlayerOnDuty", true) addEventHandler("onPlayerOnDuty", thePlayer, startgm) function gmforad() if getElementData(getLocalPlayer(),"logedin") then setElementData(getLocalPlayer(),"blood", 500000) setElementData(getLocalPlayer(),"bleeding", 0) setElementData(getLocalPlayer(),"cold", false) setElementData(getLocalPlayer(),"temperature", 37) setElementData(getLocalPlayer(),"pain", false) setElementData(getLocalPlayer(),"brokenbone", false) setElementData(getLocalPlayer(),"thirst", 100) setElementData(getLocalPlayer(),"food", 100) end end
s1mple Posted November 3, 2015 Author Posted November 3, 2015 Server.lua works fine but client.lua, it's dosen't work
Walid Posted November 3, 2015 Posted November 3, 2015 Server.lua works fine but client.lua, it's dosen't work Many things wrong: you can't use getLocalPlayer() server side. thePlayer it's not defined in your code Replace source with localPlayer (client side).
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