Jump to content
  • 0

Random PvP


Hakahay

Question


  • Group:  Members
  • Topic Count:  33
  • Topics Per Day:  0.01
  • Content Count:  82
  • Reputation:   4
  • Joined:  10/20/16
  • Last Seen:  

There is some script that can do the following: at a certain time it selects 2 random players from the server and puts them to fight each other, who wins receives a reward.

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0

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


-	script	Sample	-1,{
	
	OnInit:
		.map$ = "prontera";
		end;
	
	OnMinute00: // every hour
		deletearray .aid;
		mapwarp .map$, "prontera", 155, 181;
		query_sql("SELECT `account_id`,`char_id`,`name` FROM `char` WHERE `online` = 1 ORDER BY RAND() LIMIT 2", .aid, .@cid, .@name$);
		announce "<SYSTEM> Both '"+.@name$[0]+"' and '"+.@name$[1]+"' are selected to join the event. Good luck in killing each other for rewards", bc_all;
		warp .map$, 0, 0, .@cid[0];
		warp .map$, 0, 0, .@cid[1];
		end;
		
	OnPCKillEvent:
		if (strcharinfo(3)) {
			.@aid = getcharid(3);
			if (killedrid == .@aid)
				.@aid = .aid[(.@aid == .aid[0])];
			
			if (attachrid(.@aid)) {
				// rewards
				getitem 512, 1;
				getitem 512, 2;
				getitem 512, 3;
				announce "<SYSTEM> '"+strcharinfo(0)+"' has won.", bc_all;
			}
		}
		deletearray .aid;
		mapwarp .map$, "prontera", 155, 181;
		end;
}

try this.

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