Jump to content
  • 0

Help on putting how many player inside the PVP room PUB


AinsLord

Question


  • Group:  Members
  • Topic Count:  257
  • Topics Per Day:  0.08
  • Content Count:  737
  • Reputation:   18
  • Joined:  11/21/15
  • Last Seen:  

prontera,147,196,5	script	PVP Room	403,{
        warp "guild_vs3",0,0;
        end;
}
guild_vs3	mapflag	nowarpto
guild_vs3	mapflag	nowarp
guild_vs3	mapflag	noreturn

can anyone modify this that shows in PUB how many player is inside the PVP room

and announce if someone entered the PVP room

thnx in advance

Link to comment
Share on other sites

12 answers to this question

Recommended Posts

  • 1

  • Group:  Members
  • Topic Count:  27
  • Topics Per Day:  0.01
  • Content Count:  505
  • Reputation:   126
  • Joined:  04/04/16
  • Last Seen:  

Try 

prontera,147,196,5	script	PVP Room	403,{
        warp "guild_vs3",0,0;
        announce ""+strcharinfo(0)+" entered the PVP Room",bc_all;
        end;

OnInit:
	.count = 0;
	while( 1 ){
		.@count = getmapusers("guild_vs3");
		if( .@count != .count ) {
			.count = .@count;
			delwaitingroom;
			waitingroom "PVP Room ["+.@count+"]";
		}
	sleep 1000;
	}
	end;
}
guild_vs3	mapflag	nowarpto
guild_vs3	mapflag	nowarp
guild_vs3	mapflag	noreturn

 

Link to comment
Share on other sites

  • 1

  • Group:  Members
  • Topic Count:  19
  • Topics Per Day:  0.01
  • Content Count:  193
  • Reputation:   41
  • Joined:  07/21/16
  • Last Seen:  

Why do you have to put 

		if( .@count != .count ) {
			.count = .@count;
			delwaitingroom;
			waitingroom "PVP Room ["+.@count+"]",0;
		}

Pretty much just the same as what I've suggested, but just takes an extra IF statement to get what you needed lmao.

OnInit:
	freeloop(1);
	while( 1 ){
		.@count = getmapusers("guild_vs3");
		waitingroom "PVP Room ["+.@count+"]",0;
		sleep 2000;
		delwaitingroom;
	}
	freeloop(0);
end;

You don't really need the IF statement there.

Edited by Hijirikawa
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  162
  • Topics Per Day:  0.05
  • Content Count:  1546
  • Reputation:   192
  • Joined:  07/23/14
  • Last Seen:  

https://rathena.org/board/topic/63331-need-help-in-pvp-how-to-count-player-on-this-pvp-room/ you can search for more script similar to yours or you can check this one out.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  19
  • Topics Per Day:  0.01
  • Content Count:  193
  • Reputation:   41
  • Joined:  07/21/16
  • Last Seen:  

15 hours ago, Technoken said:

Try 


prontera,147,196,5	script	PVP Room	403,{
        warp "guild_vs3",0,0;
        announce ""+strcharinfo(0)+" entered the PVP Room",bc_all;
        end;

OnInit:
	.count = 0;
	while( 1 ){
		.@count = getmapusers("guild_vs3");
		if( .@count != .count ) {
			.count = .@count;
			delwaitingroom;
			waitingroom "PVP Room ["+.@count+"]";
		}
	sleep 1000;
	}
	end;
}
guild_vs3	mapflag	nowarpto
guild_vs3	mapflag	nowarp
guild_vs3	mapflag	noreturn

 

You will produce errors, put freeloop(1) and freeloop(0) to make infinite loop error to go away.

Im only on mobile so a simplier way to do this is

.@map$ = "guild_vs3";

freeloop(1);

while(1){

.@count = getmapuser(.@map$);

waitingroom "[ "+.@count+" ] PVP Room",0;

sleep 2000;

delwaitingroom;

}

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  27
  • Topics Per Day:  0.01
  • Content Count:  505
  • Reputation:   126
  • Joined:  04/04/16
  • Last Seen:  

On 2/15/2017 at 3:02 AM, Hijirikawa said:

You will produce errors, put freeloop(1) and freeloop(0) to make infinite loop error to go away.

Im only on mobile so a simplier way to do this is

.@map$ = "guild_vs3";

freeloop(1);

while(1){

.@count = getmapuser(.@map$);

waitingroom "[ "+.@count+" ] PVP Room",0;

sleep 2000;

delwaitingroom;

}

I tried it. No infinity loop :D  But I got errors because it's missing an argument. lol

I don't actually know when to use freeloop but I think it's best to use it here. Thanks @Hijirikawa

Anyways I think this one will do

prontera,147,196,5	script	PVP Room	403,{
		mes "Enter PVP?";
		if(select("Yes:No")&2)close;
        warp "guild_vs3",0,0;
        announce ""+strcharinfo(0)+" entered the PVP Room",bc_all;
        end;

OnInit:
	waitingroom "PvP Room [0]",0;
	freeloop(1);
	while( 1 ){
		.@count = getmapusers("guild_vs3");
		if( .@count != .count ) {
			.count = .@count;
			delwaitingroom;
			waitingroom "PVP Room ["+.@count+"]",0;
		}
	sleep 1000;
	}
	end;
}
guild_vs3	mapflag	nowarpto
guild_vs3	mapflag	nowarp
guild_vs3	mapflag	noreturn

 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  27
  • Topics Per Day:  0.01
  • Content Count:  505
  • Reputation:   126
  • Joined:  04/04/16
  • Last Seen:  

Just my opinion. So it wouldn't execute delwaitingroom and waitingroom if the map has the same amount of users inside.

Link to comment
Share on other sites

  • 0

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


prontera,147,196,5	script	PVP Room	403,{
	mapannounce .map$, strcharinfo(0) +" entered PVP.",bc_map;
    warp .map$,0,0;
    end;
	
	OnInit:
		.map$ = "guild_vs3";
		setmapflag .map$,mf_nowarp;
		setmapflag .map$,mf_nowarpto;
		setmapflag .map$,mf_noreturn;
		while ( 1 ) {
			delwaitingroom;
			waitingroom getmapusers( .map$ ) + " User(s) in PVP",0;
			sleep 5000;
		}
		end;
}

try this.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  27
  • Topics Per Day:  0.01
  • Content Count:  505
  • Reputation:   126
  • Joined:  04/04/16
  • Last Seen:  

@Emistry Sorry for the out topic, but in what instances is it necessary to use 'freeloop'? When do we use it? I wanted to ask you since you're one of the pro's in scripting. lol

Link to comment
Share on other sites

  • 0

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

3 hours ago, Technoken said:

but in what instances is it necessary to use 'freeloop'?

when your script executing a loop that nearly reach infinity / endless loop.

 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  27
  • Topics Per Day:  0.01
  • Content Count:  505
  • Reputation:   126
  • Joined:  04/04/16
  • Last Seen:  

18 hours ago, Emistry said:

while ( 1 ) { delwaitingroom; waitingroom getmapusers( .map$ ) + " User(s) in PVP",0; sleep 5000; }

This one will execute endless loop, right?

Link to comment
Share on other sites

  • 0

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

23 minutes ago, Technoken said:

This one will execute endless loop, right?

yes it's. but the sleep script command reset the gotocount, and hence it cheated the system.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  27
  • Topics Per Day:  0.01
  • Content Count:  505
  • Reputation:   126
  • Joined:  04/04/16
  • Last Seen:  

21 hours ago, Emistry said:

yes it's. but the sleep script command reset the gotocount, and hence it cheated the system.

Thanks for that info @Emistry /thx

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