Jump to content
  • 0
ThyroDree

PvP Points Script help

Question

Hello, im getting this error line from my ssh anyone can help?

 

Quote

[Warning]: Unexpected type for argument 1. Expected string.
[Debug]: Data: variable name='$@PVPKill1' index=0
[Debug]: Function: setd
[Debug]: Source (NPC): PvP Points (invisible/not on a map)

 

//===== Hercules Script =======================================
//= PvP Point System
//===== By: ==================================================
//= Kit the Baby Fox (A.K.A. IeYasuru) - Conversion by: Aeromesi
//===== Current Version: =====================================
//= 1.5 (Converted into Hercules - Aeromesi
//= 1.5 Update (fixed counter)
//===== Compatible With: =====================================
//= Hercules SVN
//===== Description: =========================================
//= Awards or takes PvP Points
//===== Additional Comments: =================================
//= Gives 1 PvP Point on killing other player
//= Takes 1 PvP Points for dying
//= Takes 5 PvP Points for killing same player 3 times
//=	within 90 seconds of each kill
//===== Change Log: ==========================================
//= 1.0: First release
//= 1.1: Numerous changes to system layout
//=  (borrowed from Terces PvP Ladder)
//= 1.2: Added GM check so getting killed by GMs doesn't 
//=  subtract points.
//============================================================

-	script	PvP Points	FAKE_NPC,{
OnPCKillEvent:
	if(PvPFlag && (killedrid == PrevKilled)) {
		PvPWarning += 1;
		if(PvPWarning >= 5) {
			PvPPoints -= 3;
			callsub L_PointCheck,PvPPoints;
			dispbottom "You've lost 5 PvP Points.";
			dispbottom "You now have "+PvPPoints+" Points.";
			PvPWarning = 0;
			callsub Timer;
		}
		PvPPoints += 1;
		dispbottom "You've been awarded 1 PvP Point.";
		dispbottom "You now have "+PvPPoints+" Points.";
	Timer:
		awake "PvPPointTimer";
		PvPFlag = 1;
		doevent "PvPPointTimer::OnTimerStart";
		end;
	}
	if ( killedrid == getcharid(3) ) {
		PvPPoints -= 1;
		callsub L_PointCheck,PvPPoints;
		dispbottom "You've lost 1 PvP Point.";
		dispbottom "You now have "+PvPPoints+" Points.";
		end;
	}
	
	$@PVPcounter += 1;
	setd getd("$@PVPKill"+$@PVPcounter),getcharid(3);
	if(getgmlevel() >= 60) callsub AddPoint;
	attachrid(killedrid);
	PvPPoints -= 1;
	callsub L_PointCheck,PvPPoints;
	dispbottom "You've lost 1 PvP Point.";
	dispbottom "You now have "+PvPPoints+" Points.";
	detachrid;
	AddPoint:
	attachrid(getd("$@PVPKill"+$@PVPcounter));
	PvPPoints += 1;
	dispbottom "You've been awarded 1 PvP Point.";
	dispbottom "You now have "+PvPPoints+" PvP Point(s).";
	PrevKilled = killedrid;
	PvPFlag = 1;
	doevent "PvPPointTimer::OnTimerStart";
	end;

L_PointCheck:
	if(getarg(0) < 0) PvPPoints = 0;
	return;

OnPCLoginEvent:
	if(!PvPPoints) { PvPPoints = 0; PvPWarning = 0; }
	end;

OnWhisperGlobal:
	if(@whispervar0$ == "show") {
		mes "Your PvP Points: ^00CC00"+PvPPoints;
		close;
	}
	end;
}

-	script	PvPPointTimer	FAKE_NPC,{
OnTimerStart:
	sleep2 90000;
	PvPFlag = 0;
	end;
}

 

Share this post


Link to post
Share on other sites

2 answers to this question

Recommended Posts

  • 0

Hi.

 

The error is caused by this line:

setd getd("$@PVPKill"+$@PVPcounter),getcharid(3);

The value of $@PVPcounter is 1. Thus getd("$@PVPKill"+$@PVPcounter) returns the value of a variable with name $@PVPKill1.

Since $@PVPKill1 is not a string variable, a number is returned and causes an error in setd().

 

I assume your intention was to set $@PVPKill1 to the return value of getcharid(3).

setd("$@PVPKill" + $@PVPcounter, getcharid(3));

 

 

~Kenpachi

Share this post


Link to post
Share on other sites
  • 0
On 4/1/2020 at 5:38 PM, Kenpachi said:

Hi.

 

The error is caused by this line:

setd getd("$@PVPKill"+$@PVPcounter),getcharid(3);


setd getd("$@PVPKill"+$@PVPcounter),getcharid(3);

The value of $@PVPcounter is 1. Thus getd("$@PVPKill"+$@PVPcounter) returns the value of a variable with name $@PVPKill1.

Since $@PVPKill1 is not a string variable, a number is returned and causes an error in setd().

 

I assume your intention was to set $@PVPKill1 to the return value of getcharid(3).

setd("$@PVPKill" + $@PVPcounter, getcharid(3));


setd("$@PVPKill" + $@PVPcounter, getcharid(3));

 

 

~Kenpachi

Yes. thank you 😅

Share this post


Link to post
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.   Restore formatting

  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.

Loading...

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.