Memory Posted October 7, 2012 Share Posted October 7, 2012 Hi, how make command /gmon and /gmoff for moderators, smod and admins. gmontext = get("gmontext") gmoncolor = get("gmoncolor") gmofftext = get("gmofftext") gmoffcolor = get("gmoffcolor") addEvent("onMapStarting") addEventHandler("onMapStarting", getRootElement(), function(mapInfo) if string.find(mapInfo.name, "[DM]", 1, true) or mapInfo.modename == "Sprint" then gmon() else gmoff() end end) function gmon() for theKey,thePlayer in ipairs(getElementsByType("player")) do setElementData( thePlayer, "overrideCollide.uniqueblah", 0, false ) outputChatBox(gmoncolor..gmontext,thePlayer,186,212,71,true) end end addCommandHandler("gmon", gmon) function gmoff() for theKey,thePlayer in ipairs(getElementsByType("player")) do setElementData(thePlayer, "overrideCollide.uniqueblah", nil, false ) outputChatBox(gmoffcolor..gmofftext,thePlayer,255,255,255,true) end end addCommandHandler("gmoff", gmoff) This don't work function gmon() acc = getAccountName(getPlayerAccount(player)) if(isObjectInACLGroup("user."..acc,aclGetGroup("Admin")))then for theKey,thePlayer in ipairs(getElementsByType("player")) do setElementData( thePlayer, "overrideCollide.uniqueblah", 0, false ) outputChatBox(gmoncolor..gmontext,thePlayer,186,212,71,true) end end addCommandHandler("gmon", gmon) function gmoff() acc = getAccountName(getPlayerAccount(player)) if(isObjectInACLGroup("user."..acc,aclGetGroup("Admin")))then for theKey,thePlayer in ipairs(getElementsByType("player")) do setElementData(thePlayer, "overrideCollide.uniqueblah", nil, false ) outputChatBox(gmoffcolor..gmofftext,thePlayer,255,255,255,true) end end addCommandHandler("gmoff", gmoff) Link to comment
GTX Posted October 7, 2012 Share Posted October 7, 2012 Errors? Post errors next time. function gmon(player) acc = getAccountName(getPlayerAccount(player)) if(isObjectInACLGroup("user."..acc,aclGetGroup("Admin")))then for theKey,thePlayer in ipairs(getElementsByType("player")) do setElementData( thePlayer, "overrideCollide.uniqueblah", 0, false ) outputChatBox("Ghostmode on",thePlayer,186,212,71,true) end end end addCommandHandler("gmon", gmon) function gmoff(player) acc = getAccountName(getPlayerAccount(player)) if(isObjectInACLGroup("user."..acc,aclGetGroup("Admin")))then for theKey,thePlayer in ipairs(getElementsByType("player")) do setElementData(thePlayer, "overrideCollide.uniqueblah", nil, false ) outputChatBox("Ghostmode off",thePlayer,255,255,255,true) end end end addCommandHandler("gmoff", gmoff) 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