Jump to content
  • 0

PvP Points Shared in Party + Anti-Abuse


Strand

Question


  • Group:  Members
  • Topic Count:  39
  • Topics Per Day:  0.01
  • Content Count:  102
  • Reputation:   2
  • Joined:  07/01/13
  • Last Seen:  

Hello guys,

I'm trying to build a PvP Ranking script that allows you to get kill points in Party mode and that all members get the corresponding points. I am also trying to make an exception where the Killer and Party Members can not get points from the opponent if he has already been killed once in the same round.

Apparently I could achieve it, however, only applies to the person who kills the opponent. The members of the Party do not even receive points for the kill. It seems that the "last_kill" rule only applies to the Killer, not to the Party Members involved in the killing. Do you have any idea how to configure it to apply to all Party members?

 


OnPCKillEvent:
set .@killedvar,getvar(PvPAllowed,getcharid(0,rid2name(killedrid)));
if(.@killedvar == 1 && PvPAllowed == 1){
	set .@party_id,getcharid(1);
	if( !.@party_id ){
			if ( getcharip(killedrid) == getcharip(getcharid(3)) ) { end; } // Can't obtain points if player has same IP
			if ( killedrid == last_kill ) { end; } // Can't get points if kill opponent twice in a row.
			set last_kill, killedrid;
			set PvPKills, PvPKills + 25;	
			dispbottom "[ "+PvPKills+" ] PvPKills.", 0xF1948A;
			end;
			} 
			
	}else{
		getpartymember .@party_id,1;
		getpartymember .@party_id,2;
		set .@acc_id, getcharid(3);
		set .@map$,strcharinfo(3);
		for( set .@i, 0; .@i < $@partymembercount; set .@i, .@i +1 )
			if( isloggedin( $@partymemberaid[.@i],$@partymembercid[.@i] ) )
				if( attachrid( $@partymemberaid[.@i] ) )
					if( HP && strcharinfo(3) == .@map$ )
						set .@online_count,.@online_count + 1;
		
		for( set .@i, 0; .@i < $@partymembercount; set .@i, .@i +1 )
			if( isloggedin( $@partymemberaid[.@i],$@partymembercid[.@i] ) )
				if( attachrid( $@partymemberaid[.@i] ) )
					if( HP && strcharinfo(3) == .@map$ ){
			if ( getcharip(killedrid) == getcharip(getcharid(3)) ) { end; } // Can't obtain points if player has same IP
			if ( killedrid == last_kill ) { end; } // Can't get points if kill opponent twice in a row.
			set last_kill, killedrid;
			set PvPKills, PvPKills + 25;	
			dispbottom "[ "+PvPKills+" ] PvPKills.", 0xF1948A;
			end;
			}
			attachrid( .@acc_id );
			dispbottom "All your members have won PvP Kill Points.";
			}	

 

Edited by Strand
Link to comment
Share on other sites

10 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  6
  • Topics Per Day:  0.00
  • Content Count:  91
  • Reputation:   22
  • Joined:  10/24/14
  • Last Seen:  

Hmm, well could it be that the server variables get changed during party member loop and then it fails. You should save the $@ to a .@ instance variable with copyarray, since they can change at any moment when requesting party data.

Or  attach all available party members with addrid(2, 0, getcharid(1));

 

Edited by Sehrentos
Update2
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  39
  • Topics Per Day:  0.01
  • Content Count:  102
  • Reputation:   2
  • Joined:  07/01/13
  • Last Seen:  

Hello @Sehrentos

Thank You for answering.

How can i add it to my script?

Can you help me with it?

 

On 9/24/2018 at 2:49 AM, Sehrentos said:

Hmm, well could it be that the server variables get changed during party member loop and then it fails. You should save the $@ to a .@ instance variable with copyarray, since they can change at any moment when requesting party data.

Or  attach all available party members with addrid(2, 0, getcharid(1));

 

Where exactly do I add or edit addrid(2, 0, getcharid(1));?

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  6
  • Topics Per Day:  0.00
  • Content Count:  91
  • Reputation:   22
  • Joined:  10/24/14
  • Last Seen:  

7 hours ago, Strand said:

Where exactly do I add or edit addrid(2, 0, getcharid(1));?

Hi, @Strand

You can use it like this in your script:

set .@map$, strcharinfo(3);
addrid(2, 0, .@party_id);
if( HP && strcharinfo(3) == .@map$ )
  set .@online_count,.@online_count + 1;

Or with the getpartymember & copyarray:

getpartymember .@party_id, 2;
.@party_count = $@partymembercount;
copyarray .@party_aid[0], $@partymemberaid[0], .@party_count;

set .@map$, strcharinfo(3);
for( set .@i, 0; .@i < .@party_count; set .@i, .@i +1 )
	if( attachrid( .@party_aid[.@i] ) )
		if( HP && strcharinfo(3) == .@map$ )
			set .@online_count,.@online_count + 1;

And double check {curly brackets}. I think one was set off the course.

Edited by Sehrentos
Done
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  39
  • Topics Per Day:  0.01
  • Content Count:  102
  • Reputation:   2
  • Joined:  07/01/13
  • Last Seen:  

Hello @Sehrentos

Sorry for being such a fool. I'm pretty bad with the arrays. Is there any way that you can edit my whole script with your suggestion, just to show the final outcome?

If you were so kind...

Thank you!!

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  6
  • Topics Per Day:  0.00
  • Content Count:  91
  • Reputation:   22
  • Joined:  10/24/14
  • Last Seen:  

21 minutes ago, Strand said:

Hello @Sehrentos

Sorry for being such a fool. I'm pretty bad with the arrays. Is there any way that you can edit my whole script with your suggestion, just to show the final outcome?

If you were so kind...

Thank you!!

Hi, @Strand

Here are 2 options for you. Pick one that suits for you: https://pastebin.com/x16cxTkb

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  39
  • Topics Per Day:  0.01
  • Content Count:  102
  • Reputation:   2
  • Joined:  07/01/13
  • Last Seen:  

Hello @Sehrentos,

 

Thank you for your time and help but I tried the first one with the arrays and the 2nd party member is not receiving the PvPKills Points in both cases (when enemy does not have the variable "last_kill" and when he does). 

Any idea what could be happening?

 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  6
  • Topics Per Day:  0.00
  • Content Count:  91
  • Reputation:   22
  • Joined:  10/24/14
  • Last Seen:  

49 minutes ago, Strand said:

Hello @Sehrentos,

 

Thank you for your time and help but I tried the first one with the arrays and the 2nd party member is not receiving the PvPKills Points in both cases (when enemy does not have the variable "last_kill" and when he does). 

Any idea what could be happening?

 

Hi, save the original killedrid to .@killedrid and use that in the checks like this: https://pastebin.com/nK2XZyGY

Since every party member can have different killedrid.

Edited by Sehrentos
up1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  39
  • Topics Per Day:  0.01
  • Content Count:  102
  • Reputation:   2
  • Joined:  07/01/13
  • Last Seen:  

Hello @Sehrentos

Thank you very much for your help. It totally worked!

Edited by Strand
  • Love 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  3
  • Topics Per Day:  0.00
  • Content Count:  149
  • Reputation:   24
  • Joined:  02/11/16
  • Last Seen:  

On 9/25/2018 at 1:29 PM, Strand said:

Hello @Sehrentos

Thank you very much for your help. It totally worked!

@Sehrentos Can you share the final code? I'm having problems with points sharing for 2nd++ members.

Edited by Neffletics
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  3
  • Topics Per Day:  0.00
  • Content Count:  149
  • Reputation:   24
  • Joined:  02/11/16
  • Last Seen:  

7 minutes ago, Neffletics said:

@Sehrentos Can you share the final code? I'm having problems with points sharing for 2nd++ members.

Nevermind, it was a stupid mistake. I overlooked the "end;" on my script.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...