Jullul7000 Posted January 27, 2013 Share Posted January 27, 2013 Hey guys, If got this script: local allowedGroups = {"Admin", "Moderator"} addEventHandler("onPlayerDamage", getRootElement(), function(attacker, weapon, bodypart, loss) if getElementData(source, "staff.active") == 1 then if loss then setElementHealth(source,200) end end end ) addEventHandler("onPlayerQuit", getRootElement(), function() removeElementData(source, "staff.active") removeElementData(source, "staff.skin") removeElementData(source, "staff.tagcolor.red") removeElementData(source, "staff.tagcolor.green") removeElementData(source, "staff.tagcolor.blue") removeElementData(source, "Staff") end ) addCommandHandler("staff", function(player) local data = getElementData(player, "staff.active") local check = 0 local r = getElementData(player, "staff.tagcolor.red") local g = getElementData(player, "staff.tagcolor.green") local b = getElementData(player, "staff.tagcolor.blue") for i, v in ipairs(allowedGroups) do if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(player)), aclGetGroup(v)) then if data == 0 or data == false then red, green, blue = getPlayerNametagColor(player) setElementData(player, "staff.skin", getElementModel(player)) setElementData(player, "staff.tagcolor.red", red) setElementData(player, "staff.tagcolor.green", green) setElementData(player, "staff.tagcolor.blue", blue) setElementModel(player, 217) setPlayerTeam ( player, getTeamFromName ( "Staff" ) ) setPlayerNametagColor(player, 150, 155, 255) outputChatBox("#9900FF[sTAFF] #FFFFFFYou have enabled staffmode! Don't abuse your godlike powers.", player, 255, 255, 255, true) setElementData(player, "staff.active", 1) return elseif data == 1 then setElementModel(player, getElementData(player, "staff.skin")) setPlayerNametagColor(player, r, g, b) outputChatBox("#9900FF[sTAFF] #FFFFFFYou have disabled staffmode!", player, 255, 255, 255, true) setElementData(player, "staff.active", 0) return end elseif isGuestAccount(getPlayerAccount(player)) and data ~= 0 then outputChatBox("#9900FF[sTAFF] #FFFFFFYou need to be logged in to perform this command!", player, 255, 255, 255, true) return elseif not isObjectInACLGroup("user."..getAccountName(getPlayerAccount(player)), aclGetGroup(v)) and #allowedGroups == i then outputChatBox("#9900FF[sTAFF] #FFFFFFYou lack the rights to use this command!", player, 255, 255, 255, true) end end end ) When i do /staff . i will replaced to staff team. but i want when i type again /staff i will removed from staff team. How can i fix this? SORRY BAD ENGLISH Link to comment
Lloyd Logan Posted January 27, 2013 Share Posted January 27, 2013 Hey guys,If got this script: local allowedGroups = {"Admin", "Moderator"} addEventHandler("onPlayerDamage", getRootElement(), function(attacker, weapon, bodypart, loss) if getElementData(source, "staff.active") == 1 then if loss then setElementHealth(source,200) end end end ) addEventHandler("onPlayerQuit", getRootElement(), function() removeElementData(source, "staff.active") removeElementData(source, "staff.skin") removeElementData(source, "staff.tagcolor.red") removeElementData(source, "staff.tagcolor.green") removeElementData(source, "staff.tagcolor.blue") removeElementData(source, "Staff") end ) addCommandHandler("staff", function(player) local data = getElementData(player, "staff.active") local check = 0 local r = getElementData(player, "staff.tagcolor.red") local g = getElementData(player, "staff.tagcolor.green") local b = getElementData(player, "staff.tagcolor.blue") for i, v in ipairs(allowedGroups) do if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(player)), aclGetGroup(v)) then if data == 0 or data == false then red, green, blue = getPlayerNametagColor(player) setElementData(player, "staff.skin", getElementModel(player)) setElementData(player, "staff.tagcolor.red", red) setElementData(player, "staff.tagcolor.green", green) setElementData(player, "staff.tagcolor.blue", blue) setElementModel(player, 217) setPlayerTeam ( player, getTeamFromName ( "Staff" ) ) setPlayerNametagColor(player, 150, 155, 255) outputChatBox("#9900FF[sTAFF] #FFFFFFYou have enabled staffmode! Don't abuse your godlike powers.", player, 255, 255, 255, true) setElementData(player, "staff.active", 1) return elseif data == 1 then setElementModel(player, getElementData(player, "staff.skin")) setPlayerNametagColor(player, r, g, b) outputChatBox("#9900FF[sTAFF] #FFFFFFYou have disabled staffmode!", player, 255, 255, 255, true) setElementData(player, "staff.active", 0) return end elseif isGuestAccount(getPlayerAccount(player)) and data ~= 0 then outputChatBox("#9900FF[sTAFF] #FFFFFFYou need to be logged in to perform this command!", player, 255, 255, 255, true) return elseif not isObjectInACLGroup("user."..getAccountName(getPlayerAccount(player)), aclGetGroup(v)) and #allowedGroups == i then outputChatBox("#9900FF[sTAFF] #FFFFFFYou lack the rights to use this command!", player, 255, 255, 255, true) end end end ) When i do /staff . i will replaced to staff team. but i want when i type again /staff i will removed from staff team. How can i fix this? SORRY BAD ENGLISH What do you wan't to happen when you type /staff for the second time? You're not making much sense. Link to comment
Perfect Posted January 27, 2013 Share Posted January 27, 2013 Try this: local allowedGroups = {"Admin", "Moderator"} addEventHandler("onPlayerDamage", getRootElement(), function(attacker, weapon, bodypart, loss) if getElementData(source, "staff.active") == 1 then if loss then setElementHealth(source,200) end end end ) addEventHandler("onPlayerQuit", getRootElement(), function() removeElementData(source, "staff.active") removeElementData(source, "staff.skin") removeElementData(source, "staff.tagcolor.red") removeElementData(source, "staff.tagcolor.green") removeElementData(source, "staff.tagcolor.blue") removeElementData(source, "Staff") end ) addCommandHandler("staff", function(player) local data = getElementData(player, "staff.active") local check = 0 local r = getElementData(player, "staff.tagcolor.red") local g = getElementData(player, "staff.tagcolor.green") local b = getElementData(player, "staff.tagcolor.blue") for i, v in ipairs(allowedGroups) do if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(player)), aclGetGroup(v)) then if data == 0 or data == false then red, green, blue = getPlayerNametagColor(player) setElementData(player, "staff.skin", getElementModel(player)) setElementData(player, "staff.tagcolor.red", red) setElementData(player, "staff.tagcolor.green", green) setElementData(player, "staff.tagcolor.blue", blue) setElementModel(player, 217) setPlayerTeam ( player, getTeamFromName ( "Staff" ) ) setPlayerNametagColor(player, 150, 155, 255) outputChatBox("#9900FF[sTAFF] #FFFFFFYou have enabled staffmode! Don't abuse your godlike powers.", player, 255, 255, 255, true) setElementData(player, "staff.active", 1) return elseif data == 1 then setElementModel(player, getElementData(player, "staff.skin")) setPlayerNametagColor(player, r, g, b) outputChatBox("#9900FF[sTAFF] #FFFFFFYou have disabled staffmode!", player, 255, 255, 255, true) setElementData(player, "staff.active", 0) return end elseif isGuestAccount(getPlayerAccount(player)) and data ~= 0 then outputChatBox("#9900FF[sTAFF] #FFFFFFYou need to be logged in to perform this command!", player, 255, 255, 255, true) return elseif not isObjectInACLGroup("user."..getAccountName(getPlayerAccount(player)), aclGetGroup(v)) and #allowedGroups == i then outputChatBox("#9900FF[sTAFF] #FFFFFFYou lack the rights to use this command!", player, 255, 255, 255, true) end elseif ( getPlayerTeam ( player ) == "Staff" ) then setPlayerTeam ( player, nil ) end end end ) 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