Jump to content
  • 0

HELP with Delay (Anti-spam) PK System


Yami

Question


  • Group:  Members
  • Topic Count:  35
  • Topics Per Day:  0.01
  • Content Count:  111
  • Reputation:   2
  • Joined:  01/02/14
  • Last Seen:  

Hi there, I'm currently using a script for PK Point System in my server.

The script goes like this.

 

If player 1 killed player 2. Player 1 will get 3 PK Points from Player 2, regardless if player 2 doesnt have enough PK Points to give.

In continuation, Player 2 loses 2 PK Points if he/she dies. But if he/she has less than 2 PK Point, he/she wont lose any point.

BUT!

If player 1 kills player 2 again, he SHOULD NOT GET any PK Point. And player 2 SHOULD NOT LOSE any PK Point either.

 

I believe my script has a 3 minutes Cooldown for antispam. But for an unknown reason, players are getting PK Points on every kill (without 3 minutes delay)

 

Can someone please fix my script. I don't really know what's wrong with the script at this moment.

 

Here's the script:

-	script	PK Point System	-1,{
OnPCKillEvent:
if(strcharinfo(3) != "pvp_n_2-5") end;
if(@LastKilled == killedrid) end;
set .@Killer,getcharid(3);
set .@Killed,killedrid;
detachrid;
if(attachrid(.@Killed)){
if(#PKPOINTS){
if(#PKPOINTS <= 2) end;
	set #PKPOINTS,#PKPOINTS-2;
	dispbottom "You Lost 2 PK Point from "+rid2name(.@Killer);
	dispbottom "Current PK Points : "+#PKPOINTS+" ";
	detachrid;
	if(attachrid(.@Killer)){
	set #PKPOINTS,#PKPOINTS+3;
	dispbottom "You Gained 3 PK Point from "+rid2name(.@Killed);
	dispbottom "Current PK Points : "+#PKPOINTS+" ";
	set @LastKilled,.@Killed;
	attachnpctimer;
	initnpctimer;
	}
} else {
	detachrid;
	if(attachrid(.@Killer)){
	//dispbottom "No PK Point to take from "+rid2name(.@Killed);
	set #PKPOINTS,#PKPOINTS+3;
	dispbottom "You Gained 3 PK Point from "+rid2name(.@Killed);
	dispbottom "Current PK Points : "+#PKPOINTS+" ";
	attachnpctimer;
	initnpctimer;
	}
	}
}
end;
}
OnTimer180000:
set @LastKilled,0;
stopnpctimer;
detachnpctimer;
end;
}
Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  31
  • Topics Per Day:  0.01
  • Content Count:  283
  • Reputation:   31
  • Joined:  07/08/14
  • Last Seen:  

Hello

 

You have one bracket you shouldn't have, the timer is out of the script ^^

Since it's a bit messy and I don't really know where you wanted to close your brackets, here is another one (a bit easier too):

-	script	PK Point System	-1,{
OnPCKillEvent:
	if(strcharinfo(3) != "pvp_n_2-5") end;
	if(@LastKilled == killedrid) end;
	set .@Killer,getcharid(3);
	set .@Killed,killedrid; // not useful anymore, can use 'killedrid'
	set #PKPOINTS,#PKPOINTS+3;
	dispbottom "You Gained 3 PK Point from "+rid2name(.@Killed);
	dispbottom "Current PK Points : "+#PKPOINTS;
	set @LastKilled,.@Killed;
	addtimer 180000,strnpcinfo(0)+"::OnAntiSpamReset";
	if(attachrid(.@Killed) && #PKPOINTS > 2){ // even though I don't see a reason for the killed player not to be attached
		set #PKPOINTS,#PKPOINTS-2;
		dispbottom "You Lost 2 PK Point from "+rid2name(.@Killer);
		dispbottom "Current PK Points : "+#PKPOINTS;
	}
	end;

OnAntiSpamReset:
	set @LastKilled,0;
	end;
}

There are a lot of pvp ladders in rA, if you want to add more features take a look at them, I'm pretty sure you'll find a lot of nice things.

Edited by Kurofly
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  35
  • Topics Per Day:  0.01
  • Content Count:  111
  • Reputation:   2
  • Joined:  01/02/14
  • Last Seen:  

I believe this script is a bit old. I grabbed it some time ago. But haven't really used it until now.

 

So will this control it like I said in my first post?
 

P1 kills P2.

P1 gets 3pk points. P2 loses 2pk point.

If P1 kills P2 within 3minutes, 0 PK Point lost or gained.

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...