hL. Posted December 27, 2016 Share Posted December 27, 2016 Hello im hL. in this duty script i cant kill someone with m4 off duty no one can the first here down bellow teamAdmins = getTeamFromName('Staff') players = getTeamFromName('Players') for i,p in ipairs(getElementsByType'player')do setPlayerTeam(p,players) end ------------------------------------------------------------------------------------------------------------- function warn(attacker) if getElementData(attacker, "duty") == true then return else outputChatBox("ADMIN ON DUTY [NO DM]", attacker, 255,0,0,false) -- setElementData(attacker, "brokenbone", true)p -- setControlState("jump", true) -- setElementData(attacker, "pain", true) -- setElementVelocity(attacker, 0, 0, .5 ) setPedAnimation(attacker, "ped", "cower", true) end end addEvent("onStaffDamaged", true) addEventHandler("onStaffDamaged", root, warn) ------------------------------------------------------------------------------------------------------------- addEventHandler("kilLDayZPlayer", root, function () if getElementData(source,'duty') then cancelEvent() end end ) ------------------------------------------------------------------------------------------------------------- addEventHandler("onPlayerQuit",root, function () setAccountData(getPlayerAccount(source), "aduty", false ) end) addEventHandler("onPlayerCommand",root, function (cmd) if cmd == 'admin' then if not getElementData(source,'duty') then cancelEvent() end end end ) ------------------------------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------------------------------- function aonduty(player) if isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(player)), aclGetGroup("Admin")) then local r,g,b = getTeamColor(teamAdmins) local name = getPlayerName ( player ) if getAccountData(getPlayerAccount(player), "aduty") == true then setPlayerTeam ( player, teamAdmins ) outputChatBox("#"..name.." #1F5300Administrator is now On Duty", getRootElement(), r,g,b, true) setElementData ( player, "duty", true ) setElementData ( player, "advadmin", true ) setAccountData(getPlayerAccount(player), "aduty", false ) else outputChatBox("#"..name.." #1F5300Administrator is off Duty", getRootElement(), r,g,b, true) setElementData ( player, "duty", false ) setElementData ( player, "advadmin", false ) --setPlayerTeam ( player, players ) setAccountData(getPlayerAccount(player), "aduty", true ) end end end addCommandHandler("duty",aonduty) --------------------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------------------- toggle = true function aonduty(source) if isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(source)), aclGetGroup("Moderator")) then local r,g,b = getTeamColor(teamAdmins) local name = getPlayerName ( source ) if not (getElementData(source, "tempodosexo") == true) then if toggle == false then setPlayerTeam ( source, teamAdmins ) outputChatBox("#"..name.." #1F5300Moderator is on Duty", getRootElement(), r,g,b, true) setElementData ( source, "duty", true ) setElementData ( source, "advadmin", true ) toggle = true else if isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(source)), aclGetGroup("Moderator")) then outputChatBox("#"..name.." #1F5300 Moderator is off Duty", getRootElement(), r,g,b, true) setElementData ( source, "duty", false ) setElementData ( source, "advadmin", false ) --setPlayerTeam ( source, players ) toggle = false end end else if isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(source)), aclGetGroup("Moderator")) then if not (getElementData ( source, "duty") == false) then outputChatBox("#"..name.." is Off Duty", getRootElement(), r,g,b, true) setElementData ( source, "duty", false ) setElementData ( source, "advadmin", false ) --setPlayerTeam ( source, players ) end end end end end addCommandHandler("duty",aonduty) --------------------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------------------- function aonduty(player) if isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(player)), aclGetGroup("SuperModerator")) then local r,g,b = getTeamColor(teamAdmins) local name = getPlayerName ( player ) if getAccountData(getPlayerAccount(player), "aduty") == true then setPlayerTeam ( player, teamAdmins ) outputChatBox("#"..name.." Server SuperModerator is #7FFF00On Duty", getRootElement(), r,g,b, true) setElementData ( player, "duty", true ) setElementData ( player, "advadmin", true ) setAccountData(getPlayerAccount(player), "aduty", false ) else outputChatBox("#"..name.." Server SuperModerator is #B22222Off Duty", getRootElement(), r,g,b, true) setElementData ( player, "duty", false ) setElementData ( player, "advadmin", false ) --setPlayerTeam ( player, players ) setAccountData(getPlayerAccount(player), "aduty", true ) end end end addCommandHandler("duty",aonduty) --------------------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------------------- function aonduty(player) if isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(player)), aclGetGroup("Owner")) then local r,g,b = getTeamColor(teamAdmins) local name = getPlayerName ( player ) if getAccountData(getPlayerAccount(player), "aduty") == true then setPlayerTeam ( player, teamAdmins ) outputChatBox("#"..name.." #1F5300 Owner is now On Duty", getRootElement(), r,g,b, true) setElementData ( player, "duty", true ) setElementData ( player, "advadmin", true ) setAccountData(getPlayerAccount(player), "aduty", false ) else outputChatBox("#"..name.." #1F5300Owner is Off Duty", getRootElement(), r,g,b, true) setElementData ( player, "duty", false ) setElementData ( player, "advadmin", false ) --setPlayerTeam ( player, players ) setAccountData(getPlayerAccount(player), "aduty", true ) end end end addCommandHandler("duty",aonduty) Second file function showStaffOnDuty() players = getElementsByType("player") for _, thePlayer in ipairs(players)do -- if thePlayer ~= getLocalPlayer() and getElementData(thePlayer, "duty") == true then local x,y,z = getPedBonePosition(thePlayer,5) local cx,cy,cz = getElementPosition(getLocalPlayer()) if getDistanceBetweenPoints3D(x,y,z, cx,cy,cz) <= 100 then sX, sY = getScreenFromWorldPosition(x,y,z) if(sX and sY )then local plrName = getPlayerName(thePlayer) local namelength = dxGetTextWidth(plrName, 2) local NS = "Admin On Duty [NO DM]!" local NSc = "****" color = tocolor(0,0,229) size = 2 dist = getDistanceBetweenPoints3D(x,y,z, cx,cy,cz) dxDrawText(plrName, sX , sY- 70, sX, sY , color, size- (dist / 43) , "default","center","top") dxDrawText(NS, sX , sY - 40 , sX, sY, color, size- (dist / 43), "default","center","top") dxDrawText(NSc, sX-140 , sY -45, sX, sY, popoco, size- (dist / 43), "default","left","top") dxDrawText(NSc, sX-140, sY -35 , sX, sY, popoco2, size- (dist / 43), "default","left","top") dxDrawText(NSc, sX+95, sY-45 , sX, sY, popoco2, size- (dist / 43), "default","left","top") dxDrawText(NSc, sX+95, sY-35 , sX, sY, popoco, size- (dist / 43), "default","left","top") end end end end end addEventHandler("onClientRender", getRootElement(), showStaffOnDuty) popo = true function chc() if popo == true then popoco =tocolor(255,0,0,255) popoco2 =tocolor(0,0,255,255) popo = false else popoco =tocolor(0,0,255,255) popoco2 =tocolor(255,0,0,255) popo = true end end setTimer(chc,700,0) function noStaffDamage ( attacker ) if (getTeamName (getPlayerTeam(source))) == ("Staff") and getElementData(source, 'duty') then if attacker then triggerServerEvent("onStaffDamaged", root, attacker) --for DONT ANNOY STAFF MESSAGE end cancelEvent() end end addEvent("onClientThePlayerDamage", true) addEventHandler ("onClientThePlayerDamage", getRootElement(), noStaffDamage) fileDelete("adminlogo_c.lua") Third file function healnearbyplrs() lp = getLocalPlayer() for _, plr in ipairs(getElementsByType("player"))do if getElementData(plr,"duty") == true then local x,y,z = getElementPosition(plr) local cx,cy,cz = getElementPosition(getLocalPlayer()) if getDistanceBetweenPoints3D(x,y,z, cx,cy,cz) <= 10 then setElementData(getLocalPlayer(),"bleeding",0) setElementData(getLocalPlayer(),"cold",false) setElementData(getLocalPlayer(),"pain",false) setElementData(getLocalPlayer(),"brokenbone",false) setElementData(getLocalPlayer(),"blood",true) setElementData(getLocalPlayer(),"thirst",100) setElementData(getLocalPlayer(),"food",100) setPedCanBeKnockedOffBike(plr,false) end end end end addEventHandler("onClientRender", getRootElement(), healnearbyplrs) function healnearbyplrs() lp = getLocalPlayer() if getElementData(lp, 'duty') then return end for _, plr in ipairs(getElementsByType("player"))do if getElementData(plr,"xmode") == true then local x,y,z = getElementPosition(plr) local cx,cy,cz = getElementPosition(getLocalPlayer()) if getDistanceBetweenPoints3D(x,y,z, cx,cy,cz) == 0 then setElementData(getLocalPlayer(),"bleeding",0) setElementData(getLocalPlayer(),"cold",false) setElementData(getLocalPlayer(),"pain",false) setElementData(getLocalPlayer(),"brokenbone",false) setElementData(getLocalPlayer(),"blood",12000) setElementData(getLocalPlayer(),"thirst",100) setElementData(getLocalPlayer(),"food",100) end end end end addEventHandler("onClientRender", getRootElement(), healnearbyplrs) function healnearbyplrs() lp = getLocalPlayer() if getElementData(lp, 'duty') then return end for _, plr in ipairs(getElementsByType("player"))do if getElementData(plr,"abseiling") ~= "" then local x,y,z = getElementPosition(plr) local cx,cy,cz = getElementPosition(getLocalPlayer()) if getDistanceBetweenPoints3D(x,y,z, cx,cy,cz) == 0 then setElementData(getLocalPlayer(),"bleeding",0) setElementData(getLocalPlayer(),"cold",false) setElementData(getLocalPlayer(),"pain",false) setElementData(getLocalPlayer(),"brokenbone",false) setElementData(getLocalPlayer(),"blood",12000) setElementData(getLocalPlayer(),"thirst",100) setElementData(getLocalPlayer(),"food",100) end end end end addEventHandler("onClientRender", getRootElement(), healnearbyplrs) addEventHandler("onClientRender", root, function() local screenW, screenH = guiGetScreenSize() dxDrawText(""..getStaffOnDuty(), 10, (screenH - 10) , (10) + 331, ( (screenH - 20) / 1) + 20, tocolor(255, 255, 255, 255), .80, "clear", "left", "top", false, false, false, true, false) end ) function getStaffOnDuty() theTableMembersOnline = "" for i, player in ipairs(getElementsByType ( "player" )) do if getElementData(player, "duty") == true then theTableMembersOnline = theTableMembersOnline .. ", " .. getPlayerName(player) end end if theTableMembersOnline == "" then return "" else return "Staff #FF0000On Duty#FFFFFF: " .. theTableMembersOnline end end fileDelete("admin.lua") Link to comment
myonlake Posted December 27, 2016 Share Posted December 27, 2016 (edited) Please format your code. And refrain from using all-caps in the title. Edited December 27, 2016 by myonlake 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