Advertisement
TheSynchronousDev

code fix#2

Aug 30th, 2015
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 7.83 KB | None | 0 0
  1. function ParseCommand(id,txt)
  2.     local p = totable(txt)
  3.     local cmd = tostring(p[1])
  4.     if cmd =="!m" then
  5.         if rp_Adminlevel[id] >= money_lv then
  6.             local pl = tonumber(p[2])
  7.             local money = tonumber(p[3])
  8.             if pl ~= nil and money ~= nil then
  9.                 if player(pl,"exists") then
  10.                     rp_money[pl]=rp_money[pl]+money
  11.                     gmsg2(pl,"000255000",player(id,"name").." Gave you "..money.."$")
  12.                     gmsg2(id,"000255000","You gave "..money.." to "..player(pl,"name"))
  13.                     updatehud(pl)
  14.                 end
  15.             end
  16.         else
  17.             gmsg2(id,"255000000","You don't have premission.")
  18.         end
  19.     elseif cmd == "!s" then
  20.         if rp_Adminlevel[id] >= speed_lv then
  21.             local pl = tonumber(p[2])
  22.             local speed = tonumber(p[3])
  23.             if (pl ~= nil) and (speed ~= nil) then
  24.                 if player(pl,"exists") then
  25.                     parse("speedmod "..pl.." "..speed)
  26.                     gmsg2(id,"000255000","You gave "..speed.." speedmod to "..player(pl,"name"))
  27.                     gmsg2(pl,"000255000","Your speed have been changed. ")
  28.                 end
  29.             end
  30.         else
  31.             gmsg2(id,"255000000","You don't have premission.")
  32.         end
  33.     elseif cmd == "!k" then
  34.         if rp_Adminlevel[id] >= kill_lv then
  35.             local pl = tonumber(p[2])
  36.             if (pl ~= nil) then
  37.                 if player(pl,"exists") then
  38.                     parse("killplayer "..pl)
  39.                     gmsg2(id,"000255000","You killed "..player(pl,"name"))
  40.                     gmsg2(pl,"000255000","You got killed by a RCon user!")
  41.                 end
  42.             end
  43.         else
  44.             gmsg2(id,"255000000","You don't have premission.")
  45.         end
  46.     elseif cmd == "!ban" then
  47.         if rp_Adminlevel[id] >= ban_lv then
  48.             local pl = tonumber(p[2])
  49.             if pl ~= nil then
  50.                 if player(pl,"exists") then
  51.                     local ip = player(pl, "ip")
  52.                     local usgn = player(pl, "usgn")
  53.                     gmsg("255000000",player(id,"name").." has banned "..player(pl,"name"))
  54.                     if ip then
  55.                         parse("banip "..ip)
  56.                     end
  57.                     if usgn then
  58.                         parse("banusgn "..usgn)
  59.                     end
  60.                 end
  61.             end
  62.         else
  63.             gmsg2(id,"255000000","You don't have premission.")
  64.         end
  65.     elseif cmd == "!i" then
  66.         if rp_Adminlevel[id] >= info_lv then
  67.             local pl = tonumber(p[2])
  68.             if pl ~= nil then
  69.                 if player(pl,"exists") then
  70.                 gmsg2(id,"000255000","Name      : "..player(pl,"name"))
  71.                 gmsg2(id,"000255000","USGN      : "..player(pl,"usgn"))
  72.                 gmsg2(id,"000255000","IP            : "..player(pl,"ip"))
  73.                 gmsg2(id,"000255000","Money     : "..rp_money[pl])
  74.                 gmsg2(id,"000255000","Speed     : "..player(pl,"speedmod"))
  75.                 gmsg2(id,"000255000","Position   : "..player(pl,"x")..","..player(pl,"y"))
  76.                 if rp_license[id] ==0 then
  77.                 gmsg2(id,"000255000","Level       : Citizen")
  78.                 elseif  rp_license[id] == 1 and rp_vip[id] == 0 then
  79.                 gmsg2(id,"000255000","Level       : Licensed")
  80.                 elseif  rp_vip[id] == 1 and (not rp_ct[id] == true )then
  81.                 gmsg2(id,"000255000","Level       : VIP")
  82.                 elseif  rp_Adminlevel[id] == 1 then
  83.                 gmsg2(id,"000255000","Level       : Mod")
  84.                 elseif  rp_Adminlevel[id] == 2 then
  85.                 gmsg2(id,"000255000","Level       : Supervisor")
  86.                 elseif  rp_Adminlevel[id] == 3 then
  87.                 gmsg2(id,"000255000","Level       : Admin")
  88.                 elseif  rp_Adminlevel[id] == 4 then
  89.                 gmsg2(id,"000255000","Level       : RCon")
  90.                 end
  91.                 end
  92.             end
  93.         else
  94.             gmsg2(id,"255000000","You don't have premission.")
  95.         end
  96.     elseif cmd =="!a" then
  97.         if rp_Adminlevel[id] >= arrest_lv then
  98.             local pl = tonumber(p[2])
  99.             local cell = tonumber(p[3])
  100.             if pl ~= nil then
  101.                 if player(pl,"exists") then
  102.                     if cell == 1 then
  103.                         parse("setpos "..pl.." "..Config.AP[1][1].." "..Config.AP[1][1]) parse("killplayer "..pl)
  104.                     elseif cell == 2 then
  105.                         parse("setpos "..pl.." "..Config.AP[2][1].." "..Config.AP[2][2]) parse("killplayer "..pl)
  106.                     elseif cell == 3 then
  107.                         parse("setpos "..pl.." "..Config.AP[3][1].." "..Config.AP[4][2]) parse("killplayer "..pl)
  108.                     elseif cell == 4 then
  109.                         parse("setpos "..pl.." "..Config.AP[4][1].." "..Config.AP[5][2]) parse("killplayer "..pl)
  110.                     elseif cell == 5 then
  111.                         parse("setpos "..pl.." "..Config.AP[5][1].." "..Config.AP[5][2]) parse("killplayer "..pl)
  112.                     elseif cell == 6 then
  113.                         parse("setpos "..pl.." "..Config.AP[6][1].." "..Config.AP[6][2]) parse("killplayer "..pl)
  114.                     end
  115.                     rp_arrest[pl]=true
  116.                 end
  117.             end
  118.         else
  119.             gmsg2(id,"255000000","You don't have premission.")
  120.         end
  121.     elseif cmd =="!f" then
  122.         if rp_Adminlevel[id] >= free_lv then
  123.             local pl = tonumber(p[2])
  124.             if pl ~= nil then
  125.                 if player(pl,"exists") then
  126.                     rp_arrest[pl]=false
  127.                     parse("setpos "..pl.." "..Config.FP[1].." "..Config.FP[2])
  128.                 end
  129.             end
  130.         else
  131.             gmsg2(id,"255000000","You don't have premission.")
  132.         end
  133.     elseif cmd == "!unct" then
  134.         if rp_Adminlevel[id] >= makect_lv then
  135.             local pl = tonumber(p[2])
  136.             if pl ~= nil then
  137.                 if player(pl,"exists") then
  138.                     parse("maket "..pl.."")
  139.                     gmsg2(pl,"000000255","You can no longer join the CT forces!")
  140.                     gmsg2(id,"000000255","He can no longer join the CT forces!")
  141.                     rp_ct[pl] = false
  142.                 end
  143.             end
  144.         else
  145.             gmsg2(id,"255000000","You don't have premission.") 
  146.         end
  147.     elseif cmd == "!ct" then
  148.         if rp_Adminlevel[id] >= makect_lv then
  149.             local pl = tonumber(p[2])
  150.             if pl ~= nil then
  151.                 if player(pl,"exists") then
  152.                     parse("makect "..pl.."")   
  153.                     gmsg2(pl,"000000255","You can now join the CT forces!")
  154.                     gmsg2(id,"000000255","He can now join the CT forces!")
  155.                     rp_ct[pl] = true
  156.                 end
  157.             end
  158.         else
  159.             gmsg2(id,"255000000","You don't have premission.") 
  160.         end        
  161.     elseif cmd == "!vip" then
  162.         if rp_Adminlevel[id] >= makect_lv then
  163.             local pl = tonumber(p[2])
  164.             if pl ~= nil then
  165.                 if player(pl,"exists") then
  166.                     gmsg2(pl,"000000255","You are now a VIP!")
  167.                     gmsg2(id,"000000255","He is now a VIP!")
  168.                     rp_vip[pl] = true
  169.                 end
  170.             end
  171.         else
  172.             gmsg2(id,"255000000","You don't have premission.") 
  173.         end
  174.     elseif cmd =="!b" then
  175.         if rp_Adminlevel[id] >= bring_lv then
  176.             local pl = tonumber(p[2])
  177.             if pl ~= nil then
  178.                 if player(pl,"exists") then
  179.                     parse("setpos "..pl.." "..player(id,"x").." "..player(id,"y"))
  180.                 else
  181.                     gmsg2(id,"255000000","This player does not exist!")
  182.                 end
  183.             end
  184.         else
  185.             gmsg2(id,"255000000","You don't have premission.")
  186.         end
  187.     elseif cmd =="!bringall" then
  188.         if rp_Adminlevel[id] >= bring_all_lv then
  189.             for pl = 1,32 do
  190.                 if player(pl,"exists") then
  191.                     parse("setpos "..pl.." "..player(id,"x").." "..player(id,"y"))
  192.                 end
  193.             end
  194.         else
  195.             gmsg2(id,"255000000","You don't have premission.")
  196.         end
  197.     elseif cmd == "!h" then
  198.         if rp_Adminlevel[id] >= heal_lv then   
  199.             parse("spawnitem 64 "..player(id,"tilex").." "..player(id,"tiley"))
  200.         else
  201.             gmsg2(id,"255000000","You don't have premission.") 
  202.         end
  203.     elseif cmd == "!g" then
  204.         if rp_Adminlevel[id] >= goto_lv then
  205.             local pl = tonumber(p[2])
  206.             if pl ~= nil then
  207.                 if player(pl,"exists") then
  208.                     parse("setpos "..id.." "..player(pl,"x").." "..player(pl,"y"))
  209.                 else
  210.                     gmsg2(id,"255000000","This player does not exist!")
  211.                 end
  212.             end
  213.         else
  214.             gmsg2(id,"255000000","You don't have premission.")
  215.         end
  216.     elseif cmd == "!kick" then
  217.         if rp_Adminlevel[id] >= kick_lv then
  218.             local pl = tonumber(p[2])
  219.             if pl ~= nil then
  220.                 if player(pl,"exists") then
  221.                     gmsg("255000000",player(id,"name").." has kicked "..player(pl,"name"))
  222.                     parse("kick "..pl)
  223.                 end
  224.             end
  225.         else
  226.             gmsg2(id,"255000000","You don't have premission.") 
  227.         end
  228.     elseif cmd == "!slapme" then
  229.         parse("slap "..id)
  230.     --elseif cmd == "!msg" then
  231.     --  local pl = tonumber(p[2])
  232.     --  local msging = tostring(p[3])
  233.     --  if pl ~= nil then
  234.     --      if player(pl,"exists") then
  235.     --          gmsg2(id,"000255000","Message sent to "..player(pl,"name").." ")
  236.     --          gmsg2(pl,"000255000",player(id,"name").." told you: "..msging.." ")
  237.     --         
  238.     --      else
  239.     --          gmsg2(id,"255000000","This player does not exist!")
  240.     --      end
  241.     --  else   
  242.     --  gmsg2(id,"255000000","Player ID is needed! !msg <id> <txt>!")  
  243.     --  end
  244.     --else 
  245.     --gmsg2(id,"255000000"," @C")
  246.     end
  247. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement