Advertisement
blackwolfsden

help set command

Jan 21st, 2014
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.58 KB | None | 0 0
  1. function Editcomm(eventid, player, msg)-- thank you foereaper for all the help getting this right
  2.     local Help = "help"
  3.     local k = 0
  4.     local ChatCache = {}
  5.    
  6.     for word in string.gmatch(msg, "[%w_]+") do
  7.         k = k+1
  8.         ChatCache[k] = word
  9.     end
  10.    
  11.     if (ChatCache[1] == GWCOMM["SERVER"].command_set) then
  12.  
  13.         for i = 1, #GWHELP do
  14.  
  15.             if(ChatCache[2]==tostring(GWHELP[i].command))then
  16.  
  17.                 if(GWHELP[i].command_level<=4)and(player:GetGuildRank()==0)then
  18.                     PreparedStatements(3, ChatCache[2], ChatCache[3], player:GetGuildName())
  19.                     player:SendBroadcastMessage("guild cmd "..ChatCache[2].." set to "..ChatCache[3]..".")
  20.                 return false;
  21.                 end
  22.    
  23.                 if(GWHELP[i].command_level<=6)and(GWHELP[i].command_level>=5)and(player:GetGMRank()==GWCOMM["SERVER"].GM_admin)then
  24.                     PreparedStatements(3, ChatCache[2], ChatCache[3], "SERVER")
  25.                     player:SendBroadcastMessage("GM cmd "..ChatCache[2].." set to "..ChatCache[3]..".")
  26.                 return false;
  27.                 end
  28.             end
  29.         end
  30.     player:SendBroadcastMessage("err...")
  31.     return false;
  32.     end
  33.  
  34.     if (ChatCache[1] == Help)then
  35.    
  36.         for i = 1, #GWHELP do
  37.            
  38.             if(ChatCache[2] == GWCOMM["SERVER"].command_set)and(ChatCache[3]==nil)then
  39.                 player:SendBroadcastMessage("command id      -     description")
  40.                    
  41.                     for b = 1, #GWHELP do
  42.                    
  43.                         if(player:GetGuildRank()==0)and(GWHELP[b].command_level<=4)then
  44.                             player:SendBroadcastMessage(GWHELP[b].command.."     -     |cff00cc00"..GWHELP[b].description.."|r")
  45.                         end
  46.                        
  47.                         if(player:GetGMRank()==GWCOMM["SERVER"].GM_admin)and(GWHELP[b].command_level>=5)and(GWHELP[b].command_level<=6)then
  48.                             player:SendBroadcastMessage(GWHELP[b].command.."     -     |cff00cc00"..GWHELP[b].description.."|r")
  49.                         end
  50.                     end
  51.             return false;
  52.             end
  53.            
  54.             if(ChatCache[3] == tostring(GWHELP[i].command))then
  55.                 if(player:GetGuildRank()==0)and(GWHELP[i].command_level<=4)then
  56.                     player:SendBroadcastMessage(GWHELP[i].command.."      -      |cff00cc00"..GWHELP[i].description.."|r")
  57.                     player:SendBroadcastMessage("|cff00cc00Example|r /g "..GWHELP[i].example.."")
  58.                    
  59.                 return false;
  60.                 end
  61.                 if(player:GetGMRank()==GWCOMM["SERVER"].GM_admin)and(GWHELP[i].command_level>=5)and(GWHELP[i].command_level<=6)then
  62.                     player:SendBroadcastMessage(GWHELP[i].command.."      -      |cff00cc00"..GWHELP[i].description.."|r")
  63.                     player:SendBroadcastMessage("|cff00cc00Example|r /g "..GWHELP[i].example.."")
  64.                 return false;
  65.                 end
  66.             end
  67.         end
  68.     player:SendBroadcastMessage("err...")
  69.     return false;
  70.     end
  71. end
  72.  
  73. RegisterPlayerEvent(21, Editcomm)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement