AinsLord Posted February 13, 2017 Posted February 13, 2017 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 Quote
1 Technoken Posted February 14, 2017 Posted February 14, 2017 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 Quote
1 Hijirikawa Posted February 16, 2017 Posted February 16, 2017 (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 February 16, 2017 by Hijirikawa Quote
0 Radian Posted February 14, 2017 Posted February 14, 2017 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. Quote
0 Hijirikawa Posted February 14, 2017 Posted February 14, 2017 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; } Quote
0 Technoken Posted February 16, 2017 Posted February 16, 2017 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 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 Quote
0 Technoken Posted February 17, 2017 Posted February 17, 2017 Just my opinion. So it wouldn't execute delwaitingroom and waitingroom if the map has the same amount of users inside. Quote
0 Emistry Posted February 17, 2017 Posted February 17, 2017 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. Quote
0 Technoken Posted February 18, 2017 Posted February 18, 2017 @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 Quote
0 Emistry Posted February 18, 2017 Posted February 18, 2017 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. Quote
0 Technoken Posted February 18, 2017 Posted February 18, 2017 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? Quote
0 Emistry Posted February 18, 2017 Posted February 18, 2017 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. Quote
0 Technoken Posted February 19, 2017 Posted February 19, 2017 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 Quote
Question
AinsLord
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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.