Jump to content
  • 0

Limit PvP for Once per KILLEDRID per Day


serakh00

Question


  • Group:  Members
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  53
  • Reputation:   4
  • Joined:  02/08/12
  • Last Seen:  

I have a pvp script that will give player pvp point for each kill.

now i want some modification which are below :

1. You only earn PvP point if you never kill that character today. This limitation won't dissapear even if you were logout or server was restarted.

2. You are limited to earn PvP Point at maximum "x" point per day. So let say you have earned 2300 pvp points today, you are still able to earn (x-2300) pvp points.

Currenty i have sql script which checks every PvP event occur. (It has killerrid,killedrid,killed,servertime table to recognize if player A had killed player B, or not)

I'm looking for more optimize way to represented this system.

Hope some script master read this thread. /rice

Thanks.. /thx

Link to comment
Share on other sites

7 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  2044
  • Reputation:   682
  • Joined:  10/09/12
  • Last Seen:  

1. You only earn PvP point if you never kill that character today. This limitation won't dissapear even if you were logout or server was restarted.
I don't quite understand this part ...

how can be earning a PvP point without going into PvP zone ?

doesn't make any sense

2. You are limited to earn PvP Point at maximum "x" point per day. So let say you have earned 2300 pvp points today, you are still able to earn (x-2300) pvp points.
possible by setting 2 permanent variable

one by gettimestr("%Y%m%d", 9)

another by pvp points

if ( atoi( gettimestr("%Y%m%d", 9) ) != today_pvp_points ) ... today_pvp_points = atoi( gettimestr("%Y%m%d", 9)

though usually I would've compress all variables into one using implode command lol

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  4
  • Topics Per Day:  0.00
  • Content Count:  44
  • Reputation:   48
  • Joined:  11/19/11
  • Last Seen:  

@annie

They mean you only get a PVP point if you haven't already killed them today. So you kill them the 1st time and you get a point. If you kill them a 2nd time you don't get a point unless it's been 24hrs since you last killed that person.

@serakh00

If you want us to optimise your system you need to post your script and work.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  2044
  • Reputation:   682
  • Joined:  10/09/12
  • Last Seen:  

then isn't this very resource wasteful ?

like emistry did here ...

save so many perm variables just to log each one of them ...

do you have any better ideas how to store them properly ?

other then doing implode to compress 20 players CID of their last kill into 1 long string var ...

Link to comment
Share on other sites


  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10015
  • Reputation:   2348
  • Joined:  10/28/11
  • Last Seen:  

yeah now working but.. this is imposible to make it every player? have only 3 skull per player not all player

erm...i dont think it's a good way to do it using npc script if you want to limit all player with 3 skull..

because it will required to create / save alot data using variable for each player he/she killed ..

imagine if your server everyday having 100 player killing each other...about 20,000 ( AID + Count ) variable is needed ...O.O

anyway you can try this..

http://pastebin.com/raw.php?i=1pBA4HBM

by default only limited to 3 players....

Edit :

LOL...again...Annie is faster >.<

Edited by Emistry
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  53
  • Reputation:   4
  • Joined:  02/08/12
  • Last Seen:  

i'm done with maximum pvp_point limit

this is part of my script which check point number 1

OnPCKillEvent:
getmapxy($@mapname$,$@x,$@y,0);
set .@killer, getcharid(0);
set .@victim, killedrid;	

if (.@killer = .@victim) end;
query_sql "SELECT `kill_status` FROM `pvp_data` WHERE `killerrid` = '"+.@killer+"' AND`killedid` = '"+.@victim+"' AND `serverday` = '"+$server_day+"'",@killed;
//kill_status return 1 if already killed at same day
if (@killed = 1) end;

Edited by serakh00
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  2044
  • Reputation:   682
  • Joined:  10/09/12
  • Last Seen:  

oh I get what you mean now,

you didn't want to use permanent player variable to save the kills

but you "cheated" it with SQL tables

... but I can't really say its a nice trick or not

/*
create table last_pvp_kill (
killercid int(11) unsigned not null,
killedcid int(11) unsigned not null,
key killercid (killercid)
) engine = innodb;
*/

prontera,155,186,5    script    ssdfdekjf    100,{
   query_sql "delete from last_pvp_kill"; // clear the table ... use with OnClock0000:
   end;
OnPCKillEvent:
   if ( killedrid == getcharid(3) ) end;
   if ( query_sql( "select 1 from last_pvp_kill where killercid = "+ getcharid(0) +" and killedcid = "+ getcharid( 0, rid2name( killedrid ) ), .@dummy ) ) // check if the user is in the list
       dispbottom "you have already killed that person today";
   else
       query_sql "insert into last_pvp_kill values ( "+ getcharid(0) +" , "+ getcharid( 0, rid2name( killedrid ) ) +" )"; // insert into table
   end;
}

something like this I guess ?

I'm looking for more optimize way to represented this system.

I'm quite sure doing like this kinda ... dunno how to say it ... Edited by AnnieRuru
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  53
  • Reputation:   4
  • Joined:  02/08/12
  • Last Seen:  

oh I get what you mean now,

you didn't want to use permanent player variable to save the kills

but you "cheated" it with SQL tables

... but I can't really say its a nice trick or not

/*
create table last_pvp_kill (
killercid int(11) unsigned not null,
killedcid int(11) unsigned not null,
key killercid (killercid)
) engine = innodb;
*/

prontera,155,186,5	script	ssdfdekjf	100,{
query_sql "delete from last_pvp_kill"; // clear the table ... use with OnClock0000:
end;
OnPCKillEvent:
if ( killedrid == getcharid(3) ) end;
if ( query_sql( "select 1 from last_pvp_kill where killercid = "+ getcharid(0) +" and killedcid = "+ getcharid( 0, rid2name( killedrid ) ), .@dummy ) ) // check if the user is in the list
	dispbottom "you have already killed that person today";
else
	query_sql "insert into last_pvp_kill values ( "+ getcharid(0) +" , "+ getcharid( 0, rid2name( killedrid ) ) +" )"; // insert into table
end;
}

something like this I guess ?

will try soon as i'm at home..

clean and simple..

EDIT : working nice..thanks annie

this is my full script...

- script pvp_system -1,{
OnInit:
//rate for pvp point changed. (1=1x; 3=3x; 100=100x)
set .pvp_rate,1;

//limit pvp point each day.
set .pvp_limit,1000;

//minimum level to active this system.
set .pvp_level,100;
//maksimum level range between killer and victim.
set .pvp_range,15;
//ratio between pvp point gained by killer and pvp point lost from victim.
//100 means point lost=pvp gained
//50 means point lost half pvp gained
//200 means point lost 2x point gained
set .pvp_ratio,50;

end;
OnClock0000:
query_sql "delete from last_pvp_kill";
query_sql "UPDATE `char` SET pvp_limit = '0'";
end;


OnPCKillEvent:
if ( killedrid == getcharid(3) || BaseLevel < .pvp_level) end;
if (@today_pvp >= .pvp_limit) {
 dispbottom "PvP limit reached.";
 end;}
if ( query_sql( "select 1 from last_pvp_kill where killercid = "+ getcharid(0) +" and killedcid = "+ getcharid( 0, rid2name( killedrid ) ), .@dummy ) ) // check if the user is in the list
{
 dispbottom "Unable to gain PvP Point. You have already killed that person today";}
else
 {
 query_sql "insert into last_pvp_kill values ( "+ getcharid(0) +" , "+ getcharid( 0, rid2name( killedrid ) ) +" )"; // insert into table
 set .@killer,BaseLevel;

 attachrid killedrid;
 if (BaseLevel < [email protected]_range) end;
 set .@value,rand(7,26)*.pvp_rate;
 set pvp_point,pvp_point-(.@value*.pvp_ratio/100);
 set @today_pvp, @today_pvp-(.@value*.pvp_ratio/100);
 dispbottom "You lost "+(.@value*.pvp_ratio/100)+" PvP Points. Current PvP Point : "+pvp_point+".";

 attachrid killerrid;
 if ( BaseLevel < .pvp_level) end;
 if (@today_pvp+.@value > .pvp_limit) {
  set .@value, .pvp_limit-@today_pvp;
  }
 set pvp_point,pvp_point+.@value;
 set @today_pvp,@today_pvp+.@value;
 dispbottom "Today gain : "+@today_pvp+" points.";
 dispbottom "You gained "+.@value+" PvP Points. Current PvP Point : "+pvp_point+".";

 }
end;

OnWhisperGlobal:
if (getgroupid() < 99) end;
mes "Pvp today : "+@today_pvp;
mes "Current PvP Point rate "+.pvp_rate+"x.";
mes "Input new value :";
next;
set @newrate,0;
while (@newrate < 1 || @newrate >999){
 input @newrate;
 dispbottom "Input value 1 ~ 999";
 }
set .pvp_rate,@newrate;
mes "PvP Point rate is now "+@newrate+"x.";
close;
end;

OnPCLoginEvent:
query_sql "select pvp_limit from `char` where char_id = "+ getcharid(0) , @today_pvp;
dispbottom "Today limit : "+@today_pvp+".";
end;
OnPCLogoutEvent:
query_sql "UPDATE `char` SET pvp_limit = "+@today_pvp+" WHERE char_id ="+getcharid(0);
end;
}

any suggestion?

Edited by serakh00
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...