Jump to content

Help please


Recommended Posts

Posted

When i run the script, it is not working and i can't close the Admin Panel

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",2400000) 
                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",25000) 
                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 

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 =          "NO SHOOTING!" 
                    local NSc =         "••••" 
                color = tocolor(getPlayerNametagColor(thePlayer)) 
                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("onClientPlayerDamage", true) 
addEventHandler ("onClientPlayerDamage", getRootElement(), noStaffDamage) 

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("PLEASE REFRAIN FROM ANNOYING THE STAFF ON DUTY!", 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.." is now #00FF00On Duty", getRootElement(), r,g,b, true) 
            setElementData ( player, "duty", true ) 
            setElementData ( player, "advadmin", true ) 
            setAccountData(getPlayerAccount(player), "aduty", false ) 
    else 
        --outputChatBox("#"..name.." 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.." is now #00FF00On Duty", getRootElement(), r,g,b, true) 
            setElementData ( source, "duty", true ) 
        toggle = true 
    else 
    if isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(source)), aclGetGroup("Moderator")) then 
        outputChatBox("#"..name.." is Off Duty", getRootElement(), r,g,b, true) 
        setElementData ( source, "duty", 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 ) 
        --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.." is now #00FF00On Duty", getRootElement(), r,g,b, true) 
            setElementData ( player, "duty", true ) 
            setElementData ( player, "advadmin", true ) 
            setAccountData(getPlayerAccount(player), "aduty", false ) 
    else 
        outputChatBox("#"..name.." 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) 

Posted
nothing

only warnings

lol what are you waiting for post warnings here.

Do not yield your back to your enemy, might feel something strange in your ass.

Two things are infinite the universe and human stupidity and i'm not sure about the universe.

UF: IsTextInGridList | GetGridListRowIndexFromText | Table.removeValue | removeHex | dxDrawTriangle

Skype: SaSuki102 | About Me | Youtube channel | Lua Tips & Tricks | Lua Strings | Lua Tables | Lua Operators

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...