help fix this script, it crashes the server

kerbiii

New member
Messages
342
Points
0
[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
default_smile.png


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

Code:
</span></p><p>
 
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.

 
Last edited by a moderator:
Back
Top