Kick System Trigger help.

General talk about editing, cheating, and deprotecting maps.

Moderator: Cheaters

Black-Hole
Forum Fanatic
Posts: 315
Joined: October 16th, 2007, 7:32 pm

Kick System Trigger help.

Post by Black-Hole »

Im dont know anything at all about jass.... but im trying to learn :) so can someone help me put this into my map. I dont understand where to put it and how to put it in the map. Also i made all the Variables under Globals (VOTES_NEEDED_TO_KICK (integer) ,votekick_dialog (Dialog Array) ,votekick_buttons (DialogButton Array) ,votekick_votes (Integer Array) ,votekick_buttonclick (Trigger),votekick_votekick (Trigger))
The best way for me would be if someone would make a map with it and post the map, THX!
Oh and can you make is so the VOTES_NEEDED_TO_KICK is 2 less than Total number of players playing? (Player being kicked minus 1)

Spoiler:
Globals

Code: Select all

constant integer VOTES_NEEDED_TO_KICK=3
dialog array votekick_dialog
button array votekick_buttons
integer array votekick_votes
trigger votekick_buttonclick=null
trigger votekick_votekick=null
endglobals


EndGlobals

Code: Select all

function init_votekick takes nothing returns nothing
local integer i=0
loop
exitwhen i>11
set votekick_dialog[i]=DialogCreate()
call TriggerRegisterPlayerChatEvent(votekick_votekick,Player(i),"-votekick",true)
call TriggerRegisterDialogEvent(votekick_buttonclick,votekick_dialog[i])
set i=i+1
endloop
endfunction
function VotekickClick takes nothing returns nothing
local player p=GetTriggerPlayer()
local integer id=GetPlayerId(p)
local integer istart=id*12+100
local button b=GetClickedButton()
local integer j=0
local player q
loop
exitwhen j>11
if votekick_buttons[istart+j]==b then
set q=Player(j)
if votekick_votes[istart+j]==1 then
set votekick_votes[istart+j]=0
set votekick_votes[j]=votekick_votes[j]-1
call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,8.,"A kick vote has been withdrawn for "+GetPlayerName(q))
else
set votekick_votes[j]=votekick_votes[j]+1
set votekick_votes[istart+j]=1
call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,8.,"A kick vote has been issued for "+GetPlayerName(q))
if votekick_votes[j] >= VOTES_NEEDED_TO_KICK then
call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,8.,GetPlayerName(q)+" has been kicked by vote")
call RemovePlayer(q,PLAYER_GAME_RESULT_DEFEAT)
if q==GetLocalPlayer()then
call EndGame(false)
endif
endif
endif
endif
set j=j+1
endloop
set q=null
set b=null
set p=null
endfunction
function VotekickShow takes nothing returns nothing
local player p=GetTriggerPlayer()
local integer id=GetPlayerId(p)
local integer istart=id*12+100
local integer j=0
local player q
call DialogClear(votekick_dialog[id])
call DialogSetMessage(votekick_dialog[id],"|cffffcc00Votekick who?")
loop
exitwhen j>11
set votekick_buttons[istart+j]=null
set q=Player(j)
if GetPlayerSlotState(q)==PLAYER_SLOT_STATE_PLAYING and GetPlayerController(q)==MAP_CONTROL_USER and q!=p then
if votekick_votes[istart+j]!=1then
set votekick_buttons[istart+j]=DialogAddButton(votekick_dialog[id],GetPlayerName(q)+" |r[|cffffcc00Vote|r]",0)
else
set votekick_buttons[istart+j]=DialogAddButton(votekick_dialog[id],GetPlayerName(q)+" |r[|cffffcc00Cancel Vote|r]",0)
endif
endif
set j=j+1
endloop
set votekick_buttons[id]=DialogAddButton(votekick_dialog[id],"Cancel |r[|cffff0000ESC|r]",512)
call DialogDisplay(p,votekick_dialog[id],true)
set p=null
set q=null
endfunction


FunctionMain

Code: Select all

function InitTrig_Votekick takes nothing returns nothing
set votekick_votekick=CreateTrigger()
set votekick_buttonclick=CreateTrigger()
call TriggerAddAction(votekick_votekick,function VotekickShow)
call TriggerAddAction(votekick_buttonclick,function VotekickClick)
call ExecuteFunc("init_votekick")
endfunction
initialD
Some Honorary Title
Posts: 1713
Joined: June 8th, 2007, 5:08 am
Title: Angry Bird

Re: Kick System Trigger help.

Post by initialD »

put those codes into the J file.
war3map.j

there are 3 parts, so just read some tutorials here they will teach you how to do it.
map-deprotection-cheating-f3/map-cheating-and-deprotecting-guides-t2000.html