Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- Requeriments:
- 1) GameServer.exe with HandleChat(role, message)
- 2) Serialize.lua
- Installation:
- 1) skilleff.txt
- ### PK Mode -1 0 State_None_Add State_None_Rem 1 0 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 -1 0 0 0 ### 1 0 0
- 2) sceneeffectinfo.txt
- ### ispkmod.par PK Mode Sea Wave 0 0 0 -1 0 1.0 0.0 -1.0
- 3) Change directory parent on path to your desired folder
- 4) Change state to the skilleff line id
- --]]
- --*-----------------------------------------*--
- --* dir parent : Addon *--
- --* File name : PKMode.lua *--
- --* Created by : Eviles *--
- --* Discord : #2759 *--
- --*-----------------------------------------*--
- print('* Loading <PKMode> init.lua')
- pk_mode = {}
- pk_mode.conf = {
- path = GetResPath('script/addon/ClientInfo/PKMode/'),
- hook = is_friend,
- timer = cha_timer,
- maps = {'garner','magicsea','darkblue'},
- state = 8,
- on = 0,
- off = 1
- }
- is_friend = function(c, t)
- pk_mode.conf['hook'](c, t)
- local cMap,tMap = GetChaMapName(c),GetChaMapName(t)
- local cPk,tPk = CheckChaPKState(c),CheckChaPKState(t)
- local cRole,tRole = CheckChaRole(c),CheckChaRole(t)
- for i,v in pairs(pk_mode.conf['maps']) do
- if cMap == v and tMap == v then
- if cRole == 1 and tRole == 1 then
- if cPk == 0 or tPk == 0 then
- return pk_mode.conf['off']
- else
- return pk_mode.conf['on']
- end
- else
- if cRole == 1 and tRole == 0 then
- return pk_mode.conf['on']
- elseif cRole == 0 and tRole == 1 then
- return pk_mode.conf['on']
- end
- end
- end
- end
- return pk_mode.conf['off']
- end
- cha_timer = function(r, f, t)
- pk_mode.conf['timer'](r, f, t)
- local PID = GetCharID(r)
- local retState = CheckChaPKState(r)
- if (file_exists(pk_mode.conf['path']..PID..'.txt') == true) then
- if retState == 0 then
- SetPkState(r, pk_mode.conf['off'])
- AddState(r, r, pk_mode.conf['state'], 1, 3600)
- end
- else
- if GetChaStateLv(r, pk_mode.conf['state']) ~= 0 then
- SetPkState(r, pk_mode.conf['on'])
- RemoveState(r, pk_mode.conf['state'])
- end
- end
- end
- cmd.list['pkon'] = function(r, p)
- local PID = GetCharID(r)
- if (file_exists(pk_mode.conf['path']..PID..'.txt') == false) then
- table.save({}, pk_mode.conf['path']..PID..'.txt', 'w')
- else
- BickerNotice(r, 'PK Mode arealdy activated. Use /pkoff to disable it!')
- return
- end
- end
- cmd.list['pkoff'] = function(r, p)
- local PID = GetCharID(r)
- if (file_exists(pk_mode.conf['path']..PID..'.txt') == true) then
- os.remove(pk_mode.conf['path']..PID..".txt")
- else
- BickerNotice(r, 'PK Mode arealdy disabled. Use /pkon to enable it!')
- return
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement