Forum

> > CS2D > Scripts > admin.lua
Forums overviewCS2D overview Scripts overviewLog in to reply

English admin.lua

5 replies
To the start Previous 1 Next To the start

old admin.lua

OnGameNet
User Off Offline

Quote
[gunz] no admin hey lua - -
main.lua error!
admin.lua where?

admin.lua plz
-,-

old ADMINLUA

-Commander-
User Off Offline

Quote
ADMINLUA:
drop_system_m = 1
tele_sys = 1
Mute_text= 0

function isAdmin(usgn)
     local filename = "sys/lua/Admin.txt"
     local file = io.open(filename)
     if file then
          for line in file:lines() do
               local parses = totable(line)
               if tonumber(parses[1]) ~= nil then
                    if usgn==tonumber(parses[1]) then
                         if tonumber(parses[2]) ~= nil then
                              return tonumber(parses[2])
                         else
                              return 1
                         end
                    end
               end
          end
          if file ~= nil then
               file:close()
          end
     end          
     return 0
end

function ParseAdminCommand(id,txt)
     local p = totable(txt)
     local cmd = tostring(p[1])
     if rp_Adminlevel[id]>=2 then
          if cmd =="!save" then
               if rp_Adminlevel[id]>=1 then
                    for id = 1,32 do
                         if player(id,"exists") then
                              local UsgnID = UsgnIds[id]
                              if UsgnID > 0 then
                                   SaveUserStat(id,UsgnID)
                              end
                         end
                    end
                    rp_msg2(id,"000255000","SAVE OK!")
               else
                    admlevelmsg(id)
               end
          elseif cmd =="!money" then
               if rp_Adminlevel[id]>=3 then
                    local pl = tonumber(p[2])
                    local money = tonumber(p[3])
                    if pl ~= nil and money ~= nil then
                         if player(pl,"exists") then
                              rp_money[pl]=rp_money[pl]+money
                              rp_msg2(pl,"000255000",player(id,"name").." Gave you "..money.." of money!")
                              rp_msg2(id,"000255000","You gave "..money.." to "..player(pl,"name"))
                              updatehud(pl)
                         end
                    end
               else
                    admlevelmsg(id)
               end
          elseif cmd == "!set" then
               if rp_Adminlevel[id]>=2 then
                    local pl = tonumber(p[2])
                    local item = tonumber(p[3])
                    if (pl ~= nil) and (item~=nil) then
                         if player(pl,"exists") then
                              Addons[item].FLic[pl]=1
                              rp_msg2(id,"000255000","You Give "..Addons[item].FName.." Add-ons to "..player(pl,"name"))
                              rp_msg2(pl,"000255000","You have "..Addons[item].FName.." Add-ons now, F3!")
                         end
                    end
               else
                    admlevelmsg(id)
               end
          elseif cmd == "!remove" then
               if rp_Adminlevel[id]>=3 then
                    local pl = tonumber(p[2])
                    if pl ~= nil then
                         if player(pl,"exists") then
                              InternalFreeImage(pl)
                              SetAddons(pl,0)
                         end
                    end
               else
                    admlevelmsg(id)
               end
          elseif cmd == "!ban" then
               if rp_Adminlevel[id] >=3 then
                    local pl = tonumber(p[2])
                    if pl ~= nil then
                         if player(pl,"exists") then
                              local ip = player(pl, "ip")
                              local usgn = player(pl, "usgn")
                              if ip then
                                   parse("banip "..ip)
                              end
                         end
                    end
               else
                    admlevelmsg(id)
               end
          elseif cmd == "!vip" then
               if rp_Adminlevel[id] >=2 then
                    local pl = tonumber(p[2])
                    if pl ~= nil then
                         if player(pl,"exists") then
                              rp_license[pl]=2
                              rp_msg2(id,"000255000","You Give VIP to "..player(pl,"name"))
                              rp_msg2(pl,"000255000","You are VIP USER Now")
                         end
                    end
               else
                    admlevelmsg(id)
               end

          elseif cmd =="!arrest" then
               local pl = tonumber(p[2])
               local cell = tonumber(p[3])
               if pl ~= nil then
                    if player(pl,"exists") then
                         if cell == 1 then
                              parse("setpos "..pl.." "..Config.AP[1][1].." "..Config.AP[1][2])
                         elseif cell == 2 then
                              parse("setpos "..pl.." "..Config.AP[2][1].." "..Config.AP[2][2])
                         elseif cell == 3 then
                              parse("setpos "..pl.." "..Config.AP[3][1].." "..Config.AP[3][2])
                         end
                         rp_arrest[pl]=true
                    end
               end
          elseif cmd =="!free" then
               local pl = tonumber(p[2])
               if pl ~= nil then
                    if player(pl,"exists") then
                         rp_arrest[pl]=false
                         parse("setpos "..pl.." "..Config.FP[1].." "..Config.FP[2])
                    end
               end

          elseif cmd =="!bring" then
               local pl = tonumber(p[2])
               if pl ~= nil then
                    if player(pl,"exists") then
                         parse("setpos "..pl.." "..player(id,"x").." "..player(id,"y"))
                    else
                         rp_msg2(id,"255000000","This player does not exist!")
                    end
               end
          elseif cmd == "!goto" then
               local pl = tonumber(p[2])
               if pl ~= nil then
                    if player(pl,"exists") then
                         parse("setpos "..id.." "..player(pl,"x").." "..player(pl,"y"))
                    else
                         rp_msg2(id,"255000000","This player does not exist!")
                    end
               end
          elseif cmd == "!kick" then
               local pl = tonumber(p[2])
               if pl ~= nil then
                    if player(pl,"exists") then
                         parse("kick "..pl)
                    end
               end
          else
               rp_msg2(id,"255000000","Unknown Command !")
          end
     else
          admlevelmsg(id)
     end
end

function admlevelmsg(id)
     rp_msg2(id,"255000000","You can´t use this Command! Your Level is to low")
end

MAINLUA

dofile("sys/lua/extras.lua")
dofile("sys/lua/functions.lua")
dofile("sys/lua/config.lua")
dofile("sys/lua/addons.lua")
dofile("sys/lua/Admin.lua")
dofile("sys/lua/users.lua")
dofile("sys/lua/setting.lua")
dofile("sys/lua/funcFootbal.lua")

UpdateHudeImages()

rp_ct            = Array(32,false)
rp_Adminlevel = Array(32,0)
rp_license       = Array(32,0)
rp_money       = Array(32,100)
rp_arrest       = Array(32,false)
rp_vipmsg       = Array(32,0)
rp_vipaddons = Array(32,0)
rp_NextAddons = Array(32,0)
UsgnIds = Array(32, 0)
PicImage = Array(32, 0)
--footbal--
team_no = Array(32,0)
havebal = Array(32,false)
FTWin      = Array(2,1)
-----------
tsb = Array(32,0)
player_have_pos = Array(32,false)
tele_x = Array(32,0)
tele_y = Array(32,0)

function InternalFreeImage(id)
     if (team_no[id]>0) then
          freeimage(PicImage[id])
          team_no[id]=0
     else
          for k, v in ipairs(Addons) do
               if v.FHave[id]==1 then
                    freeimage(PicImage[id])
                    v.FHave[id]=0
               end
          end
     end
end

addhook("join","rp_load")
function rp_load(id)
     rp_license[id]=0
     rp_ct[id]=false
     rp_Adminlevel[id]=0
     rp_arrest[id]=false
     player_have_pos[id]=false
     tele_x[id]=800
     tele_y[id]=200
     rp_money[id]=100
     UsgnIds[id]= 0
     rp_vipmsg[id]=0
     rp_vipaddons[id]=0
     rp_NextAddons[id]=0
     InternalFreeImage(id)
     InternalFreeAddons(id)

     local UsgnID = player(id,"usgn")
     UsgnIds[id] = 0
     if UsgnID > 0 then
          local sameusgn = false
          for ids = 1,32 do
               if ids~=id then
                    if UsgnIds[ids]==UsgnID then
                         sameusgn=true
                         break
                    end
               end
          end
          if sameusgn==false then
               rp_msg2(id,"000255000","Login with "..UsgnID)
               rp_Adminlevel[id]= isAdmin(UsgnID)
               if rp_Adminlevel[id]>0 then
                    rp_ct[id]=true
                    rp_license[id]=3
                    SetAddons(id,1)
                    rp_msg2(id,"000255000","Welcome on the Server, Teammember!")
               else
                    local filename = "sys/lua/rp_citylife/"..UsgnID..".txt"
                    local file = io.open(filename)
                    if file then
                         LoadUserStat(id,file)
                         rp_msg2(id,"000255000","Load Successfully!")
                         if file ~= nil then
                              file:close()
                         end
                    end
               end
               UsgnIds[id] = UsgnID
          else
               rp_msg2(id,"255000000","Load fail!")
          end
     else
          rp_msg2(id,"255000000","Please register a U.S.G.N. account at http://www.unrealsoftware.de/ and make sure that you are logged in!")
          rp_msg2(id,"255000000","Your money and license not save on Database")
     end
end

addhook("team","rp_team")
function rp_team(id,t)
     if t == 2 and rp_ct[id]==true then
          return 0
     elseif t == 2 and rp_ct[id]==false then
          parse("maket "..id)
          return 1
     elseif (t>0) and (rp_arrest[id]==true) then     
          rp_msg2(id,"255000000","STOP! You aren´t a CT!")
          rp_msg2(id,"255000000","Apply at: jkgaming.de.to")
          return 1
     end
end

addhook("leave","rp_leave")
function rp_leave(id)
     local UsgnID = UsgnIds[id]
     if UsgnID > 0 then
          SaveUserStat(id,UsgnID)
end
     rp_license[id]=0
     rp_ct[id]=false
     rp_Adminlevel[id]=0
     rp_arrest[id]=false
     player_have_pos[id]=false
     tele_x[id]=800
     tele_y[id]=200
     rp_money[id]=100
     UsgnIds[id]= 0
     rp_vipmsg[id]=0
     rp_vipaddons[id]=0
     rp_NextAddons[id]=0
     x = player(id,"tilex")
     y = player(id,"tiley")
     if havebal[id]==true then
          parse("spawnitem 75 "..x.." "..y)
     end
     havebal[id]=false
     InternalFreeImage(id)
     InternalFreeAddons(id)
end

addhook("startround","rp_startround")
function rp_startround(mode)
     for id = 1,32 do
          if player(id,"exists") then
               player_have_pos[id]=false
               tele_x[id]=800
               tele_y[id]=200
               havebal[id]=false
               FTWin[1]=0
               FTWin[2]=0
               InternalFreeImage(id)
          end
     end
     UpdateHudeImages()
end

function updatehud(id)
     if id ~= nil then
          if player(id,"exists") then
               if (team_no[id]~=nil) and (team_no[id]>0) then
                    hudtext2(id,id+2,"000128255","Blue Team: "..FTWin[1],14,179)
                    hudtext2(id,id+3,"255000000","Red Team: "..FTWin[2],14,194)
               else
                    hudtext2(id,id,"255255255","Money: "..rp_money[id],500,368)
               end
          end
     end
end

addhook("attack","rp_attack")
function rp_attack(id)
     if rp_ct[id] == true then
          local w = player(id,"weapontype")
          if w > 0 then
               parse("equip "..id.." "..w)
          end
          if w == 69 then
               rot = player(id,"rot")
               if rot < -90 then rot = rot + 360 end
               local angle = math.rad(math.abs(rot + 90)) - math.pi
               local x = player(id,"x") + math.cos(angle) * itemtype(w,"dmg") / 2
               local y = player(id,"y") + math.sin(angle) * itemtype(w,"dmg") / 2
               if x > 0 and y > 0 and x < map("xsize") * 32 and y < map("ysize") * 32 then
                    parse("explosion "..x.." "..y.." 32 10000000 "..id)
               end
          end
     end
end

addhook("say","rp_say")
function rp_say(id,txt)
     if rp_ct[id]==true then
          if txt:sub(1,1)=="!" then
               print(player(id,'name')..' used a command:'..txt)
               ParseAdminCommand(id,txt)
               return 1
          end
     end
     
     if txt:sub(1,1)=="@" then
          local p = totable(txt)
          local cmd = string.lower(tostring(p[1]))
          for k, v in pairs(cmd_param) do
               --rp_msg2(id,"255000000",""..string.lower(string.sub(txt, #cmd+1, #txt)))
               if cmd==v then
                    txt = string.sub(txt, #cmd+2, #txt)
                    ExecuteParam(id,cmd,txt)
                    return 1
               end
          end
     end

          if Mute_text==1 then
          rp_msg2(id,"255000000","Mute Mode! Use Teamchat please!")
          return 1
     end
     
     if rp_vipmsg[id]>0 then
          rp_msg("000255255",player(id,"name").."(VIP): "..txt)
          rp_vipmsg[id]=0
          return 1
     end
end

addhook("kill","rp_kill")
function rp_kill(killer,victim,wpn)
     if rp_ct[killer]==true then
          rp_money[killer]=rp_money[killer]+300
          rp_money[victim]=rp_money[victim]-100
     else
          if killer~=victim then
               if checkbound(victim,Config.Bounce) then
                    local PScore = player(killer,"score")
                    rp_msg2(killer,"255000000",PScore)
                    if PScore+1 >= 0 then
                         parse("setmoney "..killer.." "..Config.HoldMoney)
                         parse("setscore "..killer.." "..PScore+2)
                         rp_money[killer]=rp_money[killer]+2000
                         rp_money[victim]=rp_money[victim]-1000     
                    else
                         parse("setscore "..killer.." 0")
                    end
               else
                    rp_money[killer]=rp_money[killer]-50
                    rp_money[victim]=rp_money[victim]+50
               end
          end
     end
     updatehud(killer)
     updatehud(victim)
end

addhook("minute","rp_minute")
function rp_minute()
     for id = 1,32 do
          if player(id,"exists") then
               if player(id,"health")>0 then
                    if rp_ct[id]==true then
                         rp_money[id]=rp_money[id]+5000
                         rp_msg2(id,"255255000","$5000 PAYDAY!")
                    else
                         if rp_license[id]>1 then
                              rp_money[id]=rp_money[id]+1000
                              rp_msg2(id,"000255000","$1000 PAYDAY!@C")
                         else
                              rp_money[id]=rp_money[id]+500
                              rp_msg2(id,"000255000","500 PAYDAY!@C")
                         end
                    end
               end
          end
          updatehud(id)
     end
end

addhook("second","rp_second")
function rp_second()
     for id = 1,32 do
          if player(id,"exists") then
               if player(id,"health")>0 then
                    local usermoney = player(id,"money")
                    if usermoney > Config.HoldMoney then
                         rp_money[id]=rp_money[id]+(usermoney-Config.HoldMoney)
                         parse("setmoney "..id.." "..Config.HoldMoney)
                         updatehud(id)
                    elseif usermoney == Config.HoldMoney then
                         
                    else
                         if rp_money[id] > usermoney then
                              rp_money[id]=rp_money[id]-(Config.HoldMoney-usermoney)
                              parse("setmoney "..id.." "..Config.HoldMoney)
                              updatehud(id)
                         end
                    end
               end
          end
     end

     local t = item(0,"table")
for i=1,#t do
local typeid = item(t[i],"type")
if typeid == 61 or typeid == 62 then
removeitem(t[i])
end
end
end

addhook("walkover","rp_walkover")
function rp_walkover(id,iid,type,ain,a,mode)
     if type==66 then
          if player(id,"money") >= Config.HoldMoney then
               rp_money[id]=rp_money[id]+100
               if Config.SilentMode==true then
                    removeitem(iid)
               else
                    parse ("setmoney "..id.." "..player(id,"money")-100)
               end
               updatehud(id)
               if Config.SilentMode==true then     
                    return 1
               end
          else
               return 0
          end
     elseif type==67 then
          if player(id,"money") >= Config.HoldMoney then
               rp_money[id]=rp_money[id]+500
               if Config.SilentMode==true then
                    removeitem(iid)
               else
                    parse ("setmoney "..id.." "..player(id,"money")-500)
               end
               updatehud(id)
               if Config.SilentMode==true then
                    return 1
               end
          else
               return 0
          end
     elseif type==68 then
          if player(id,"money") >= Config.HoldMoney then
               rp_money[id]=rp_money[id]+1000
               if Config.SilentMode==true then
                    removeitem(iid)
               else
                    parse ("setmoney "..id.." "..player(id,"money")-1000)
               end
               updatehud(id)
               if Config.SilentMode==true then
                    return 1
               end
          else
               return 0
          end
     elseif type==75 then
          if team_no[id]>0 then
               if havebal[id]==false then
                    havebal[id]=true
                    parse("equip "..id.." 75")
                    parse("setweapon "..id.." 75")
                    removeitem(iid)
                    return 1
               end
          else
               return 1
          end
     elseif type == 61 or type == 62 then
removeitem(iid)
return 1
     else
          return 0
     end
end

addhook("die","rp_die")
function rp_die(victim,killer,weapon,x,y)
     --rp_msg2(killer,"255255000","killer: "..killer.." victim"..victim)
     if rp_arrest[victim]==true then
          parse("spawnplayer "..victim.." "..Config.AP[1][1].." "..Config.AP[1][2])
          parse("setdeaths "..victim.." "..player(victim,"deaths")-1)
     end
     
     if havebal[victim]==true then
          local XTitle= math.floor(x/32)
          local YTitle= math.floor(y/32)
          parse("spawnitem 75 "..XTitle.." "..YTitle)
          havebal[victim]=false
     end
     return 1
end

addhook("serveraction","rp_action")
function rp_action(id,a)
     if a == 1 then
          if drop_system_m == 1 then
               menu(id,"Drop System,$100,$500,$1000,$5000,$10000,$50000,$100000,Buy License|100k, Buy Add-ons|>>")
          else
               rp_msg2(id,"255000000","Drop System is off!@C")
          end
     elseif a == 2 then
          if rp_ct[id]==true then
               menu(id,"CT Menu,Settings,Teleport,License System,Commands,VIP,Football,Add-ons,Add-ons Setting")
          else
               if tele_sys == 1 then
                    if rp_license[id]>0 then
                         if rp_arrest[id] == true then
                              rp_msg2(id,"255000000","No phone , TV , .. on jail")
                         else
                              if team_no[id]==0 then
                                   menu(id,"T Menu,Teleport,Add-ons,Add-ons Setting,VIP")
                              else
                                   rp_msg2(id,"255000000","You cant use licenced now")
                              end
                         end
                    else
                         rp_msg2(id,"255000000","You must to be licenced!")
                    end
               end
          end
     elseif a == 3 then
          if (rp_ct[id]==true) and (rp_Adminlevel[id]>1) then
               local rot = player(id,"rot")
               if rot < -90 then rot = rot + 360 end
               local angle = math.rad(math.abs( rot + 90 )) - math.pi
               local x = player(id,"x") + math.cos(angle) * 10
               local y = player(id,"y") + math.sin(angle) * 10
               if x > 0 and y > 0 and x < map("xsize") * 32 and y < map("ysize") * 32 then
                    parse("setpos "..id.." "..x.." "..y)
               end
          end
     end
end

addhook("drop","rp_drop")
function rp_drop(id,iid,type,ain,a,mode,x,y)
     if havebal[id]==true then
          parse("strip "..id.." "..type)
          parse("spawnitem "..type.." "..x.." "..y)
          havebal[id]=false
          return 1
     end
     for k, v in ipairs(Addons) do
          if v.FHave[id]==1 then
               if v.wpn == type then
                    rp_msg2(id,"255000000","you cant drop Add-ons item!")
                    return 1
               end
          end
     end
end

function gv_ls(id,pl,page)
     if rp_license[pl]>0 then
          rp_license[pl]=0
          player_have_pos[pl]=false
          tele_x[pl]=800
          tele_y[pl]=200
          rp_msg2(pl,"255000000","your license Removed!")
          rp_msg2(id,"255000000","You Remove license to "..player(pl,"name").."!")
     else
          rp_license[pl]=1
          rp_msg2(pl,"000255000",player(id,"name").." Gave you license!")
          rp_msg2(id,"000255000","You gave license to "..player(pl,"name").."!")
     end
     if page == 1 then
          ls_1(id)
     elseif page == 2 then
          ls_2(id)
     elseif page == 3 then
          ls_3(id)
     elseif page == 4 then
          ls_4(id)
     elseif page == 5 then
          ls_5(id)
     end
end


function gv_vip(id,pl,page)
     if rp_vip[pl]>0 then
          rp_vip[pl]=0
          player_have_pos[pl]=false
          tele_x[pl]=800
          tele_y[pl]=200
          rp_msg2(pl,"255000000","your license Removed!")
          rp_msg2(id,"255000000","You Remove license to "..player(pl,"name").."!")
     else
          rp_license[pl]=1
          rp_msg2(pl,"000255000",player(id,"name").." Gave you license!")
          rp_msg2(id,"000255000","You gave license to "..player(pl,"name").."!")
     end
     if page == 1 then
          ls_1(id)
     elseif page == 2 then
          ls_2(id)
     elseif page == 3 then
          ls_3(id)
     elseif page == 4 then
          ls_4(id)
     elseif page == 5 then
          ls_5(id)
     end
end
function set_men(id)
     menu(id,"CT Menu Settings,Drop System|("..drop_system_m.."),Teleport System & Arrest|("..tele_sys.."),Mute |("..(Mute_text).."),Shake, Air Strik,Restart")
end

function CreateAddonsSetting(id)
     menu(id,"Add-ons Setting,Change Color|>>,VIP Skin(VIP)|("..rp_vipaddons[id]..")")
end

function FootballMenu(id)
     local Blueplayer=bluePl(id)
     local Redplayer=redPl(id)
     local TmpStr = ""
     if rp_ct[id]==true then
          if rp_Adminlevel[id]>=2 then
               TmpStr=", Start Game, End Game"
          end
     end
     menu(id,"Footbal, Blue Player ("..Blueplayer.."),Red Player ("..Redplayer..")"..TmpStr)
end

addhook("menu","rp_menu")
function rp_menu(id,men,sel)
     x = player(id,"tilex")
     y = player(id,"tiley")
     if rp_ct[id]==true then
          if men == "License System Page 5" then
               if sel == 1 then
                    gv_ls(id,29,5)
               elseif sel == 2 then
                    gv_ls(id,30,5)
               elseif sel == 3 then
                    gv_ls(id,31,5)
               elseif sel == 4 then
                    gv_ls(id,32,5)
               elseif sel == 7 then
                    ls_4(id)
               end
          end
          if men == "License System Page 4" then
               if sel == 1 then
                    gv_ls(id,22,4)
               elseif sel == 2 then
                    gv_ls(id,23,4)
               elseif sel == 3 then
                    gv_ls(id,24,4)
               elseif sel == 4 then
                    gv_ls(id,25,4)
               elseif sel == 5 then
                    gv_ls(id,26,4)
               elseif sel == 6 then
                    gv_ls(id,27,4)
               elseif sel == 7 then
                    gv_ls(id,28,4)
               elseif sel == 8 then
                    ls_3(id)
               elseif sel == 9 then
                    ls_5(id)
               end
          end
          if men == "License System Page 3" then
               if sel == 1 then
                    gv_ls(id,15,3)
               elseif sel == 2 then
                    gv_ls(id,16,3)
               elseif sel == 3 then
                    gv_ls(id,17,3)
               elseif sel == 4 then
                    gv_ls(id,18,3)
               elseif sel == 5 then
                    gv_ls(id,19,3)
               elseif sel == 6 then
                    gv_ls(id,20,3)
               elseif sel == 7 then
                    gv_ls(id,21,3)
               elseif sel == 8 then
                    ls_2(id)
               elseif sel == 9 then
                    ls_4(id)
               end
          end
          if men == "License System Page 2" then
               if sel == 1 then
                    gv_ls(id,8,2)
               elseif sel == 2 then
                    gv_ls(id,9,2)
               elseif sel == 3 then
                    gv_ls(id,10,2)
               elseif sel == 4 then
                    gv_ls(id,11,2)
               elseif sel == 5 then
                    gv_ls(id,12,2)
               elseif sel == 6 then
                    gv_ls(id,13,2)
               elseif sel == 7 then
                    gv_ls(id,14,2)
               elseif sel == 8 then
                    ls_1(id)
               elseif sel == 9 then
                    ls_3(id)
               end
          end
          if men == "License System Page 1" then
               if sel == 1 then
                    gv_ls(id,1,1)
               elseif sel == 2 then
                    gv_ls(id,2,1)
               elseif sel == 3 then
                    gv_ls(id,3,1)
               elseif sel == 4 then
                    gv_ls(id,4,1)
               elseif sel == 5 then
                    gv_ls(id,5,1)
               elseif sel == 6 then
                    gv_ls(id,6,1)
               elseif sel == 7 then
                    gv_ls(id,7,1)
               elseif sel == 8 then
                    menu(id,"CT Menu,Settings,Teleport,License System,Commands,,VIP,Football,Add-ons,Add-ons Setting")
               elseif sel == 9 then
                    ls_2(id)
               end
          end
          if men == "CT Menu" then
               if sel == 1 then
                    if rp_Adminlevel[id]>=3 then
                         set_men(id)
                    else
                         admlevelmsg(id)
                    end
               elseif sel == 2 then
                    if tele_sys == 1 then
                         menu(id,"Teleport Menu,Go to position,Set Current Position,Toggle Spawn Behavior ("..tsb[id]..")")
                    else
                         rp_msg2(id,"255000000","Teleport System is Disabled!")
                    end
               elseif sel == 3 then
                    if rp_Adminlevel[id]>=2 then
                         ls_1(id)
                    else
                         admlevelmsg(id)
                    end
               elseif sel == 4 then
                    rp_msg2(id,"000255000","Command: !bring <player>")
                    rp_msg2(id,"000255000","Command: !goto <player>")
                    rp_msg2(id,"000255000","Command: !arrest <player> <Cell>")
                    rp_msg2(id,"000255000","Command: !free <player>")
                    rp_msg2(id,"000255000","Command: !money <player> <money>")
                    rp_msg2(id,"000255000","Command: !save = Save Game")
               elseif sel == 5 then
                    menu(id,"VIP USER,Go to VIP House,VIP Message,Laser|50k")
               elseif sel == 6 then
                    FootballMenu(id)
               elseif sel == 7 then
                    CreateAddonsMenu(id)
               elseif sel == 8 then
                    CreateAddonsSetting(id)
               end
          end
          
          if men == "CT Menu Settings" then
               if sel == 1 then
                    if drop_system_m == 1 then
                         drop_system_m = 0
                         rp_msg("255000000","Drop system disabled. Called by "..player(id,"name").."@C")
                    elseif drop_system_m == 0 then
                         drop_system_m = 1
                         rp_msg("000255000","Drop system enabled. Called by "..player(id,"name").."@C")
                    end
                    set_men(id)
               elseif sel == 2 then
                    if tele_sys == 1 then
                         tele_sys = 0
                         rp_msg("255000000","Teleport system disabled. Called by "..player(id,"name").."@C")
                    elseif tele_sys == 0 then
                         tele_sys = 1
                         rp_msg("000255000","Drop system enabled. Called by "..player(id,"name").."@C")
                    end
               elseif sel == 3 then
                    if Mute_text==0 then
                         Mute_text = 1
                         rp_msg("000255000","Mute Mode enabled by "..player(id,"name").."@C")
                    else
                         Mute_text = 0
                         rp_msg("000255000","Mute Mode disabled by "..player(id,"name").."@C")
                    end
               elseif sel == 4 then
                    for _, ids in ipairs(player(0,'table')) do
                         parse("shake "..ids.." "..60)
                    end
                    parse("sv_sound weapons/explode1.wav")
               elseif sel == 5 then
                    parse('trigger bom1s')
               elseif sel == 6 then
                    parse('restart 5')
               end
          end
     end
     if men == "Add-ons Menu" then
          if sel>0 then
               SelAddonsMenu(id,sel)
          end
     end
     if men == "Buy Add-ons" then
          if sel>0 then
               if Addons[sel].FLic[id] == 0 then
                    if rp_money[id]>= Addons[sel].FPrice then
                         Addons[sel].FLic[id]=1
                         rp_money[id]=rp_money[id]-Addons[sel].FPrice
                         rp_msg2(id,"000255000","You have "..Addons[sel].FName.." Add-ons now!")
                    else
                         nmn(id)
                    end
               else
                    rp_msg2(id,"255000000","You have "..Addons[sel].FName.." Add-ons already!")
               end
          end
     end
     
     if men == "Add-ons Setting" then
          if sel == 1 then
               CreateAddonsColor(id)
          elseif sel == 2 then
               if rp_license[id]>1 then
                    if rp_vipaddons[id]==0 then
                         rp_vipaddons[id]=1
                    else
                         rp_vipaddons[id]=0
                    end
               else
                    rp_msg2(id,"255000000","You are not VIP user")
               end
          end
     end
     
     if men == "Add-ons Color" then
          if sel>0 then
               selAddonsColor(id,sel)
          end
     end
     
     if men == "Footbal" then
          if (team_no[id]==0) or (rp_ct[id]==true) then
               SelFootballMenu(id,sel)
          else
               rp_msg2(id,"255000000","You cant choice team again")
          end
     end     
     
     if men == "T Menu" then
          if sel == 1 then
               if tele_sys == 1 then
                    if rp_license[id]>0 then
                         menu(id,"Teleport Menu@b,Go to position,Set Current Position,Toggle Spawn Behavior ("..tsb[id]..")")
                    else
                         rp_msg2(id,"255000000","You must to be licenced!")
                    end
               else
                    rp_msg2(id,"255000000","Teleport System is Disabled!")
               end
          elseif sel == 2 then
               CreateAddonsMenu(id)
          elseif sel == 3 then
               CreateAddonsSetting(id)
          elseif sel == 4 then
               if rp_license[id]>1 then
                    menu(id,"VIP USER,Go to VIP House,VIP Message,Laser|50k")
               else
                    rp_msg2(id,"255000000","You are not VIP user")
               end
          end
     end
     if men == "VIP USER" then
          if rp_license[id]>1 then
               if sel == 1 then
                    parse("setpos "..id.." "..Config.VIPHOUSE[1].." "..Config.VIPHOUSE[2])
               elseif sel == 2 then
                    rp_msg2(id,"000255000","Type your message")
                    rp_vipmsg[id]=1
               elseif sel == 3 then
                    if rp_money[id]>= 50000 then
                         parse("equip "..id.." "..45)
                         rp_money[id]=rp_money[id]-50000
                         updatehud(id)
                    else
                         nmn(id)
                    end
               end
          end
     end
     
     if men == "Teleport Menu" then
          if sel == 1 then
               if player_have_pos[id]==true then
                    if rp_money[id]>=0 then
                         if rp_license[id]>0 then
                              parse("setpos "..id.." "..tele_x[id].." "..tele_y[id])
                         end
                    else
                         nmn(id)
                    end
               else
                    rp_msg2(id,"255000000","Not position stored!")
               end
          elseif sel == 2 then
               if player(id,"health")>0 then
                    local XPlayer = player(id,"tilex")
                    local YPlayer = player(id,"tiley")
                    local SafeTele = true
                    for i, v in ipairs(Config.NoTele) do
                         if (XPlayer >= v[1][1] and XPlayer <= v[2][1] and YPlayer >= v[1][2] and YPlayer <= v[2][2]) then
                              SafeTele = false
                              rp_msg2(id,"255000000","You cant set position here!")
                              break
                         end
                    end
                    if SafeTele == true then
                         rp_msg2(id,"000255000","Position stored succesfully!")
                         rp_msg2(id,"000255000","X: "..player(id,"x").." Y: "..player(id,"y"))
                         tele_x[id] = player(id,"x")
                         tele_y[id] = player(id,"y")
                         player_have_pos[id]=true
                    end
               end
          elseif sel == 3 then
               if player_have_pos[id]==true then
                    if rp_arrest[id] == true then
                         rp_msg2(id,"255000000","No phone , No TV , .. on jail")
                    else
                         if tsb[id]==0 then
                              rp_msg2(id,"000255000","You will now spawn at Teleport position!@C")
                              tsb[id]=1
                         elseif tsb[id]==1 then
                              rp_msg2(id,"000255000","You will now spawn normally!@C")
                              tsb[id]=0
                         end
                    end
               else
                    rp_msg2(id,"255000000","Not position stored!@C")
               end
          end
     end
     if men == "Drop System" then
          if sel == 1 then
               if rp_money[id]>= 100 then
                    parse("spawnitem 66 "..x.." "..y)
                    rp_money[id]=rp_money[id]-100
               else
                    nmn(id)
               end
          elseif sel == 2 then
               if rp_money[id]>= 500 then
                    parse("spawnitem 67 "..x.." "..y)
                    rp_money[id]=rp_money[id]-500
               else
                    nmn(id)
               end
          elseif sel == 3 then
               if rp_money[id]>= 1000 then
                    parse("spawnitem 68 "..x.." "..y)
                    rp_money[id]=rp_money[id]-1000
               else
                    nmn(id)
               end
          elseif sel == 4 then
               if rp_money[id]>= 5000 then
                    for i = 1,5 do
                         parse("spawnitem 68 "..x.." "..y)
                         rp_money[id]=rp_money[id]-1000
                    end
               else
                    nmn(id)
               end
          elseif sel == 5 then
               if rp_money[id]>= 10000 then
                    for i = 1,10 do
                         parse("spawnitem 68 "..x.." "..y)
                         rp_money[id]=rp_money[id]-1000
                    end
               else
                    nmn(id)
               end
          elseif sel == 6 then
               if rp_money[id]>= 50000 then
                    for i = 1,50 do
                         parse("spawnitem 68 "..x.." "..y)
                         rp_money[id]=rp_money[id]-1000
                    end
               else
                    nmn(id)
               end
          elseif sel == 7 then
               if rp_money[id]>= 100000 then
                    for i = 1,100 do
                         parse("spawnitem 68 "..x.." "..y)
                         rp_money[id]=rp_money[id]-1000
                    end
               else
                    nmn(id)
               end
          elseif sel == 8 then
               if rp_license[id]==0 then
                    if rp_money[id]>= 100000 then
                         rp_license[id]=1
                         rp_money[id]=rp_money[id]-100000
                         rp_msg2(id,"000255000","You have License now!")
                    else
                         nmn(id)
                    end
               else
                    rp_msg2(id,"255000000","You have license already!")
               end
          elseif sel == 9 then
               CreateAddonsSell(id)
          end
     end
     updatehud(id)
end

addhook("build","rp_build")
function rp_build(id,type,x,y)
     if (rp_ct[id]==true) and (rp_Adminlevel[id]>1) then
          if type == 8 then
               if not entity(x,y,"exists") then
                    parse("spawnobject 12 "..x.." "..y.." "..player(id,"rot").." 0 "..player(id,"team").." "..id)
                    return 1
               end
          elseif type == 21 then
               return 0
          else
               if not entity(x,y,"exists") then
                    parse("spawnobject "..type.." "..x.." "..y.." "..player(id,"rot").." 0 "..player(id,"team").." "..id)
                    return 1
               end
          end
     elseif rp_license[id]>0 then
          if rp_money[id]> Config.HoldMoney then
               if type == 6 then
                    rp_msg2(id,"255000000","--Forbidden Action--@C")
                    return 1
               elseif type == 8 then
                    return 1
               elseif type == 9 then
                    return 1
               end
          else
               nmn(id)
               return 1
          end
     else
          rp_msg2(id,"255000000","You must to be Licensed!@C")
          return 1
     end
     updatehud(id)
end

addhook("spawn","rp_spawn")
function rp_spawn(id)
     if rp_arrest[id]==false then
          if      team_no[id]>0 then
               parse("setpos "..id.." "..Config.Nimkat[1][1].." "..Config.Nimkat[1][2])
          elseif rp_license[id]>0 then
               if tsb[id]==1 then
                    parse("setpos "..id.." "..tele_x[id].." "..tele_y[id])
               end
               if team_no[id] == 0 then
                    for k, v in ipairs(Addons) do
                         if v.FHave[id]==true then
                              parse("speedmod "..id.." 10")
                              break
                         end
                    end
               end
          end
          parse("equip "..id.." 74")
     else
          parse("setpos "..id.." "..Config.AP[1][1].." "..Config.AP[1][2])
     end
     StateUser(id)
end

addhook("hit","rp_hit")
function rp_hit(id,source,wpn,hpdmg)
     if (team_no[id]>0) then
          if wpn==74 then
               if havebal[id]==true then
                    havebal[id]=false
                    havebal[source]=true
                    parse("equip "..source.." 75")     --add ball to source
                    parse("setweapon "..source.." 75")
                    parse("strip "..id.." 75")          --gereftan ball
                    parse("setweapon "..id.." 74")
               end
          elseif wpn==75 then
               if havebal[source]==true then
                    havebal[id]=true
                    havebal[source]=false
                    parse("equip "..id.." 75")
                    parse("setweapon "..id.." 75")
                    parse("strip "..source.." 75")
                    parse("setweapon "..source.." 74")
               end
          end
          return 1
     end
     
     if wpn == 2 then
          parse("sethealth "..id.." "..player(id,"health")+math.random(10,20))
          rp_msg2(id,"255255000","You have been healed by "..player(source,"name"))
          return 1
     elseif wpn == 74 then
          return 1
     end
end

addhook("projectile","rp_projectile")
function rp_projectile(id,wpn,x,y)
     --[[if wpn == 54 then
          parse("flashposition "..x.." "..y.." 500")
     elseif wpn == 53 then
          parse("setpos "..id.." "..x.." "..y)
     end]]--
     if team_no[id]>0 then
          if havebal[id]==true then
               if wpn==75 then
                    local xplayer = player(id,"x")
                    local yplayer = player(id,"y")
                    x=math.floor(x/32)
                    y=math.floor(y/32)
                    local ScoreTo = 0
                    for i, v in ipairs(Config.GoalP) do
                         if (x >= v[1][1] and x <= v[2][1] and y >= v[1][2] and y <= v[2][2]) then
                              ScoreTo=i
                              break
                         end
                    end
                    if ScoreTo==1 then     --RED
                         rp_msg("000128255",player(id,"name")..": Goaaaaaaaaaaaaaaaaaaaaaaaaaal")
                         FTWin[1]= FTWin[1]+1
                         updateFootbalPlayer(id)
                         if FTWin[1]==5 then
                              rp_msg("000128255","Blue Team Win (Blue "..FTWin[1].." - Red "..FTWin[2]..")")
                              EndToPlay(id)
                         else
                              parse("spawnitem 75 "..Config.BallP[1].." "..Config.BallP[2])
                         end
                    elseif ScoreTo==2 then     --Blue
                         rp_msg("255000000",player(id,"name")..": Goaaaaaaaaaaaaaaaaaaaaaaaaaal")
                         FTWin[2]= FTWin[2]+1
                         updateFootbalPlayer(id)
                         if FTWin[2]==5 then
                              rp_msg("255000000","Red Team Win (Blue "..FTWin[1].." - Red "..FTWin[2]..")")
                              EndToPlay(id)
                         else
                              parse("spawnitem 75 "..Config.BallP[1].." "..Config.BallP[2])
                         end
                    else     --Nothing!
                         if (x<Config.GroundP[1][1]) then
                              x=Config.GroundP[1][1]
                         elseif (x>Config.GroundP[2][1]) then
                              x=Config.GroundP[2][1]
                         end
                         
                         if (y<Config.GroundP[1][2]) then
                              y=Config.GroundP[1][2]
                         elseif (y>Config.GroundP[2][2]) then
                              y=Config.GroundP[2][2]
                         end
                         parse("spawnitem 75 "..x.." "..y)
                    end
                    parse("strip "..id.." 75")
                    parse("setweapon "..id.." 74")
                    havebal[id]=false
               end
          end
     end
end

--addhook("move","rp_move")
function rp_move(id,x,y,walk)
     local xs = tostring(x)
     local ys = tostring(y)
     parse('hudtxt2 '..id..' 49 "©000255100 X: '..xs..' Y: '..ys..' " 10 100')
end

addhook("use","rp_use")
function rp_use(id,event,data,x,y)
     --rp_msg("255000000","X: "..x.." Y: "..y.." Event: "..event)
     if event == 100 then          
          if (x==Config.RegisterFTBTN[1] or x==Config.RegisterFTBTN[2]) and y==Config.RegisterFTBTN[3] then
               if team_no[id]==0 then
                    FootballMenu(id)
               end
          end
     end
end

addhook("select","rp_select")
function rp_select(id,type,mode)
     if (team_no[id]>0) then
          if havebal[id]==true then
               if type~=75 then
                    if checkwep(id,75) == 1 then
                         parse("setweapon "..id.." 75")
                    end
               end
          else
               if type~=74 then
                    parse("setweapon "..id.." 74")
               end
          end
     end
end

old Re: admin.lua

KimKat
GAME BANNED Off Offline

Quote
Impressive RolePlay Lua script, I guess. Haven't tried it though, but it's one of those tibia scripts I assume.

Next time put the Lua script within the [ code ] [/ code] tags, it makes it more recognizable sort of say.

old Re: admin.lua

Hanz
User Off Offline

Quote
-Commander- has written
ADMINLUA:
drop_system_m = 1
tele_sys = 1
Mute_text= 0

function isAdmin(usgn)
     local filename = "sys/lua/Admin.txt"
     local file = io.open(filename)
     if file then
          for line in file:lines() do
               local parses = totable(line)
               if tonumber(parses[1]) ~= nil then
                    if usgn==tonumber(parses[1]) then
                         if tonumber(parses[2]) ~= nil then
                              return tonumber(parses[2])
                         else
                              return 1
                         end
                    end
               end
          end
          if file ~= nil then
               file:close()
          end
     end          
     return 0
end

function ParseAdminCommand(id,txt)
     local p = totable(txt)
     local cmd = tostring(p[1])
     if rp_Adminlevel[id]>=2 then
          if cmd =="!save" then
               if rp_Adminlevel[id]>=1 then
                    for id = 1,32 do
                         if player(id,"exists") then
                              local UsgnID = UsgnIds[id]
                              if UsgnID > 0 then
                                   SaveUserStat(id,UsgnID)
                              end
                         end
                    end
                    rp_msg2(id,"000255000","SAVE OK!")
               else
                    admlevelmsg(id)
               end
          elseif cmd =="!money" then
               if rp_Adminlevel[id]>=3 then
                    local pl = tonumber(p[2])
                    local money = tonumber(p[3])
                    if pl ~= nil and money ~= nil then
                         if player(pl,"exists") then
                              rp_money[pl]=rp_money[pl]+money
                              rp_msg2(pl,"000255000",player(id,"name").." Gave you "..money.." of money!")
                              rp_msg2(id,"000255000","You gave "..money.." to "..player(pl,"name"))
                              updatehud(pl)
                         end
                    end
               else
                    admlevelmsg(id)
               end
          elseif cmd == "!set" then
               if rp_Adminlevel[id]>=2 then
                    local pl = tonumber(p[2])
                    local item = tonumber(p[3])
                    if (pl ~= nil) and (item~=nil) then
                         if player(pl,"exists") then
                              Addons[item].FLic[pl]=1
                              rp_msg2(id,"000255000","You Give "..Addons[item].FName.." Add-ons to "..player(pl,"name"))
                              rp_msg2(pl,"000255000","You have "..Addons[item].FName.." Add-ons now, F3!")
                         end
                    end
               else
                    admlevelmsg(id)
               end
          elseif cmd == "!remove" then
               if rp_Adminlevel[id]>=3 then
                    local pl = tonumber(p[2])
                    if pl ~= nil then
                         if player(pl,"exists") then
                              InternalFreeImage(pl)
                              SetAddons(pl,0)
                         end
                    end
               else
                    admlevelmsg(id)
               end
          elseif cmd == "!ban" then
               if rp_Adminlevel[id] >=3 then
                    local pl = tonumber(p[2])
                    if pl ~= nil then
                         if player(pl,"exists") then
                              local ip = player(pl, "ip")
                              local usgn = player(pl, "usgn")
                              if ip then
                                   parse("banip "..ip)
                              end
                         end
                    end
               else
                    admlevelmsg(id)
               end
          elseif cmd == "!vip" then
               if rp_Adminlevel[id] >=2 then
                    local pl = tonumber(p[2])
                    if pl ~= nil then
                         if player(pl,"exists") then
                              rp_license[pl]=2
                              rp_msg2(id,"000255000","You Give VIP to "..player(pl,"name"))
                              rp_msg2(pl,"000255000","You are VIP USER Now")
                         end
                    end
               else
                    admlevelmsg(id)
               end

          elseif cmd =="!arrest" then
               local pl = tonumber(p[2])
               local cell = tonumber(p[3])
               if pl ~= nil then
                    if player(pl,"exists") then
                         if cell == 1 then
                              parse("setpos "..pl.." "..Config.AP[1][1].." "..Config.AP[1][2])
                         elseif cell == 2 then
                              parse("setpos "..pl.." "..Config.AP[2][1].." "..Config.AP[2][2])
                         elseif cell == 3 then
                              parse("setpos "..pl.." "..Config.AP[3][1].." "..Config.AP[3][2])
                         end
                         rp_arrest[pl]=true
                    end
               end
          elseif cmd =="!free" then
               local pl = tonumber(p[2])
               if pl ~= nil then
                    if player(pl,"exists") then
                         rp_arrest[pl]=false
                         parse("setpos "..pl.." "..Config.FP[1].." "..Config.FP[2])
                    end
               end

          elseif cmd =="!bring" then
               local pl = tonumber(p[2])
               if pl ~= nil then
                    if player(pl,"exists") then
                         parse("setpos "..pl.." "..player(id,"x").." "..player(id,"y"))
                    else
                         rp_msg2(id,"255000000","This player does not exist!")
                    end
               end
          elseif cmd == "!goto" then
               local pl = tonumber(p[2])
               if pl ~= nil then
                    if player(pl,"exists") then
                         parse("setpos "..id.." "..player(pl,"x").." "..player(pl,"y"))
                    else
                         rp_msg2(id,"255000000","This player does not exist!")
                    end
               end
          elseif cmd == "!kick" then
               local pl = tonumber(p[2])
               if pl ~= nil then
                    if player(pl,"exists") then
                         parse("kick "..pl)
                    end
               end
          else
               rp_msg2(id,"255000000","Unknown Command !")
          end
     else
          admlevelmsg(id)
     end
end

function admlevelmsg(id)
     rp_msg2(id,"255000000","You can´t use this Command! Your Level is to low")
end

MAINLUA

dofile("sys/lua/extras.lua")
dofile("sys/lua/functions.lua")
dofile("sys/lua/config.lua")
dofile("sys/lua/addons.lua")
dofile("sys/lua/Admin.lua")
dofile("sys/lua/users.lua")
dofile("sys/lua/setting.lua")
dofile("sys/lua/funcFootbal.lua")

UpdateHudeImages()

rp_ct            = Array(32,false)
rp_Adminlevel = Array(32,0)
rp_license       = Array(32,0)
rp_money       = Array(32,100)
rp_arrest       = Array(32,false)
rp_vipmsg       = Array(32,0)
rp_vipaddons = Array(32,0)
rp_NextAddons = Array(32,0)
UsgnIds = Array(32, 0)
PicImage = Array(32, 0)
--footbal--
team_no = Array(32,0)
havebal = Array(32,false)
FTWin      = Array(2,1)
-----------
tsb = Array(32,0)
player_have_pos = Array(32,false)
tele_x = Array(32,0)
tele_y = Array(32,0)

function InternalFreeImage(id)
     if (team_no[id]>0) then
          freeimage(PicImage[id])
          team_no[id]=0
     else
          for k, v in ipairs(Addons) do
               if v.FHave[id]==1 then
                    freeimage(PicImage[id])
                    v.FHave[id]=0
               end
          end
     end
end

addhook("join","rp_load")
function rp_load(id)
     rp_license[id]=0
     rp_ct[id]=false
     rp_Adminlevel[id]=0
     rp_arrest[id]=false
     player_have_pos[id]=false
     tele_x[id]=800
     tele_y[id]=200
     rp_money[id]=100
     UsgnIds[id]= 0
     rp_vipmsg[id]=0
     rp_vipaddons[id]=0
     rp_NextAddons[id]=0
     InternalFreeImage(id)
     InternalFreeAddons(id)

     local UsgnID = player(id,"usgn")
     UsgnIds[id] = 0
     if UsgnID > 0 then
          local sameusgn = false
          for ids = 1,32 do
               if ids~=id then
                    if UsgnIds[ids]==UsgnID then
                         sameusgn=true
                         break
                    end
               end
          end
          if sameusgn==false then
               rp_msg2(id,"000255000","Login with "..UsgnID)
               rp_Adminlevel[id]= isAdmin(UsgnID)
               if rp_Adminlevel[id]>0 then
                    rp_ct[id]=true
                    rp_license[id]=3
                    SetAddons(id,1)
                    rp_msg2(id,"000255000","Welcome on the Server, Teammember!")
               else
                    local filename = "sys/lua/rp_citylife/"..UsgnID..".txt"
                    local file = io.open(filename)
                    if file then
                         LoadUserStat(id,file)
                         rp_msg2(id,"000255000","Load Successfully!")
                         if file ~= nil then
                              file:close()
                         end
                    end
               end
               UsgnIds[id] = UsgnID
          else
               rp_msg2(id,"255000000","Load fail!")
          end
     else
          rp_msg2(id,"255000000","Please register a U.S.G.N. account at http://www.unrealsoftware.de/ and make sure that you are logged in!")
          rp_msg2(id,"255000000","Your money and license not save on Database")
     end
end

addhook("team","rp_team")
function rp_team(id,t)
     if t == 2 and rp_ct[id]==true then
          return 0
     elseif t == 2 and rp_ct[id]==false then
          parse("maket "..id)
          return 1
     elseif (t>0) and (rp_arrest[id]==true) then     
          rp_msg2(id,"255000000","STOP! You aren´t a CT!")
          rp_msg2(id,"255000000","Apply at: jkgaming.de.to")
          return 1
     end
end

addhook("leave","rp_leave")
function rp_leave(id)
     local UsgnID = UsgnIds[id]
     if UsgnID > 0 then
          SaveUserStat(id,UsgnID)
end
     rp_license[id]=0
     rp_ct[id]=false
     rp_Adminlevel[id]=0
     rp_arrest[id]=false
     player_have_pos[id]=false
     tele_x[id]=800
     tele_y[id]=200
     rp_money[id]=100
     UsgnIds[id]= 0
     rp_vipmsg[id]=0
     rp_vipaddons[id]=0
     rp_NextAddons[id]=0
     x = player(id,"tilex")
     y = player(id,"tiley")
     if havebal[id]==true then
          parse("spawnitem 75 "..x.." "..y)
     end
     havebal[id]=false
     InternalFreeImage(id)
     InternalFreeAddons(id)
end

addhook("startround","rp_startround")
function rp_startround(mode)
     for id = 1,32 do
          if player(id,"exists") then
               player_have_pos[id]=false
               tele_x[id]=800
               tele_y[id]=200
               havebal[id]=false
               FTWin[1]=0
               FTWin[2]=0
               InternalFreeImage(id)
          end
     end
     UpdateHudeImages()
end

function updatehud(id)
     if id ~= nil then
          if player(id,"exists") then
               if (team_no[id]~=nil) and (team_no[id]>0) then
                    hudtext2(id,id+2,"000128255","Blue Team: "..FTWin[1],14,179)
                    hudtext2(id,id+3,"255000000","Red Team: "..FTWin[2],14,194)
               else
                    hudtext2(id,id,"255255255","Money: "..rp_money[id],500,368)
               end
          end
     end
end

addhook("attack","rp_attack")
function rp_attack(id)
     if rp_ct[id] == true then
          local w = player(id,"weapontype")
          if w > 0 then
               parse("equip "..id.." "..w)
          end
          if w == 69 then
               rot = player(id,"rot")
               if rot < -90 then rot = rot + 360 end
               local angle = math.rad(math.abs(rot + 90)) - math.pi
               local x = player(id,"x") + math.cos(angle) * itemtype(w,"dmg") / 2
               local y = player(id,"y") + math.sin(angle) * itemtype(w,"dmg") / 2
               if x > 0 and y > 0 and x < map("xsize") * 32 and y < map("ysize") * 32 then
                    parse("explosion "..x.." "..y.." 32 10000000 "..id)
               end
          end
     end
end

addhook("say","rp_say")
function rp_say(id,txt)
     if rp_ct[id]==true then
          if txt:sub(1,1)=="!" then
               print(player(id,'name')..' used a command:'..txt)
               ParseAdminCommand(id,txt)
               return 1
          end
     end
     
     if txt:sub(1,1)=="@" then
          local p = totable(txt)
          local cmd = string.lower(tostring(p[1]))
          for k, v in pairs(cmd_param) do
               --rp_msg2(id,"255000000",""..string.lower(string.sub(txt, #cmd+1, #txt)))
               if cmd==v then
                    txt = string.sub(txt, #cmd+2, #txt)
                    ExecuteParam(id,cmd,txt)
                    return 1
               end
          end
     end

          if Mute_text==1 then
          rp_msg2(id,"255000000","Mute Mode! Use Teamchat please!")
          return 1
     end
     
     if rp_vipmsg[id]>0 then
          rp_msg("000255255",player(id,"name").."(VIP): "..txt)
          rp_vipmsg[id]=0
          return 1
     end
end

addhook("kill","rp_kill")
function rp_kill(killer,victim,wpn)
     if rp_ct[killer]==true then
          rp_money[killer]=rp_money[killer]+300
          rp_money[victim]=rp_money[victim]-100
     else
          if killer~=victim then
               if checkbound(victim,Config.Bounce) then
                    local PScore = player(killer,"score")
                    rp_msg2(killer,"255000000",PScore)
                    if PScore+1 >= 0 then
                         parse("setmoney "..killer.." "..Config.HoldMoney)
                         parse("setscore "..killer.." "..PScore+2)
                         rp_money[killer]=rp_money[killer]+2000
                         rp_money[victim]=rp_money[victim]-1000     
                    else
                         parse("setscore "..killer.." 0")
                    end
               else
                    rp_money[killer]=rp_money[killer]-50
                    rp_money[victim]=rp_money[victim]+50
               end
          end
     end
     updatehud(killer)
     updatehud(victim)
end

addhook("minute","rp_minute")
function rp_minute()
     for id = 1,32 do
          if player(id,"exists") then
               if player(id,"health")>0 then
                    if rp_ct[id]==true then
                         rp_money[id]=rp_money[id]+5000
                         rp_msg2(id,"255255000","$5000 PAYDAY!")
                    else
                         if rp_license[id]>1 then
                              rp_money[id]=rp_money[id]+1000
                              rp_msg2(id,"000255000","$1000 PAYDAY!@C")
                         else
                              rp_money[id]=rp_money[id]+500
                              rp_msg2(id,"000255000","500 PAYDAY!@C")
                         end
                    end
               end
          end
          updatehud(id)
     end
end

addhook("second","rp_second")
function rp_second()
     for id = 1,32 do
          if player(id,"exists") then
               if player(id,"health")>0 then
                    local usermoney = player(id,"money")
                    if usermoney > Config.HoldMoney then
                         rp_money[id]=rp_money[id]+(usermoney-Config.HoldMoney)
                         parse("setmoney "..id.." "..Config.HoldMoney)
                         updatehud(id)
                    elseif usermoney == Config.HoldMoney then
                         
                    else
                         if rp_money[id] > usermoney then
                              rp_money[id]=rp_money[id]-(Config.HoldMoney-usermoney)
                              parse("setmoney "..id.." "..Config.HoldMoney)
                              updatehud(id)
                         end
                    end
               end
          end
     end

     local t = item(0,"table")
for i=1,#t do
local typeid = item(t[i],"type")
if typeid == 61 or typeid == 62 then
removeitem(t[i])
end
end
end

addhook("walkover","rp_walkover")
function rp_walkover(id,iid,type,ain,a,mode)
     if type==66 then
          if player(id,"money") >= Config.HoldMoney then
               rp_money[id]=rp_money[id]+100
               if Config.SilentMode==true then
                    removeitem(iid)
               else
                    parse ("setmoney "..id.." "..player(id,"money")-100)
               end
               updatehud(id)
               if Config.SilentMode==true then     
                    return 1
               end
          else
               return 0
          end
     elseif type==67 then
          if player(id,"money") >= Config.HoldMoney then
               rp_money[id]=rp_money[id]+500
               if Config.SilentMode==true then
                    removeitem(iid)
               else
                    parse ("setmoney "..id.." "..player(id,"money")-500)
               end
               updatehud(id)
               if Config.SilentMode==true then
                    return 1
               end
          else
               return 0
          end
     elseif type==68 then
          if player(id,"money") >= Config.HoldMoney then
               rp_money[id]=rp_money[id]+1000
               if Config.SilentMode==true then
                    removeitem(iid)
               else
                    parse ("setmoney "..id.." "..player(id,"money")-1000)
               end
               updatehud(id)
               if Config.SilentMode==true then
                    return 1
               end
          else
               return 0
          end
     elseif type==75 then
          if team_no[id]>0 then
               if havebal[id]==false then
                    havebal[id]=true
                    parse("equip "..id.." 75")
                    parse("setweapon "..id.." 75")
                    removeitem(iid)
                    return 1
               end
          else
               return 1
          end
     elseif type == 61 or type == 62 then
removeitem(iid)
return 1
     else
          return 0
     end
end

addhook("die","rp_die")
function rp_die(victim,killer,weapon,x,y)
     --rp_msg2(killer,"255255000","killer: "..killer.." victim"..victim)
     if rp_arrest[victim]==true then
          parse("spawnplayer "..victim.." "..Config.AP[1][1].." "..Config.AP[1][2])
          parse("setdeaths "..victim.." "..player(victim,"deaths")-1)
     end
     
     if havebal[victim]==true then
          local XTitle= math.floor(x/32)
          local YTitle= math.floor(y/32)
          parse("spawnitem 75 "..XTitle.." "..YTitle)
          havebal[victim]=false
     end
     return 1
end

addhook("serveraction","rp_action")
function rp_action(id,a)
     if a == 1 then
          if drop_system_m == 1 then
               menu(id,"Drop System,$100,$500,$1000,$5000,$10000,$50000,$100000,Buy License|100k, Buy Add-ons|>>")
          else
               rp_msg2(id,"255000000","Drop System is off!@C")
          end
     elseif a == 2 then
          if rp_ct[id]==true then
               menu(id,"CT Menu,Settings,Teleport,License System,Commands,VIP,Football,Add-ons,Add-ons Setting")
          else
               if tele_sys == 1 then
                    if rp_license[id]>0 then
                         if rp_arrest[id] == true then
                              rp_msg2(id,"255000000","No phone , TV , .. on jail")
                         else
                              if team_no[id]==0 then
                                   menu(id,"T Menu,Teleport,Add-ons,Add-ons Setting,VIP")
                              else
                                   rp_msg2(id,"255000000","You cant use licenced now")
                              end
                         end
                    else
                         rp_msg2(id,"255000000","You must to be licenced!")
                    end
               end
          end
     elseif a == 3 then
          if (rp_ct[id]==true) and (rp_Adminlevel[id]>1) then
               local rot = player(id,"rot")
               if rot < -90 then rot = rot + 360 end
               local angle = math.rad(math.abs( rot + 90 )) - math.pi
               local x = player(id,"x") + math.cos(angle) * 10
               local y = player(id,"y") + math.sin(angle) * 10
               if x > 0 and y > 0 and x < map("xsize") * 32 and y < map("ysize") * 32 then
                    parse("setpos "..id.." "..x.." "..y)
               end
          end
     end
end

addhook("drop","rp_drop")
function rp_drop(id,iid,type,ain,a,mode,x,y)
     if havebal[id]==true then
          parse("strip "..id.." "..type)
          parse("spawnitem "..type.." "..x.." "..y)
          havebal[id]=false
          return 1
     end
     for k, v in ipairs(Addons) do
          if v.FHave[id]==1 then
               if v.wpn == type then
                    rp_msg2(id,"255000000","you cant drop Add-ons item!")
                    return 1
               end
          end
     end
end

function gv_ls(id,pl,page)
     if rp_license[pl]>0 then
          rp_license[pl]=0
          player_have_pos[pl]=false
          tele_x[pl]=800
          tele_y[pl]=200
          rp_msg2(pl,"255000000","your license Removed!")
          rp_msg2(id,"255000000","You Remove license to "..player(pl,"name").."!")
     else
          rp_license[pl]=1
          rp_msg2(pl,"000255000",player(id,"name").." Gave you license!")
          rp_msg2(id,"000255000","You gave license to "..player(pl,"name").."!")
     end
     if page == 1 then
          ls_1(id)
     elseif page == 2 then
          ls_2(id)
     elseif page == 3 then
          ls_3(id)
     elseif page == 4 then
          ls_4(id)
     elseif page == 5 then
          ls_5(id)
     end
end


function gv_vip(id,pl,page)
     if rp_vip[pl]>0 then
          rp_vip[pl]=0
          player_have_pos[pl]=false
          tele_x[pl]=800
          tele_y[pl]=200
          rp_msg2(pl,"255000000","your license Removed!")
          rp_msg2(id,"255000000","You Remove license to "..player(pl,"name").."!")
     else
          rp_license[pl]=1
          rp_msg2(pl,"000255000",player(id,"name").." Gave you license!")
          rp_msg2(id,"000255000","You gave license to "..player(pl,"name").."!")
     end
     if page == 1 then
          ls_1(id)
     elseif page == 2 then
          ls_2(id)
     elseif page == 3 then
          ls_3(id)
     elseif page == 4 then
          ls_4(id)
     elseif page == 5 then
          ls_5(id)
     end
end
function set_men(id)
     menu(id,"CT Menu Settings,Drop System|("..drop_system_m.."),Teleport System & Arrest|("..tele_sys.."),Mute |("..(Mute_text).."),Shake, Air Strik,Restart")
end

function CreateAddonsSetting(id)
     menu(id,"Add-ons Setting,Change Color|>>,VIP Skin(VIP)|("..rp_vipaddons[id]..")")
end

function FootballMenu(id)
     local Blueplayer=bluePl(id)
     local Redplayer=redPl(id)
     local TmpStr = ""
     if rp_ct[id]==true then
          if rp_Adminlevel[id]>=2 then
               TmpStr=", Start Game, End Game"
          end
     end
     menu(id,"Footbal, Blue Player ("..Blueplayer.."),Red Player ("..Redplayer..")"..TmpStr)
end

addhook("menu","rp_menu")
function rp_menu(id,men,sel)
     x = player(id,"tilex")
     y = player(id,"tiley")
     if rp_ct[id]==true then
          if men == "License System Page 5" then
               if sel == 1 then
                    gv_ls(id,29,5)
               elseif sel == 2 then
                    gv_ls(id,30,5)
               elseif sel == 3 then
                    gv_ls(id,31,5)
               elseif sel == 4 then
                    gv_ls(id,32,5)
               elseif sel == 7 then
                    ls_4(id)
               end
          end
          if men == "License System Page 4" then
               if sel == 1 then
                    gv_ls(id,22,4)
               elseif sel == 2 then
                    gv_ls(id,23,4)
               elseif sel == 3 then
                    gv_ls(id,24,4)
               elseif sel == 4 then
                    gv_ls(id,25,4)
               elseif sel == 5 then
                    gv_ls(id,26,4)
               elseif sel == 6 then
                    gv_ls(id,27,4)
               elseif sel == 7 then
                    gv_ls(id,28,4)
               elseif sel == 8 then
                    ls_3(id)
               elseif sel == 9 then
                    ls_5(id)
               end
          end
          if men == "License System Page 3" then
               if sel == 1 then
                    gv_ls(id,15,3)
               elseif sel == 2 then
                    gv_ls(id,16,3)
               elseif sel == 3 then
                    gv_ls(id,17,3)
               elseif sel == 4 then
                    gv_ls(id,18,3)
               elseif sel == 5 then
                    gv_ls(id,19,3)
               elseif sel == 6 then
                    gv_ls(id,20,3)
               elseif sel == 7 then
                    gv_ls(id,21,3)
               elseif sel == 8 then
                    ls_2(id)
               elseif sel == 9 then
                    ls_4(id)
               end
          end
          if men == "License System Page 2" then
               if sel == 1 then
                    gv_ls(id,8,2)
               elseif sel == 2 then
                    gv_ls(id,9,2)
               elseif sel == 3 then
                    gv_ls(id,10,2)
               elseif sel == 4 then
                    gv_ls(id,11,2)
               elseif sel == 5 then
                    gv_ls(id,12,2)
               elseif sel == 6 then
                    gv_ls(id,13,2)
               elseif sel == 7 then
                    gv_ls(id,14,2)
               elseif sel == 8 then
                    ls_1(id)
               elseif sel == 9 then
                    ls_3(id)
               end
          end
          if men == "License System Page 1" then
               if sel == 1 then
                    gv_ls(id,1,1)
               elseif sel == 2 then
                    gv_ls(id,2,1)
               elseif sel == 3 then
                    gv_ls(id,3,1)
               elseif sel == 4 then
                    gv_ls(id,4,1)
               elseif sel == 5 then
                    gv_ls(id,5,1)
               elseif sel == 6 then
                    gv_ls(id,6,1)
               elseif sel == 7 then
                    gv_ls(id,7,1)
               elseif sel == 8 then
                    menu(id,"CT Menu,Settings,Teleport,License System,Commands,,VIP,Football,Add-ons,Add-ons Setting")
               elseif sel == 9 then
                    ls_2(id)
               end
          end
          if men == "CT Menu" then
               if sel == 1 then
                    if rp_Adminlevel[id]>=3 then
                         set_men(id)
                    else
                         admlevelmsg(id)
                    end
               elseif sel == 2 then
                    if tele_sys == 1 then
                         menu(id,"Teleport Menu,Go to position,Set Current Position,Toggle Spawn Behavior ("..tsb[id]..")")
                    else
                         rp_msg2(id,"255000000","Teleport System is Disabled!")
                    end
               elseif sel == 3 then
                    if rp_Adminlevel[id]>=2 then
                         ls_1(id)
                    else
                         admlevelmsg(id)
                    end
               elseif sel == 4 then
                    rp_msg2(id,"000255000","Command: !bring <player>")
                    rp_msg2(id,"000255000","Command: !goto <player>")
                    rp_msg2(id,"000255000","Command: !arrest <player> <Cell>")
                    rp_msg2(id,"000255000","Command: !free <player>")
                    rp_msg2(id,"000255000","Command: !money <player> <money>")
                    rp_msg2(id,"000255000","Command: !save = Save Game")
               elseif sel == 5 then
                    menu(id,"VIP USER,Go to VIP House,VIP Message,Laser|50k")
               elseif sel == 6 then
                    FootballMenu(id)
               elseif sel == 7 then
                    CreateAddonsMenu(id)
               elseif sel == 8 then
                    CreateAddonsSetting(id)
               end
          end
          
          if men == "CT Menu Settings" then
               if sel == 1 then
                    if drop_system_m == 1 then
                         drop_system_m = 0
                         rp_msg("255000000","Drop system disabled. Called by "..player(id,"name").."@C")
                    elseif drop_system_m == 0 then
                         drop_system_m = 1
                         rp_msg("000255000","Drop system enabled. Called by "..player(id,"name").."@C")
                    end
                    set_men(id)
               elseif sel == 2 then
                    if tele_sys == 1 then
                         tele_sys = 0
                         rp_msg("255000000","Teleport system disabled. Called by "..player(id,"name").."@C")
                    elseif tele_sys == 0 then
                         tele_sys = 1
                         rp_msg("000255000","Drop system enabled. Called by "..player(id,"name").."@C")
                    end
               elseif sel == 3 then
                    if Mute_text==0 then
                         Mute_text = 1
                         rp_msg("000255000","Mute Mode enabled by "..player(id,"name").."@C")
                    else
                         Mute_text = 0
                         rp_msg("000255000","Mute Mode disabled by "..player(id,"name").."@C")
                    end
               elseif sel == 4 then
                    for _, ids in ipairs(player(0,'table')) do
                         parse("shake "..ids.." "..60)
                    end
                    parse("sv_sound weapons/explode1.wav")
               elseif sel == 5 then
                    parse('trigger bom1s')
               elseif sel == 6 then
                    parse('restart 5')
               end
          end
     end
     if men == "Add-ons Menu" then
          if sel>0 then
               SelAddonsMenu(id,sel)
          end
     end
     if men == "Buy Add-ons" then
          if sel>0 then
               if Addons[sel].FLic[id] == 0 then
                    if rp_money[id]>= Addons[sel].FPrice then
                         Addons[sel].FLic[id]=1
                         rp_money[id]=rp_money[id]-Addons[sel].FPrice
                         rp_msg2(id,"000255000","You have "..Addons[sel].FName.." Add-ons now!")
                    else
                         nmn(id)
                    end
               else
                    rp_msg2(id,"255000000","You have "..Addons[sel].FName.." Add-ons already!")
               end
          end
     end
     
     if men == "Add-ons Setting" then
          if sel == 1 then
               CreateAddonsColor(id)
          elseif sel == 2 then
               if rp_license[id]>1 then
                    if rp_vipaddons[id]==0 then
                         rp_vipaddons[id]=1
                    else
                         rp_vipaddons[id]=0
                    end
               else
                    rp_msg2(id,"255000000","You are not VIP user")
               end
          end
     end
     
     if men == "Add-ons Color" then
          if sel>0 then
               selAddonsColor(id,sel)
          end
     end
     
     if men == "Footbal" then
          if (team_no[id]==0) or (rp_ct[id]==true) then
               SelFootballMenu(id,sel)
          else
               rp_msg2(id,"255000000","You cant choice team again")
          end
     end     
     
     if men == "T Menu" then
          if sel == 1 then
               if tele_sys == 1 then
                    if rp_license[id]>0 then
                         menu(id,"Teleport Menu@b,Go to position,Set Current Position,Toggle Spawn Behavior ("..tsb[id]..")")
                    else
                         rp_msg2(id,"255000000","You must to be licenced!")
                    end
               else
                    rp_msg2(id,"255000000","Teleport System is Disabled!")
               end
          elseif sel == 2 then
               CreateAddonsMenu(id)
          elseif sel == 3 then
               CreateAddonsSetting(id)
          elseif sel == 4 then
               if rp_license[id]>1 then
                    menu(id,"VIP USER,Go to VIP House,VIP Message,Laser|50k")
               else
                    rp_msg2(id,"255000000","You are not VIP user")
               end
          end
     end
     if men == "VIP USER" then
          if rp_license[id]>1 then
               if sel == 1 then
                    parse("setpos "..id.." "..Config.VIPHOUSE[1].." "..Config.VIPHOUSE[2])
               elseif sel == 2 then
                    rp_msg2(id,"000255000","Type your message")
                    rp_vipmsg[id]=1
               elseif sel == 3 then
                    if rp_money[id]>= 50000 then
                         parse("equip "..id.." "..45)
                         rp_money[id]=rp_money[id]-50000
                         updatehud(id)
                    else
                         nmn(id)
                    end
               end
          end
     end
     
     if men == "Teleport Menu" then
          if sel == 1 then
               if player_have_pos[id]==true then
                    if rp_money[id]>=0 then
                         if rp_license[id]>0 then
                              parse("setpos "..id.." "..tele_x[id].." "..tele_y[id])
                         end
                    else
                         nmn(id)
                    end
               else
                    rp_msg2(id,"255000000","Not position stored!")
               end
          elseif sel == 2 then
               if player(id,"health")>0 then
                    local XPlayer = player(id,"tilex")
                    local YPlayer = player(id,"tiley")
                    local SafeTele = true
                    for i, v in ipairs(Config.NoTele) do
                         if (XPlayer >= v[1][1] and XPlayer <= v[2][1] and YPlayer >= v[1][2] and YPlayer <= v[2][2]) then
                              SafeTele = false
                              rp_msg2(id,"255000000","You cant set position here!")
                              break
                         end
                    end
                    if SafeTele == true then
                         rp_msg2(id,"000255000","Position stored succesfully!")
                         rp_msg2(id,"000255000","X: "..player(id,"x").." Y: "..player(id,"y"))
                         tele_x[id] = player(id,"x")
                         tele_y[id] = player(id,"y")
                         player_have_pos[id]=true
                    end
               end
          elseif sel == 3 then
               if player_have_pos[id]==true then
                    if rp_arrest[id] == true then
                         rp_msg2(id,"255000000","No phone , No TV , .. on jail")
                    else
                         if tsb[id]==0 then
                              rp_msg2(id,"000255000","You will now spawn at Teleport position!@C")
                              tsb[id]=1
                         elseif tsb[id]==1 then
                              rp_msg2(id,"000255000","You will now spawn normally!@C")
                              tsb[id]=0
                         end
                    end
               else
                    rp_msg2(id,"255000000","Not position stored!@C")
               end
          end
     end
     if men == "Drop System" then
          if sel == 1 then
               if rp_money[id]>= 100 then
                    parse("spawnitem 66 "..x.." "..y)
                    rp_money[id]=rp_money[id]-100
               else
                    nmn(id)
               end
          elseif sel == 2 then
               if rp_money[id]>= 500 then
                    parse("spawnitem 67 "..x.." "..y)
                    rp_money[id]=rp_money[id]-500
               else
                    nmn(id)
               end
          elseif sel == 3 then
               if rp_money[id]>= 1000 then
                    parse("spawnitem 68 "..x.." "..y)
                    rp_money[id]=rp_money[id]-1000
               else
                    nmn(id)
               end
          elseif sel == 4 then
               if rp_money[id]>= 5000 then
                    for i = 1,5 do
                         parse("spawnitem 68 "..x.." "..y)
                         rp_money[id]=rp_money[id]-1000
                    end
               else
                    nmn(id)
               end
          elseif sel == 5 then
               if rp_money[id]>= 10000 then
                    for i = 1,10 do
                         parse("spawnitem 68 "..x.." "..y)
                         rp_money[id]=rp_money[id]-1000
                    end
               else
                    nmn(id)
               end
          elseif sel == 6 then
               if rp_money[id]>= 50000 then
                    for i = 1,50 do
                         parse("spawnitem 68 "..x.." "..y)
                         rp_money[id]=rp_money[id]-1000
                    end
               else
                    nmn(id)
               end
          elseif sel == 7 then
               if rp_money[id]>= 100000 then
                    for i = 1,100 do
                         parse("spawnitem 68 "..x.." "..y)
                         rp_money[id]=rp_money[id]-1000
                    end
               else
                    nmn(id)
               end
          elseif sel == 8 then
               if rp_license[id]==0 then
                    if rp_money[id]>= 100000 then
                         rp_license[id]=1
                         rp_money[id]=rp_money[id]-100000
                         rp_msg2(id,"000255000","You have License now!")
                    else
                         nmn(id)
                    end
               else
                    rp_msg2(id,"255000000","You have license already!")
               end
          elseif sel == 9 then
               CreateAddonsSell(id)
          end
     end
     updatehud(id)
end

addhook("build","rp_build")
function rp_build(id,type,x,y)
     if (rp_ct[id]==true) and (rp_Adminlevel[id]>1) then
          if type == 8 then
               if not entity(x,y,"exists") then
                    parse("spawnobject 12 "..x.." "..y.." "..player(id,"rot").." 0 "..player(id,"team").." "..id)
                    return 1
               end
          elseif type == 21 then
               return 0
          else
               if not entity(x,y,"exists") then
                    parse("spawnobject "..type.." "..x.." "..y.." "..player(id,"rot").." 0 "..player(id,"team").." "..id)
                    return 1
               end
          end
     elseif rp_license[id]>0 then
          if rp_money[id]> Config.HoldMoney then
               if type == 6 then
                    rp_msg2(id,"255000000","--Forbidden Action--@C")
                    return 1
               elseif type == 8 then
                    return 1
               elseif type == 9 then
                    return 1
               end
          else
               nmn(id)
               return 1
          end
     else
          rp_msg2(id,"255000000","You must to be Licensed!@C")
          return 1
     end
     updatehud(id)
end

addhook("spawn","rp_spawn")
function rp_spawn(id)
     if rp_arrest[id]==false then
          if      team_no[id]>0 then
               parse("setpos "..id.." "..Config.Nimkat[1][1].." "..Config.Nimkat[1][2])
          elseif rp_license[id]>0 then
               if tsb[id]==1 then
                    parse("setpos "..id.." "..tele_x[id].." "..tele_y[id])
               end
               if team_no[id] == 0 then
                    for k, v in ipairs(Addons) do
                         if v.FHave[id]==true then
                              parse("speedmod "..id.." 10")
                              break
                         end
                    end
               end
          end
          parse("equip "..id.." 74")
     else
          parse("setpos "..id.." "..Config.AP[1][1].." "..Config.AP[1][2])
     end
     StateUser(id)
end

addhook("hit","rp_hit")
function rp_hit(id,source,wpn,hpdmg)
     if (team_no[id]>0) then
          if wpn==74 then
               if havebal[id]==true then
                    havebal[id]=false
                    havebal[source]=true
                    parse("equip "..source.." 75")     --add ball to source
                    parse("setweapon "..source.." 75")
                    parse("strip "..id.." 75")          --gereftan ball
                    parse("setweapon "..id.." 74")
               end
          elseif wpn==75 then
               if havebal[source]==true then
                    havebal[id]=true
                    havebal[source]=false
                    parse("equip "..id.." 75")
                    parse("setweapon "..id.." 75")
                    parse("strip "..source.." 75")
                    parse("setweapon "..source.." 74")
               end
          end
          return 1
     end
     
     if wpn == 2 then
          parse("sethealth "..id.." "..player(id,"health")+math.random(10,20))
          rp_msg2(id,"255255000","You have been healed by "..player(source,"name"))
          return 1
     elseif wpn == 74 then
          return 1
     end
end

addhook("projectile","rp_projectile")
function rp_projectile(id,wpn,x,y)
     --[[if wpn == 54 then
          parse("flashposition "..x.." "..y.." 500")
     elseif wpn == 53 then
          parse("setpos "..id.." "..x.." "..y)
     end]]--
     if team_no[id]>0 then
          if havebal[id]==true then
               if wpn==75 then
                    local xplayer = player(id,"x")
                    local yplayer = player(id,"y")
                    x=math.floor(x/32)
                    y=math.floor(y/32)
                    local ScoreTo = 0
                    for i, v in ipairs(Config.GoalP) do
                         if (x >= v[1][1] and x <= v[2][1] and y >= v[1][2] and y <= v[2][2]) then
                              ScoreTo=i
                              break
                         end
                    end
                    if ScoreTo==1 then     --RED
                         rp_msg("000128255",player(id,"name")..": Goaaaaaaaaaaaaaaaaaaaaaaaaaal")
                         FTWin[1]= FTWin[1]+1
                         updateFootbalPlayer(id)
                         if FTWin[1]==5 then
                              rp_msg("000128255","Blue Team Win (Blue "..FTWin[1].." - Red "..FTWin[2]..")")
                              EndToPlay(id)
                         else
                              parse("spawnitem 75 "..Config.BallP[1].." "..Config.BallP[2])
                         end
                    elseif ScoreTo==2 then     --Blue
                         rp_msg("255000000",player(id,"name")..": Goaaaaaaaaaaaaaaaaaaaaaaaaaal")
                         FTWin[2]= FTWin[2]+1
                         updateFootbalPlayer(id)
                         if FTWin[2]==5 then
                              rp_msg("255000000","Red Team Win (Blue "..FTWin[1].." - Red "..FTWin[2]..")")
                              EndToPlay(id)
                         else
                              parse("spawnitem 75 "..Config.BallP[1].." "..Config.BallP[2])
                         end
                    else     --Nothing!
                         if (x<Config.GroundP[1][1]) then
                              x=Config.GroundP[1][1]
                         elseif (x>Config.GroundP[2][1]) then
                              x=Config.GroundP[2][1]
                         end
                         
                         if (y<Config.GroundP[1][2]) then
                              y=Config.GroundP[1][2]
                         elseif (y>Config.GroundP[2][2]) then
                              y=Config.GroundP[2][2]
                         end
                         parse("spawnitem 75 "..x.." "..y)
                    end
                    parse("strip "..id.." 75")
                    parse("setweapon "..id.." 74")
                    havebal[id]=false
               end
          end
     end
end

--addhook("move","rp_move")
function rp_move(id,x,y,walk)
     local xs = tostring(x)
     local ys = tostring(y)
     parse('hudtxt2 '..id..' 49 "©000255100 X: '..xs..' Y: '..ys..' " 10 100')
end

addhook("use","rp_use")
function rp_use(id,event,data,x,y)
     --rp_msg("255000000","X: "..x.." Y: "..y.." Event: "..event)
     if event == 100 then          
          if (x==Config.RegisterFTBTN[1] or x==Config.RegisterFTBTN[2]) and y==Config.RegisterFTBTN[3] then
               if team_no[id]==0 then
                    FootballMenu(id)
               end
          end
     end
end

addhook("select","rp_select")
function rp_select(id,type,mode)
     if (team_no[id]>0) then
          if havebal[id]==true then
               if type~=75 then
                    if checkwep(id,75) == 1 then
                         parse("setweapon "..id.." 75")
                    end
               end
          else
               if type~=74 then
                    parse("setweapon "..id.." 74")
               end
          end
     end
end


commander you always said it's your lua script but it's not! it's made by blocker not you

spartan" nice lua -.-? it's not his lua

old Re: admin.lua

DannyDeth
User Off Offline

Quote
Dude, why the hell are you quoting a post like that? Couldn't you of used @? I mean seriously, it took me like 5 minutes to scroll down to reply.

On-topic:
What are you talking about? Are you saying that your script is erroring or what? Give some info, or no one can help you.
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview