Jump to content
  • 0

Help on putting how many player inside the PVP room PUB


Question

Posted
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

12 answers to this question

Recommended Posts

  • 1
Posted

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

 

  • 1
Posted (edited)

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
  • 0
Posted
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;

}

  • 0
Posted
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

 

  • 0
Posted

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.

  • 0
Posted
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.

 

  • 0
Posted
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?

  • 0
Posted
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.

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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...