Jump to content
  • 0
Sign in to follow this  
kerbiii

help fix this script, it crashes the server

Question

[cbox]- script pvpbet -1,{

 

OnPCKillEvent:
if (strcharinfo(3) != "guild_vs2-2") end;
if (killedrid==getcharid(0)) end;
if (lastkilled==killedrid){
set lkcount,lkcount+1;
if (lkcount>=5){
dispbottom "You have Lose";
end;
}
else{
getitem 7179,1;
dispbottom "You have gained 1 money";
end;
}
}
else{
set lastkilled,killedrid;
set lkcount,1;
getitem 7179,1;
dispbottom "You have gained 1 money";
end;
}
OnPCDieEvent:
if (strcharinfo(3) != "guild_vs2-2") end;
dispbottom "You have Lose";
warp "Invek",146,164;
end;
}[/cbox]

 

 

the crash happens when...

 

scenario:

 

3 players consist of 1 shadow chaser, 1 killer, 1 victim

 

when shadow chaser uses shadow formation to victim and the killer kill them both by using AoE skills the server crash

 

maybe because the script dont knows who to give the prize whether the SC or the killer.

 

and please help add announcement :)

Edited by kerbiii

Share this post


Link to post
Share on other sites

3 answers to this question

Recommended Posts

  • 0

I haven't tested this, but it would seem that the warp command issued with the OnPCDieEvent label. I've added a sleep2 with a 100ms pause and organised your code a bit:

 

-	script	pvpbet	-1,{	OnPCKillEvent:		if (strcharinfo(3) != "guild_vs2-2" || killedrid == getcharid(0)) {			end;		}				if (lastkilled == killedrid){			set lkcount,lkcount+1;	 			if (lkcount >= 5){				dispbottom "You have Lose";			} else {				getitem 7179,1;				dispbottom "You have gained 1 money";			}		} else {			set lastkilled,killedrid;			set lkcount, 1;			getitem 7179, 1;			dispbottom "You have gained 1 money";		}				end;	 	OnPCDieEvent:		if (strcharinfo(3) != "guild_vs2-2") {			end;		}				dispbottom "You have Lose";		sleep2 100;		warp "Invek", 146, 164;		end;	}

 

In the future, I recommend that you use tabs to separate your code a bit. It's difficult to read otherwise.

Share this post


Link to post
Share on other sites
  • 0

If this is actually in your script, it's no surprise that you're getting errors from loading it:

 

 

</span></p><p>

Share this post


Link to post
Share on other sites
  • 0

 

If this is actually in your script, it's no surprise that you're getting errors from loading it:

 

 

</span></p><p>

its not on my script, but i cnt remove it when pasting it on cbox

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

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