Jump to content

FIXED


spoty

Recommended Posts

  • Moderators
Posted
i think i am confused right now :S

so i only need to use

--client 
addCommandHandler("afk", 
  function () 
    setElementPosition(localPlayer, 1904.8403320313, 717.12438964844, 49.214366912842) 
    outputChatBox( "You are now in Afk zone", localPlayer, 0, 255, 0 ) 
    setElementData(localPlayer, "afk.godmode", true) 
    setElementData(localPlayer, "afk.withinZone", true) 
    triggerServerEvent("afk.takeWeps", localPlayer) 
  end 
) 
  
function onHit(plr) 
    if (plr and isElement(plr) and getElementType(plr) == "player") then 
        if (getElementData(plr, "afk.godmode") == true) then 
            cancelEvent() 
        end 
    end 
end 
addEventHandler("onClientPlayerDamage", root, onHit) 

and

--server 
function onHit() 
    if (source and isElement(source) and getElementType(source) == "player") then 
        if (getElementData(source, "afk.godmode") == true) then 
            cancelEvent() 
        end 
    end 
end 
addEventHandler("onClientPlayerDamage", root, onHit) 

Come on, don't make you look more stupid that you are (sorry if it's mean, but I wrote you EXACTLY what you had to do):

(Took the code of WhoAmI but replaced the onHit function by mine)

Server:

addCommandHandler("afk", 
    function () 
        setElementPosition(localPlayer, 1904.8403320313, 717.12438964844, 49.214366912842) 
        outputChatBox( "You are now in Afk zone", localPlayer, 0, 255, 0 ) 
        setElementData(localPlayer, "afk.godmode", true) 
        setElementData(localPlayer, "afk.withinZone", true) 
        triggerServerEvent("afk.takeWeps", localPlayer) 
    end 
) 
  
function onHit() 
    if (source and isElement(source) and getElementType(source) == "player") then 
        if (getElementData(source, "afk.godmode") == true) then 
            cancelEvent() 
        end 
    end 
end 
addEventHandler("onClientPlayerDamage", root, onHit) 

Client:

function takeWeps() 
    takeAllWeapons(source) 
end 
addEvent("afk.takeWeps", true) 
addEventHandler("afk.takeWeps", root, takeWeps) 

The rEvolution is coming ...

Posted
Come on, don't make you look more stupid that you are (sorry if it's mean, but I wrote you EXACTLY what you had to do):

(Took the code of WhoAmI but replaced the onHit function by mine)

Server:

addCommandHandler("afk", 
    function () 
        setElementPosition(localPlayer, 1904.8403320313, 717.12438964844, 49.214366912842) 
        outputChatBox( "You are now in Afk zone", localPlayer, 0, 255, 0 ) 
        setElementData(localPlayer, "afk.godmode", true) 
        setElementData(localPlayer, "afk.withinZone", true) 
        triggerServerEvent("afk.takeWeps", localPlayer) 
    end 
) 
  
function onHit() 
    if (source and isElement(source) and getElementType(source) == "player") then 
        if (getElementData(source, "afk.godmode") == true) then 
            cancelEvent() 
        end 
    end 
end 
addEventHandler("onClientPlayerDamage", root, onHit) 

Client:

function takeWeps() 
    takeAllWeapons(source) 
end 
addEvent("afk.takeWeps", true) 
addEventHandler("afk.takeWeps", root, takeWeps) 

okay it works but is there a option to add in the script like

if player enters afk it dissable the F1 panel

and when player do /back its enabled again and same for /wp ?

n-560x95_FFFFFF_FFFFFF_000000_000000.png
  • Moderators
Posted

edit the scripts to add this as the 1st instruction of the right functions:

if not getElementData( player, "afk.withinZone" ) then return end 

but be sure to replace player by the right variable.

The rEvolution is coming ...

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...