Advertisement
Guest User

CTF Lobby Mod

a guest
Nov 21st, 2019
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.46 KB | None | 0 0
  1. ```Lua
  2.     CTF.Register                                        = function(Player)
  3.         local PID                                       = GetRoleID(Player)
  4.         local IP                                        = GetAccountIP(Player)
  5.         local MAC                                       = GetAccountMac(Player)
  6.         local OsTime                                    = os.time()
  7.         local Attempt                                   = CTF.LeaveTime[PID]
  8.         if GetChaAttr(Player, ATTR_JOB) < 8 then
  9.             BickerNotice(Player, "Only characters that have done 2nd class advancement can participate!")
  10.             return
  11.         end
  12.         if CTF.OpenDay() == 0 then
  13.             BickerNotice(Player, "Registering for "..CTF.Conf.MapName.." is unavailable today, please come back again tommorow.")
  14.             return
  15.         end
  16.         -- Checking if player mac same from registered character and playerid different from registered.
  17.         if CTF.EnterLobby[IP].MAC == MAC and CTF.EnterLobby[IP].PlayerID ~= PID then
  18.             BickerNotice(Player, "Alts are not allowed to enter!")
  19.             return
  20.         end
  21.         -- Not registered and battle arealdy started.  
  22.         if CTF.EnterLobby[IP] == nil and CTF.MapOpened == true then
  23.             BickerNotice(Player, "You can't participate, the battle arealdy started!")
  24.             return
  25.         end
  26.         -- Registered, battle started and didn't DC on map.
  27.         if CTF.EnterLobby[IP].PlayerID == PID and CTF.MapOpened == true and Attempt == nil then
  28.             StartPlayerCTF(Player)
  29.             return
  30.         end
  31.         -- Registered, battle started and disconnect attempt time didn't gone.
  32.         if CTF.EnterLobby[IP].PlayerID == PID and CTF.MapOpened == true and Attempt ~= nil and OsTime < Attempt then
  33.             StartPlayerCTF(Player)
  34.             return
  35.         end
  36.         -- Registered, battle started and disconnect attempt time gone.
  37.         if CTF.EnterLobby[IP].PlayerID == PID and CTF.MapOpened == true and Attempt ~= nil and OsTime >= Attempt then
  38.             BickerNotice(Player, "You can't participate anymore, your attempt time has gone!")
  39.             return
  40.         end    
  41.         if CTF.OpenHour() == 0 then
  42.             BickerNotice(Player, "Registering for "..CTF.Conf.MapName.." is unavailable at this hour, please come back later.")
  43.             return
  44.         end
  45.         if IsInTeam(Player) == 1 then
  46.             BickerNotice(Player, "You're inside a party. Cannot register!")
  47.             return
  48.         end
  49.         if CTF.Conf.MinLv > GetChaAttr(Player, ATTR_LV) or (CTF.Conf.MaxLv ~= 0 and CTF.Conf.MaxLv < GetChaAttr(Player, ATTR_LV)) then
  50.             BickerNotice(Player, "You can't participate, only players between levels "..CTF.Conf.MinLv.." through "..CTF.Conf.MaxLv.." can participate.")
  51.             return
  52.         end
  53.         CTF.EnterLobby[IP]                              = {}
  54.         CTF.EnterLobby[IP].PlayerID                     = PID
  55.         CTF.EnterLobby[IP].MAC                          = MAC
  56.         MoveCity(Player, "Arena Island")   
  57.     end
  58. ```
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement