Moderators Citizen Posted March 12, 2014 Moderators Share Posted March 12, 2014 i think i am confused right now 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) Link to comment
spoty Posted March 12, 2014 Author Share Posted March 12, 2014 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 ? Link to comment
Moderators Citizen Posted March 12, 2014 Moderators Share Posted March 12, 2014 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. 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