[Jass]Ban player
Moderator: Cheaters
-
- Old Wrinkly Member
- Posts: 202
- Joined: September 15th, 2010, 5:09 am
- Title: Legenda
-
- Forum Staff
- Posts: 1471
- Joined: November 3rd, 2010, 10:48 am
- Title: Not cool
- Location: Singapore
Re: [Jass]Ban player
I have a lot to ban. I want to have include them in a single line.v1nc3nts wrote:make it like this
call banPlayer("a")
call banPlayer("b")
call banPlayer("c")
-
- Old Wrinkly Member
- Posts: 202
- Joined: September 15th, 2010, 5:09 am
- Title: Legenda
Re: [Jass]Ban player
Some1 please take a look please?v1nc3nts wrote:I edited it become like this..
But why it kick all players when the banned player join the map?Spoiler:
-
- Old Wrinkly Member
- Posts: 226
- Joined: April 19th, 2010, 1:48 pm
- Location: In The World
-
- Grammar King
- Posts: 2117
- Joined: June 22nd, 2008, 10:11 pm
- Title: Worst human for 4eva
- Location: Mostly USEast
Re: [Jass]Ban player
Because you customdefeat Player(i), which is looped from 0-11, so it kicks everyone.
(20:53:52) Bartimaeus: Thank you, Jen.
(20:53:56) Bartimaeus: Truly, you are wise.
Learn how to extract and read RAW Codes here!(23:44:12) Bartimaeus: I was in pubic school until middle school...
Need help? Click here and ask your question!
-
- Old Wrinkly Member
- Posts: 202
- Joined: September 15th, 2010, 5:09 am
- Title: Legenda
-
- Super Moderator
- Posts: 3197
- Joined: February 24th, 2009, 1:31 pm
- Location: JEW LAND
- Been thanked: 1 time
Re: [Jass]Ban player
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"
under globals
Under the locals of function main
under endglobals
I can't test if it will work, tell me how it goes.
But here is a different way that might be more... "Good Looking"
under globals
Code: Select all
string array banlistNames
Code: Select all
call initBanList()
Code: Select all
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
-
- Forum Staff
- Posts: 1471
- Joined: November 3rd, 2010, 10:48 am
- Title: Not cool
- Location: Singapore
Re: [Jass]Ban player
Spoiler:
if (StringLength(banlistNames[index])>0) then
Here's mine.. I have to add a lot of player names in function main hohoho
Endglobals
Spoiler:
Spoiler: