System Kick features

0zaru

Learning vJASS ;)
Reaction score
60
Here's my Kick system:

Things to say:
-Uses Vexorian Table System
-JASS

Get JassNewGen Pack Here

Kick Features​

Features:
-A vote kick System that can be modified, by modifying just some function arguments
-A Team Kill Kick System that needs to be activated for work.
-A Vulgar kick that kicks players that write bad-words in the game. 10 max words (Can be changed)


That's all by now


Readme:
JASS:
=====================================Kick Based Systems======================================
-First of All TEST THE MAP....

Done for TheHelper.net
_______________________________________________________________

'Main Functions':

function VoteKick takes player p,real timeforvote,boolean ShowBoard,string IfKickedText,string BoardTitle returns nothing

-This is the Main function of vote. Calling this in any trigger will cause, if there 
isn't any voting at the moment a Vote Kick start.
Example:

call VoteKick(Player(0),12,"Kicked",true,"Vote Kick",true)

This will start a vote agains Player red, waiting 12 seconds for finish, Displaying a board 
with results, Displaying Text Kicked when the player leaves (To the player),the leaderboard
name is going to be Vote Kick, displaying a Timer Window.

Also in the function there is a default gradient text that display this:
"A Kick vote has been initiated towards Player: <<Player>>"

'End of Main Functions'
Note: There is a pre-made trigger where i use my function, just type -vkick "Player Colour"



"Team Kill Kick System"
===============================================================
In here there is a trigger called Team Kill Kick, inside it there are some functions, but
you are only interested in this (NOT IN THIS TRIGGER!!):

globals
integer MaxTeamKillsPossibles=3
string KickedByTeamKillText="Too much teamkill..."
boolean TeamKillsActivate=false
endglobals

You 'MUST' edit those globals. 
The MaxTeamKillsPossibles global is for how much kills are needed for kick.
The String KickedByTeamKillText is a global that represents the text that is going to be
displayed to the kicked player.
The boolean is really necessary, because you need it to start the system. For set it to true
you have to call this function in a moment of the game:
call InitTeamKillsKick()

Why to do it a function, read more in the "Team Kill Kick" trigger.

'DO NOT EDIT THE BOOLEAN NAME IF YOU DO NOT KNOW WHAT ARE YOU DOING!!'



"Vulgary Kick"
===============================================================
First of all Why did i use the method that i have and not the Event that detects when you
write strings and then set the exact match to false? Because when i thinked on that whenever
that i writed something, it counted like a bad word.
In this carpet there is a trigger called "Vulgary Kick", this trigger will count how many
bad words you use. You have a max of 10 Words to use. When the 10 words reach 0, you are
kicked. The configurations globals are these (NOT IN THIS TRIGGER!!):


globals
string array VulgarWords
integer MaxVulgarWords=10
boolean VulgarWordsInit=false
string KickedByVulgarText="I warned you to stop talking like that!"
endglobals

  The Global VulgarWords string is a variable that stores a Mini-dictionary that i have
collected with bad words (You can add more in the function InitVulgarWords).
 The Integer MaxVulgarWords,is the max times that you can say bad-words.
 The boolean VulgarWordsInit: this is by default an non-active system. For activate you must 
call the function InitVulgarWords in map init or in another part at the start of the game.
  The last string is the text that displays to the player when it's kicked.
 
 
 'DO NOT EDIT THE BOOLEAN NAME IF YOU DO NOT KNOW WHAT ARE YOU DOING!!'
_______________________________________________________________



Greetings 0zaru

Thanks to:
'MoonSlinger' for giving me the idea of the Team Kill Kick thing and the Vulgary Kick thing.
'Doomhammer' for the function that returns player colors in strings.

That's all by now.

Any suggestion please post in this thread

Kick Functions
JASS:
library KickFunctionsLibrary requires TableSystem
//A function made by Doomhammer that get a player color..
function GetPlayerColorString takes player p returns string
local playercolor col=GetPlayerColor(p)
    if col == PLAYER_COLOR_RED then
        return("ffff0000")
    elseif col == PLAYER_COLOR_BLUE then
        return("ff0000ff")
    elseif col == PLAYER_COLOR_CYAN then
        return("ff00ffc0")
    elseif col == PLAYER_COLOR_PURPLE then
        return("ff800080")
    elseif col == PLAYER_COLOR_YELLOW then
        return("ffffff00")
    elseif col == PLAYER_COLOR_ORANGE then
        return("ffff8000")
    elseif col == PLAYER_COLOR_GREEN then
        return("ff00ff00")
    elseif col == PLAYER_COLOR_PINK then
        return("ffff00ff")
    elseif col == PLAYER_COLOR_LIGHT_GRAY then
        return("ffc0c0c0")
    elseif col == PLAYER_COLOR_LIGHT_BLUE then
        return("ff80c0ff")
    elseif col == PLAYER_COLOR_AQUA then
        return("ff004040")
    elseif col == PLAYER_COLOR_BROWN then
        return("ff404000")
    endif
    return("00000000")
endfunction
//A custom function that ends the game
function QUITForAll takes nothing returns nothing
call EndGame(true)
call DestroyTrigger(GetTriggeringTrigger())
call DialogDestroy(GetClickedDialog())
endfunction

//*******************************************************************************************
//*******************************************************************************************
//*******************************************************************************************
//                                  Vote Kick Function
//*******************************************************************************************
//*******************************************************************************************
//*******************************************************************************************

globals
  boolean Alreadyvoting=false
  integer KickCountTrue=0
  integer KickCountFalse=0
  button yes
  button no
endglobals

function CountVotes takes nothing returns nothing
  local trigger t=GetTriggeringTrigger()
  local string trtable=GetAttachmentTable(t)
  local leaderboard l=GetTableLeaderboard(trtable,"LB")
if GetClickedButton()==yes then
  set KickCountTrue=KickCountTrue+1
  call LeaderboardSetItemValue(l,LeaderboardGetPlayerIndex(l,Player(0)),KickCountTrue)
elseif GetClickedButton()==no then
  set KickCountFalse=KickCountFalse+1
  call LeaderboardSetItemValue(l,LeaderboardGetPlayerIndex(l,Player(1)),KickCountFalse)
endif
endfunction

function EndVote takes nothing returns nothing
  local timer t=GetExpiredTimer()
  local string ttable=GetAttachmentTable(t)
  local timerdialog td=GetTableTimerDialog(ttable,"TD")
  local leaderboard l=GetTableLeaderboard(ttable,"Leaderboard")
  local trigger tr=GetTableTrigger(ttable,"CountTrigger")
  local trigger tr2
  local dialog QUIT
  local player p=GetTablePlayer(ttable,"Player")
  local dialog CurrentDialog=GetTableDialog(ttable,"CRD")
  local string IfKickedText=GetTableString(ttable,"Txt")
  call ClearTextMessages()
if KickCountTrue>KickCountFalse then
  set QUIT=DialogCreate()
  call DialogSetMessage( QUIT, IfKickedText )
  set tr2=CreateTrigger()
  call TriggerRegisterDialogButtonEvent( tr2, DialogAddButton( QUIT,"Game Over by kick",0) )
  call TriggerAddAction( tr2, function QUITForAll)
  call DialogDisplay(p,QUIT,true)
if (IsPlayerInForce(GetLocalPlayer(), bj_FORCE_ALL_PLAYERS)) then
  call DisplayTimedTextToPlayer(GetLocalPlayer(),0.50,0.90,10,"Player "+"|c"+GetPlayerColorString(p)+GetPlayerName(p)+"|r"+" has been kicked!")
endif
endif
if KickCountFalse>=KickCountTrue then
  call DisplayTimedTextToPlayer(GetLocalPlayer(),0.50,0.90,10,"Player "+"|c"+GetPlayerColorString(p)+GetPlayerName(p)+"|r"+" has been abolished")
endif
  call CleanAttachedVars(t)
  call CleanAttachedVars(tr)
  call DestroyTrigger(tr)
  call DestroyTimer(t)
  call DestroyTimerDialog(td)
  call DialogDestroy(CurrentDialog)
  call DestroyLeaderboard(l)
  set l=null
  set t=null
  set tr2=null
  set tr=null
  set td=null
  set KickCountFalse=0
  set KickCountTrue=0
  set Alreadyvoting=false
endfunction

function VoteKick takes player p,real timeforvote,string IfKickedText,boolean ShowBoard,string BoardTitle,boolean ShowTimer returns nothing
  local leaderboard l=CreateLeaderboard()
  local timer t=CreateTimer()
  local string ttable=GetAttachmentTable(t)
  local integer i=0
  local integer size=0
  local dialog CurrentDialog=DialogCreate()
  local trigger tr=CreateTrigger()
  local string trtable=GetAttachmentTable(tr)
  local timerdialog td=CreateTimerDialog(t)
if Alreadyvoting==false then
  set Alreadyvoting=true
elseif Alreadyvoting==true then
if (IsPlayerInForce(GetLocalPlayer(), bj_FORCE_ALL_PLAYERS)) then
  call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,10,"There can only be one vote at a time.")
endif
  call DestroyTimer(t)
  call DestroyTimerDialog(td)
  set td=null
  set t=null
  call DestroyTrigger(tr)
  set tr=null
  call DestroyLeaderboard(l)
   call DialogDestroy(CurrentDialog)
  return
endif
if (IsPlayerInForce(GetLocalPlayer(), bj_FORCE_ALL_PLAYERS)) then
        call DisplayTextToPlayer(GetLocalPlayer(), 0.50, 0.90,"|c00FF0000A|c00F90203 |c00F20306v|c00EC050Ao|c00E6060Dt|c00DF0810i|c00D90A13n|c00D20B16g|c00CC0D1A |c00C60E1Dh|c00BF1020a|c00B91223s|c00B31326 |c00AC152Ab|c00A6162De|c009F1830e|c00991A33n|c00931B36 |c008C1D3Ai|c00861E3Dn|c00802040i|c00792243t|c00732346i|c006C254Aa|c0066264Dt|c00602850e|c00592A53 |c00532B56t|c004D2D5Ao|c00462E5Dw|c00403060a|c00393263r|c00333366d|c002D356As|c0026366D |c00203870P|c001A3A73l|c00133B76a|c000D3D7Ay|c00063E7De|c00004080r|r: " + "|c" + GetPlayerColorString(p) + GetPlayerName(p) + "|r")
endif
if ShowBoard==true then
  call LeaderboardSetLabel(l,BoardTitle)
  call LeaderboardAddItem(l,"|c" + GetPlayerColorString(Player(0)) + "Votes for yes|r",0,Player(0))
  call LeaderboardAddItem(l,"|c" + GetPlayerColorString(Player(1)) + "Votes for no|r",0,Player(1))
  set size=LeaderboardGetItemCount(l)
if (LeaderboardGetLabelText(l) == "") then
        set size = size - 1
endif
  call LeaderboardSetSizeByItemCount(l,size)
   loop
      exitwhen i>bj_MAX_PLAYERS
      call PlayerSetLeaderboard(Player(i), l)
      set i=i+1
   endloop
endif
  call DialogClear(CurrentDialog)
  set yes=DialogAddButton(CurrentDialog,"Yes",0)
  set no=DialogAddButton(CurrentDialog,"No",0)
  call DialogSetMessage(CurrentDialog,"Should player " + "|c" + GetPlayerColorString(p) + GetPlayerName(p)+ "|r "+"be kicked?")
  set i=0
loop
exitwhen i>bj_MAX_PLAYERS
  call DialogDisplay(Player(i),CurrentDialog,true)
  set i=i+1
endloop
if ShowBoard==true then
    call LeaderboardDisplay(l,true)
    call SetTableObject(trtable,"LB",l)
endif
  call TriggerRegisterDialogEvent(tr,CurrentDialog)
  call TriggerAddAction(tr,function CountVotes)
  call SetTableObject(ttable,"CountTrigger",t)
  call SetTableObject(ttable,"Leaderboard",l)
  call SetTableObject(ttable,"Player",p)
  call SetTableObject(ttable,"CRD",CurrentDialog)
  call SetTableString(ttable,"Txt",IfKickedText)
  call SetTableObject(ttable,"TD",td)
if ShowTimer==true then
    call TimerDialogSetTitle(td,"Remaining Time For Vote")
    call TimerDialogDisplay(td,true)
endif
  call TimerStart(t,timeforvote,false,function EndVote)
endfunction

endlibrary

Team Kill Kick
JASS:
//*******************************************************************************************
//*******************************************************************************************
//*******************************************************************************************
//                                  If too much TeamKills then Kick!
//*******************************************************************************************
//*******************************************************************************************
//*******************************************************************************************

globals
  integer MaxTeamKillsPossibles=3
  string KickedByTeamKillText="Too much teamkill..."
  boolean TeamKillsActivate=false
endglobals

//YOU NEED TO CALL THE NEXT FUNCTION AT MAP INIT OR IN SOME MOMENT BEFORE HERO STARTS KILLING
//call InitTeamKillsKick()
library TeamKillActivate

//As you see this only sets a global boolean to true. Maybe you can only set the boolean 
//to true at map init. But you can't see this variable in GUI,and maybe you just copy and
//paste this so you can't see it.

function InitTeamKillsKick takes nothing returns nothing
  set TeamKillsActivate=true
endfunction

endlibrary

function CountKills takes nothing returns nothing
  local unit Killer=GetKillingUnit()
  local unit DyingUnit=GetDyingUnit()
  local string Killertable=GetAttachmentTable(Killer)
  local integer CurrentTKCount=GetTableInt(Killertable,"TKCOUNT")
  local dialog QUIT
  local trigger t
if TeamKillsActivate==true then
if IsUnitAlly(DyingUnit,GetOwningPlayer(Killer))==true and CurrentTKCount<MaxTeamKillsPossibles then
  call SetTableInt(Killertable,"TKCOUNT",CurrentTKCount+1)
  call DisplayTimedTextToPlayer(GetOwningPlayer(Killer),0.0,0.0,100,"|c00FF0000WARNING|r: You have only "+I2S(MaxTeamKillsPossibles-CurrentTKCount)+" teamkills more!")
endif
if CurrentTKCount >= MaxTeamKillsPossibles then
  set QUIT=DialogCreate()
  call DialogSetMessage( QUIT, KickedByTeamKillText )
  set t=CreateTrigger()
  call TriggerRegisterDialogButtonEvent( t, DialogAddButton( QUIT,"Game Over by kick",0) )
  call TriggerAddAction( t, function QUITForAll)
  call DialogDisplay(GetOwningPlayer(Killer),QUIT,true)
if IsPlayerInForce(GetLocalPlayer(),bj_FORCE_ALL_PLAYERS)==true then
  call DisplayTextToPlayer(GetLocalPlayer(),0.50,0.90,"|c000080FFT|c00007FFAh|c00007DF5e|c00007CF0 |c00007BEBP|c00007AE6l|c000078E0a|c000077DBy|c000076D6e|c000074D1r|c000073CC |c000072C7h|c000071C2a|c00006FBDs|c00006EB8 |c00006DB3b|c00006CADe|c00006AA8e|c000069A3n|c0000689E |c00006699k|c00006594i|c0000648Fc|c0000638Ak|c00006185e|c00006080d|c00005F7A |c00005D75f|c00005C70o|c00005B6Br|c00005A66 |c00005861t|c0000575Co|c00005657o|c00005452 |c0000534Dm|c00005247u|c00005142c|c00004F3Dh|c00004E38 |c00004D33T|c00004C2Ee|c00004A29a|c00004924m|c0000481F |c0000461AK|c00004514i|c0000440Fl|c0000430Al|c00004105s|c00004000.|r: "+"|c"+GetPlayerColorString(GetOwningPlayer(Killer))+GetPlayerName(GetOwningPlayer(Killer))+"|r")
endif
  call ClearTable(Killertable)
endif
endif
  set Killer=null
  set t=null
  set DyingUnit=null
endfunction

function InitTrig_Team_Kill_Kick takes nothing returns nothing
    set gg_trg_Team_Kill_Kick = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ(gg_trg_Team_Kill_Kick,EVENT_PLAYER_UNIT_DEATH)
    call TriggerAddAction( gg_trg_Team_Kill_Kick, function CountKills )
endfunction

Premade Test Vote Kick

JASS:
function Trig_Start_a_Voting_Actions takes nothing returns nothing
  local string s=GetEventPlayerChatString()
  local player p=GetTriggerPlayer()
if SubString(s,0,6)!="-vkick" then
  return
endif
if  SubString(s,7,10)== "red" then
  call VoteKick(Player(0),10,"Kicked",true,"Should Player Red be Kicked?",true)
elseif SubString(s,7,11)== "blue" then
  call VoteKick(Player(1),10,"Kicked",true,"Should Player Blue be Kicked?",true)
elseif SubString(s,7,11)== "teal" then
  call VoteKick(Player(2),10,"Kicked",true,"Should Player Teal be Kicked?",true)
elseif SubString(s,7,13)== "purple" then
  call VoteKick(Player(3),10,"Kicked",true,"Should Player Purple be Kicked?",true)
elseif SubString(s,7,13)== "yellow" then
  call VoteKick(Player(4),10,"Kicked",true,"Should Player Yellow be Kicked?",true)
elseif SubString(s,7,13)== "orange" then
  call VoteKick(Player(5),10,"Kicked",true,"Should Player Orange be Kicked?",true)
elseif SubString(s,7,12)== "green" then
  call VoteKick(Player(6),10,"Kicked",true,"Should Player Green be Kicked?",true)
elseif SubString(s,7,11)== "pink" then
  call VoteKick(Player(7),10,"Kicked",true,"Should Player Pink be Kicked?",true)
elseif SubString(s,7,11)== "grey" or SubString(s,7,11)== "gray" then
  call VoteKick(Player(8),10,"Kicked",true,"Should Player Grey be Kicked?",true)
elseif SubString(s,7,16)== "lightblue" or SubString(s,7,9)== "lb" then
  call VoteKick(Player(9),10,"Kicked",true,"Should Player Lightblue be Kicked?",true)
elseif SubString(s,7,16)== "darkgreen" or SubString(s,7,9)== "dg" then
  call VoteKick(Player(10),10,"Kicked",true,"Should Player DarkGreen be Kicked?",true)
elseif SubString(s,7,13)== "brown" then
  call VoteKick(Player(11),10,"Kicked",true,"Should Player Brown be Kicked?",true)
else
  call DisplayTextToPlayer(GetTriggerPlayer(),0,0,"Invalid Player color, you have to put the right color!! (Write -showcolors for more information about colors")
endif
endfunction

//===========================================================================
function InitTrig_Start_a_Voting takes nothing returns nothing
    local integer i=0
    set gg_trg_Start_a_Voting = CreateTrigger(  )
    loop
    exitwhen i>bj_MAX_PLAYERS
    call TriggerRegisterPlayerChatEvent(gg_trg_Start_a_Voting,Player(i),"-vkick",false)
    set i=i+1
    endloop
    call TriggerAddAction( gg_trg_Start_a_Voting, function Trig_Start_a_Voting_Actions )
endfunction

Vulgar Kick
JASS:
library InitVulgarWords
//*******************************************************************************************
//*******************************************************************************************
//*******************************************************************************************
//                                  Vulgary Kick Functions and Settings
//*******************************************************************************************
//*******************************************************************************************
//*******************************************************************************************
globals
  string array VulgarWords
  integer MaxVulgarWords=10
  boolean VulgarWordsInit=false
  string KickedByVulgarText="I warned you to stop talking like that!"
endglobals

function InitVulgarWords takes nothing returns nothing
  set VulgarWordsInit=true
  set VulgarWords[s2i("fuck")]="fuck"
  set VulgarWords[s2i("FUCK")]="FUCK"
  set VulgarWords[s2i("SLIPKNOT")]="SLIPKNOT"
  set VulgarWords[s2i("slipknot")]="slipknot"
  set VulgarWords[s2i("MOTHERFUCKER")]="MOTHERFUCKER"
  set VulgarWords[s2i("motherfucker")]="motherfucker"
  set VulgarWords[s2i("ASS")]="ASS"
  set VulgarWords[s2i("ass")]="ass"
  set VulgarWords[s2i("ASSEL")]="ASSEL"
  set VulgarWords[s2i("assel")]="assel"
  set VulgarWords[s2i("FUCKER")]="FUCKER"
  set VulgarWords[s2i("fucker")]="fucker"
  set VulgarWords[s2i("IDIOT")]="IDIOT"
  set VulgarWords[s2i("idiot")]="idiot"
  set VulgarWords[s2i("FACK")]="FACK"
  set VulgarWords[s2i("fack")]="fack"
  set VulgarWords[s2i("BITCH")]="BITCH"
  set VulgarWords[s2i("bitch")]="bitch"
  set VulgarWords[s2i("DICK")]="DICK"
  set VulgarWords[s2i("dick")]="dick"
  set VulgarWords[s2i("GAY")]="GAY"
  set VulgarWords[s2i("gay")]="gay"
  set VulgarWords[s2i("RUBBISH")]="RUBBISH"
  set VulgarWords[s2i("rubbish")]="rubbish"
  set VulgarWords[s2i("LICK")]="LICK"
  set VulgarWords[s2i("lick")]="lick"
  set VulgarWords[s2i("SUCK")]="SUCK"
  set VulgarWords[s2i("suck")]="suck"
  set VulgarWords[s2i("CUNT")]="CUNT"
  set VulgarWords[s2i("cunt")]="cunt"
  set VulgarWords[s2i("SHIT")]="SHIT"
  set VulgarWords[s2i("shit")]="shit"
  set VulgarWords[s2i("FUCKING")]="FUCKING"
  set VulgarWords[s2i("fucking")]="fucking"
  set VulgarWords[s2i("bitch!")]="bitch!"
  set VulgarWords[s2i("BITCH!")]="BITCH!"
  set VulgarWords[s2i("dick!")]="dick!"
  set VulgarWords[s2i("DICK!")]="DICK!"
  set VulgarWords[s2i("idiot!")]="idiot!"
  set VulgarWords[s2i("IDIOT!")]="IDIOT!"
endfunction

function IsStringVulgar takes string s returns boolean
  if VulgarWords[s2i(s)]==s and VulgarWords[s2i(s)]!=null and VulgarWords[s2i(s)]!="" then
   return true
  endif
   return false
endfunction

function FilterString takes string s returns string
     local integer sl=StringLength(s)
     local integer slfr=StringLength(s)
     local string st
     local boolean b=false
     local integer i=-10
      loop
         exitwhen b==true or i>sl
         set st=VulgarWords[s2i(SubString(s,i,slfr))]
         set b=IsStringVulgar(st)
         set i=i+1
         set slfr=slfr-1
   endloop
   return st
endfunction

endlibrary

function Trig_Vulgary_Kick_Actions takes nothing returns nothing
  local string ptable=GetAttachmentTable(GetTriggerPlayer())
  local integer i=GetTableInt(ptable,"VulgarCount")
  local string s=GetEventPlayerChatString()
  local string w=FilterString(s)
  local dialog QUIT
  local trigger t
  if VulgarWordsInit==true and IsStringVulgar(w)==true then
     call SetTableInt(ptable,"VulgarCount",i+1)
       if i<MaxVulgarWords then
          call DisplayTextToPlayer(GetTriggerPlayer(),0,0,"Come on! Stop saying those words. Now you have only "+I2S(MaxVulgarWords-i)+ " words more to say")
       elseif i>=MaxVulgarWords then
       set QUIT=DialogCreate()
       call DialogSetMessage( QUIT, KickedByVulgarText )
       set t=CreateTrigger()
       call TriggerRegisterDialogButtonEvent( t, DialogAddButton( QUIT,"Game Over by kick",0) )
       call TriggerAddAction( t, function QUITForAll)
       call DialogDisplay(GetTriggerPlayer(),QUIT,true)
   if IsPlayerInForce(GetLocalPlayer(),bj_FORCE_ALL_PLAYERS)==true then
      call DisplayTextToPlayer(GetLocalPlayer(),0.50,0.90,"|c"+GetPlayerColorString(GetTriggerPlayer())+GetPlayerName(GetTriggerPlayer())+"|r"+"|c00FF0000 |c00FC0003h|c00F80007a|c00F5000As|c00F2000D |c00EF0010b|c00EB0014e|c00E80017e|c00E5001An|c00E2001E |c00DE0021k|c00DB0024i|c00D80027c|c00D5002Bk|c00D1002Ee|c00CE0031d|c00CB0035 |c00C80038f|c00C4003Bo|c00C1003Er|c00BE0042 |c00BB0045h|c00B70048i|c00B4004Bs|c00B1004F |c00AE0052b|c00AA0055a|c00A70059d|c00A4005C |c00A1005Fv|c009D0062o|c009A0066c|c00970069a|c0094006Cb|c00900070u|c008D0073l|c008A0076a|c00870079r|c0083007Dy|c00800080.|r")
   endif
         call ClearTable(ptable)
  endif
       endif
  set t=null
endfunction

function InitTrig_Vulgary_Kick takes nothing returns nothing
    local integer i2=0
    set gg_trg_Vulgary_Kick = CreateTrigger(  )
      loop
         exitwhen i2>bj_MAX_PLAYERS
         call TriggerRegisterPlayerChatEvent(gg_trg_Vulgary_Kick,Player(i2),"",false)
         set i2=i2+1
      endloop
    call TriggerAddAction( gg_trg_Vulgary_Kick, function Trig_Vulgary_Kick_Actions )
endfunction
 

Attachments

  • Kick Features.w3x
    75 KB · Views: 304

Sim

Forum Administrator
Staff member
Reaction score
534
Usually posting the code on the forums is not a bad idea :p

Seems like it is a system to me.
 

0zaru

Learning vJASS ;)
Reaction score
60
I am indenting code wait a seconsd please :D

EDIT: Finished

Updated
-New feature, Vulgar Kick
-Improved code a little in some parts..

Please post comments in this post
 

Hero

─║╣ero─
Reaction score
250
This should help with that one ugly BJ

JASS:
function CustomDefeatBJ takes player whichPlayer, string message returns nothing
    if AllowVictoryDefeat( PLAYER_GAME_RESULT_DEFEAT ) then
        call RemovePlayer( whichPlayer, PLAYER_GAME_RESULT_DEFEAT )

        if not bj_isSinglePlayer then
            call DisplayTimedTextFromPlayer(whichPlayer, 0, 0, 60, GetLocalizedString( "PLAYER_DEFEATED" ) )
        endif

        // UI only needs to be displayed to users.
        if (GetPlayerController(whichPlayer) == MAP_CONTROL_USER) then
            call CustomDefeatDialogBJ( whichPlayer, message )
        endif
    endif
endfunction


JASS:
function CustomDefeatDialogBJ takes player whichPlayer, string message returns nothing
    local trigger t = CreateTrigger()
    local dialog  d = DialogCreate()

    call DialogSetMessage( d, message )

    if bj_isSinglePlayer then
        set t = CreateTrigger()
        call TriggerRegisterDialogButtonEvent( t, DialogAddButton( d, GetLocalizedString( "GAMEOVER_RESTART" ), GetLocalizedHotkey("GAMEOVER_RESTART") ) )
        call TriggerAddAction( t, function CustomDefeatRestartBJ )

        if (GetGameDifficulty() != MAP_DIFFICULTY_EASY) then
            set t = CreateTrigger()
            call TriggerRegisterDialogButtonEvent( t, DialogAddButton( d, GetLocalizedString( "GAMEOVER_REDUCE_DIFFICULTY" ), GetLocalizedHotkey("GAMEOVER_REDUCE_DIFFICULTY") ) )
            call TriggerAddAction( t, function CustomDefeatReduceDifficultyBJ )
        endif

        set t = CreateTrigger()
        call TriggerRegisterDialogButtonEvent( t, DialogAddButton( d, GetLocalizedString( "GAMEOVER_LOAD" ), GetLocalizedHotkey("GAMEOVER_LOAD") ) )
        call TriggerAddAction( t, function CustomDefeatLoadBJ )
    endif

    set t = CreateTrigger()
    call TriggerRegisterDialogButtonEvent( t, DialogAddButton( d, GetLocalizedString( "GAMEOVER_QUIT_MISSION" ), GetLocalizedHotkey("GAMEOVER_QUIT_MISSION") ) )
    call TriggerAddAction( t, function CustomDefeatQuitBJ )

    if (GetLocalPlayer() == whichPlayer) then
        call EnableUserControl( true )
        if bj_isSinglePlayer then
            call PauseGame( true )
        endif
        call EnableUserUI(false)
    endif

    call DialogDisplay( whichPlayer, d, true )
    call VolumeGroupSetVolumeForPlayerBJ( whichPlayer, SOUND_VOLUMEGROUP_UI, 1.0 )
    call StartSoundForPlayerBJ( whichPlayer, bj_defeatDialogSound )
endfunction


It's actually not that complicated when you read through it
 

0zaru

Learning vJASS ;)
Reaction score
60
I have see those functions inside and i know that,but search for this function:
call TriggerAddAction( t, function CustomDefeatQuitBJ )

that one is really short,but it annoys me
 

PurgeandFire

zxcvmkgdfg
Reaction score
509
Ever heard of inlining? Some bjs use "ifs" to fit your needs, but instead, inline the code and simplify it to your needs to get rid of the BJ.
 

0zaru

Learning vJASS ;)
Reaction score
60
It worked :D, i wasn't showing the dialog (Crap)

Updated

Edit: a few updates in the code, added some more words, some bug fixes with the vulgary kick
 
C

Cannabis

Guest
Hm it doesnt work like Normal triggers? xD i need something to read the jass "files"? Im new to this.. so would be lovely with some help :d
 

0zaru

Learning vJASS ;)
Reaction score
60
Read Readme it may help a bunch..

I will update some things temorrow on this...
 
C

Cannabis

Guest
(never tryit jass) didnt even know what it was before now xD

Ive Readed Readme And
Ive Made Same variables as In ur map... And copyit your jass codes... but wont work.. it go black screen when i try map :p....
 

0zaru

Learning vJASS ;)
Reaction score
60
You just need to copy 3 triggers only (Only for the Vote Kick system):
Vexorian Table System
Kick Functions
Start a Voting


Then in game just put: -vkick "Colour", this has a "Default" configuration that shows board timer and kicked words to the player kicked, and should player be kicked as dialog title.
 
C

Cannabis

Guest
It still doesnt work...
it say that there are alot of errors :)
 

0zaru

Learning vJASS ;)
Reaction score
60
oh crap i totally forgot about that thanks gals i will edit the first post :p
 
C

Cannabis

Guest
No im only using normal world editor haha :D

what i need to reat the jass codes?

do u need WEU?
 

0zaru

Learning vJASS ;)
Reaction score
60
Maybe 2 of the systems. I am going to update the map anyway today or temorrow. Anyway some functions need to be called outside of the libraries..
 
C

Cannabis

Guest
It says that there is This Error
Code:
if udg_SpellCache == null then

And This
Code:
 return udg_SpellCache
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top