Page 1 of 2

[Jass]Ban player

Posted: September 3rd, 2012, 12:38 pm
by KangTooJee
Can some1 make me a simple jass that autokick a specific name?
I already tried the one at FAQ but it doesnt work...
Thx in advanced..

Re: [Jass]Ban player

Posted: September 3rd, 2012, 12:41 pm
by legendair
you can use the banlist for banning the ppl to all the game you'll host (used in dota) i think is better because the map you'll edit will not be spread a lot so the guy can still play on other version...

Re: [Jass]Ban player

Posted: September 3rd, 2012, 1:05 pm
by KangTooJee
no, the map will be spread cuz i am playing on my country bnet..
Well i just need the trigger... thx

Re: [Jass]Ban player

Posted: September 3rd, 2012, 1:25 pm
by whitegun
The one at FAQ is work perfectly for me, may be you missing something.

Here what i did:

put this code in endglobals

Code: Select all

function kick_people takes nothing returns nothing
local string PlayerName="<REPLACE THIS WITH THE PLAYER NAME>" //Entirely lowercase!
local integer i=0   
loop
exitwhen i>11
if GetPlayerName(Player(i))==StringCase(PlayerName,false)then
call CustomDefeatBJ(Player(i),"You are banned.")
endif
set i=i+1
endloop
endfunction

then i put this code in function main

Code: Select all

call kick_people()

Re: [Jass]Ban player

Posted: September 4th, 2012, 5:46 am
by KangTooJee
k i will try again thx

Re: [Jass]Ban player

Posted: September 4th, 2012, 8:46 pm
by owner123
There's no true way to ban them, as this can be avoided with a new account.

If you truly want to ban someone forever, set up a hostbot and get it popular, then set up IP ban functionality.

Re: [Jass]Ban player

Posted: September 5th, 2012, 4:07 am
by KangTooJee
owner123 wrote:There's no true way to ban them, as this can be avoided with a new account.

If you truly want to ban someone forever, set up a hostbot and get it popular, then set up IP ban functionality.

I know but in my country BN its hard to make new account..
Well i just managed to make it work...U can close the thread..

Re: [Jass]Ban player

Posted: September 8th, 2012, 3:40 pm
by haxorico
Banning a specific player is a real easy job on jass.
Try this and tell me how it works for you.

Under the locals of function main

Code: Select all

call banPlayer("Enter Name Here")

under endglobals

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


I wrote that on the spot using my mobile so it might have a few syntax errors, so just paste this on JassCraft and press F9 and tell me the errors it gave you.
All in all it should work, if you want several people banned you can just call the function again witha a different name each time.
The function is NOT case sensitive (makes it more helpfull)

Re: [Jass]Ban player

Posted: November 8th, 2012, 2:52 pm
by KangTooJee
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

Re: [Jass]Ban player

Posted: November 8th, 2012, 4:24 pm
by Apple
haxorico wrote:Banning a specific player is a real easy job on jass.
Try this and tell me how it works for you.

Under the locals of function main

Code: Select all

call banPlayer("Enter Name Here")

under endglobals

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


I wrote that on the spot using my mobile so it might have a few syntax errors, so just paste this on JassCraft and press F9 and tell me the errors it gave you.
All in all it should work, if you want several people banned you can just call the function again witha a different name each time.
The function is NOT case sensitive (makes it more helpfull)


I tried it. worked. However how do I add multiple names? cannot convert string to boolean. :/