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 5

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
On 6/18/2018 at 12:39 AM, Julio said:

 

I really liked this conflict with V3ctor CTF 😪

I think you need add the following code to your is_friend() function in file functions.lua:

	-- At the beginning of function
	local map_name_cha1 = GetChaMapName(cha1)
	local map_name_cha2 = GetChaMapName(cha2)
	if (map_name_cha1 == map_name_cha2 and map_name_cha1 == "CTF") then
		if (GetChaSideID(cha1) == GetChaSideID(cha2)) then
			return 1
		else
			return 0
		end
	end

 

  • Thanks 1

Share this post


Link to post
Share on other sites
On 3/13/2018 at 9:39 PM, Satan said:

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

does this mean players can battle each other in zones like, argent west gate (where little shrubs are) and such if both players have this system activated?

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

×