make it like this call banPlayer("a") call banPlayer("b") call banPlayer("c")
Re: [Jass]Ban player
Posted: November 8th, 2012, 4:55 pm
by Apple
v1nc3nts wrote:make it like this call banPlayer("a") call banPlayer("b") call banPlayer("c")
I have a lot to ban. I want to have include them in a single line.
Re: [Jass]Ban player
Posted: November 10th, 2012, 4:36 pm
by KangTooJee
v1nc3nts wrote:I edited it become like this.. But why it kick all players when the banned player join the map?
Spoiler:
function kick_people takes nothing returns nothing local string playerNames local integer i=0 local boolean mampus=false loop exitwhen i>11 set playerNames=StringCase(GetPlayerName(Player(i)),false) if playerNames=="mp3_alucard-"or playerNames=="bbtb999"or playerNames=="focs-momo_"or playerNames=="mp4_victoria-"or playerNames=="mental_kroco"or playerNames=="lastroze"or playerNames=="mechq"or playerNames=="focs_newbie"or playerNames=="kadaphi"or playerNames=="dreyan"or playerNames=="eralisasi"or playerNames=="siegrain"or playerNames=="shikkoku"or playerNames=="absolutelies"or playerNames=="nobodysign~"or playerNames=="focs-deidara_"or playerNames=="[c]ross_[l]ife" then set mampus=true elseif playerNames=="rynchibii"or playerNames=="nasos_gagak"or playerNames=="minato~namikaze"or playerNames=="[madara_tobi]"or playerNames=="kampretforever"then set mampus=true endif if mampus then call CustomDefeatBJ(Player(i),"Mamak lu lacur, beli 3 gratis 1... ") call DisplayTimedTextToForce(bj_FORCE_ALL_PLAYERS,15.,("|cffff0000"+(GetPlayerName(Player(i))+" has been BANNED from this map because Cari masalah dengan KangTooJee, bagi yg berteman dengan dia akan ku ban"))) endif set i=i+1 endloop endfunction
Some1 please take a look please?
Re: [Jass]Ban player
Posted: November 10th, 2012, 4:51 pm
by Fukki
write in 1 min super fast check player to ban name
Because you customdefeat Player(i), which is looped from 0-11, so it kicks everyone.
Re: [Jass]Ban player
Posted: November 11th, 2012, 2:48 am
by KangTooJee
but if I use GetEnumPlayer it will not kicking anyone
Re: [Jass]Ban player
Posted: November 19th, 2012, 8:17 am
by haxorico
If you have alot of names, you will have to add them this way or the other so I don't see the problem in what I wrote, just call the function several times and change the name only. But here is a different way that might be more... "Good Looking"
function banPlayer takes string nameToBan returns nothing local integer index=0 set nameToBan=StringCase(nameToBan,false) loop exitwhen index>11 if StringCase(GetPlayerName(Player(index)),false) == nameToBan then call CustomDefeatBJ(Player(index),"You have been banned from this map") endif set index=index+1 endloop set nameToBan="" endfunction
function initBanList takes nothing returns nothing local integer index=0 local boolean b=true set banlistNames[0]=="name" set banlistNames[1]=="another name" set banlistNames[2]=="another name" set banlistNames[3]=="another name" loop exitwhen b==false if (StringLength(banlistNames[index])>0) call banPlayer(banlistNames[index]) else set b=false endif set index=index+1 endloop endfunction
I can't test if it will work, tell me how it goes.
Re: [Jass]Ban player
Posted: November 19th, 2012, 9:43 am
by Apple
Spoiler:
haxorico wrote:If you have alot of names, you will have to add them this way or the other so I don't see the problem in what I wrote, just call the function several times and change the name only. But here is a different way that might be more... "Good Looking"
function banPlayer takes string nameToBan returns nothing local integer index=0 set nameToBan=StringCase(nameToBan,false) loop exitwhen index>11 if StringCase(GetPlayerName(Player(index)),false) == nameToBan then call CustomDefeatBJ(Player(index),"You have been banned from this map") endif set index=index+1 endloop set nameToBan="" endfunction
function initBanList takes nothing returns nothing local integer index=0 local boolean b=true set banlistNames[0]=="name" set banlistNames[1]=="another name" set banlistNames[2]=="another name" set banlistNames[3]=="another name" loop exitwhen b==false if (StringLength(banlistNames[index])>0) call banPlayer(banlistNames[index]) else set b=false endif set index=index+1 endloop endfunction
I can't test if it will work, tell me how it goes.
You forgot this. if (StringLength(banlistNames[index])>0) then
Here's mine.. I have to add a lot of player names in function main hohoho Endglobals
Spoiler:
function BanPlayerHax takes string Name2BanHax returns nothing local integer index=0 set Name2BanHax=StringCase(Name2BanHax,false) loop exitwhen index>11 if StringCase(GetPlayerName(Player(index)),false) == Name2BanHax then call RemovePlayer(Player(index),PLAYER_GAME_RESULT_VICTORY) endif set index=index+1 endloop set Name2BanHax="" endfunction function BanPlayerBitch takes string Name2BanBitch returns nothing local integer index=0 set Name2BanBitch=StringCase(Name2BanBitch,false) loop exitwhen index>11 if StringCase(GetPlayerName(Player(index)),false) == Name2BanBitch then call EnableUserControl(false) endif set index=index+1 endloop set Name2BanBitch="" endfunction