Jump to content
Satan

PK Mode - HandleChat

Recommended Posts

System Name: PK Mode - HandleChat

 

Credits:

Pirates Online, showcase;

@Andrew and @Angelix help on is_friend();

 

Introduction:

This system allow players to battle on Battle Zones when the PK Mode is activated only. To enable PK Mode player must type on local chat the following command /pkon or to disable it /pkoff.

 

Change-Logs:

- Release of scripts v1.0 (03/13/2018)

Client Archives

 

TODO:

- When player has PK Mode activated and use skills that does area damage or debuff skills target and role gets damaged/affected

  • Like 4

Share this post


Link to post
Share on other sites
On 6/17/2018 at 6:39 PM, Julio said:

 

I really liked this conflict with V3ctor CTF 😪

Well, u can fix it easily. I'm sure u can do that ... That happens because we calling native function on same way.

  • Like 1

Share this post


Link to post
Share on other sites
17 hours ago, Satan said:

Well, u can fix it easily. I'm sure u can do that ... That happens because we calling native function on same way.

Thankyou

Share this post


Link to post
Share on other sites
is_friend = function(c, t)
    pk_mode.conf['hook'](c, t)
    local cMap,tMap         = GetChaMapName(c),GetChaMapName(t)
    local cRole,tRole       = CheckChaRole(c),CheckChaRole(t)
	local cEffect,tEffect = GetChaStateLv ( c ,  pk_mode.conf['state']),GetChaStateLv ( t ,  pk_mode.conf['state'] )
	local Teammate = is_teammate(c,t) 
	local cID,tID = GetCharID(c),GetCharID(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 cEffect == 1 and tEffect == 1 and Teammate == 0 and cID ~= tID then
                    return pk_mode.conf['on']
                else
                    return pk_mode.conf['off']
                end
            end
        end
    end
end

 
cha_timer = function(r, f, t)
    pk_mode.conf['timer'](r, f, t)
    local PID               = GetCharID(r)
    if (file_exists(pk_mode.conf['path']..PID..'.txt') == true) then
            AddState(r, r, pk_mode.conf['state'], 1, 3600)
    else
        if GetChaStateLv(r, pk_mode.conf['state']) ~= 0 then
            RemoveState(r, pk_mode.conf['state'])
        end
    end
end

-- prevents self attack, party attack and  reflectin' with main is_friend script.

Handlechat()

cmd.list['pk'] = function(role, param)
	if param.n ~= 1 then
		BickerNotice(role, 'This command requires an option "ON" OR "OFF"')
		return
	end
	param[1] = tostring(param[1])
	param[1] = string.upper(param[1])

	if (param[1]) ==  'ON' then
	 local PID               = GetCharID(role)
    if (file_exists(pk_mode.conf['path']..PID..'.txt') == false) then
	     BickerNotice(role, 'PK Mode: activated.')
        table.save({}, pk_mode.conf['path']..PID..'.txt', 'w')
    else
        BickerNotice(role, 'PK Mode already activated.')
        return
    end
	elseif (param[1]) == 'OFF' then
		local PID               = GetCharID(role)
    if (file_exists(pk_mode.conf['path']..PID..'.txt') == true) then   
		BickerNotice(role, 'PK Mode: deactivated.')
        os.remove(pk_mode.conf['path']..PID..".txt")
    else
        BickerNotice(role, 'PK Mode already disabled.')
        return
    end
		else
		BickerNotice(role, 'There are TWO options for this command "ON" OR "OFF"!')
		return
	end
end

 

Edited by Terminix
  • Like 1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×