Donate above to help with Site, Vent, and Server costs
Welcome Guest [Log In] [Register]

You're currently viewing our forum as a guest. Register now or login to access member-only sections, and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple and fast.


Register HERE!


If you're already a member please log in to your account to access all of our features:

Username:   Password:
Add Reply
Kick Trigger; For host only
Topic Started: Jul 22 2008, 11:10 AM (158 Views)
0chspelar
Member Avatar
Grammar Nazi
[ *  *  *  *  *  *  *  * ]
cool, thanks, yea i did the timer thing right,

yea, i'll see if i can figure out how to make the trigger check for the player host thing, though I'm sure I'll end up just posting the trigger. lol.

only a few triggers left and then I won't have to do any trigger work ever again, yay.

Code:
 

function kick_GetPlayerIndexFromColorString takes string color returns integer
local integer playerIndex = -1
if color=="red" or color=="player1" then
set playerIndex = 0
elseif color=="blue" or color=="player2" then
set playerIndex = 1
elseif color=="teal" or color=="player3" then
set playerIndex = 2
elseif color=="purple" or color=="player4" then
set playerIndex = 3
elseif color=="yellow" or color=="player5" then
set playerIndex = 4
elseif color=="orange" or color=="player6" then
set playerIndex = 5
elseif color=="green" or color=="player7" then
set playerIndex = 6
elseif color=="pink" or color=="player8" then
set playerIndex = 7
elseif color=="grey" or color=="gray" or color=="player9" then
set playerIndex = 8
elseif color=="light blue" or color=="lb" or color=="player10" then
set playerIndex = 9
elseif color=="dark green" or color=="dg" or color=="player11" then
set playerIndex = 10
elseif color=="brown" or color=="player12" then
set playerIndex = 11
endif
return playerIndex
endfunction

function Trig_kick_Actions takes nothing returns nothing
local group g
local unit u
local integer pIndex = kick_GetPlayerIndexFromColorString(SubString(GetEventPlayerChatString(), 6, 17))
if pIndex >= 0 then
call TriggerSleepAction(1)
call RemovePlayer( Player(pIndex), PLAYER_GAME_RESULT_DEFEAT )
set g = CreateGroup()
call GroupEnumUnitsOfPlayer(g, Player(pIndex), null)
loop
set u=FirstOfGroup(g)
exitwhen u==null
call GroupRemoveUnit(g, u)
call KillUnit(u)
call DisplayTextToForce( GetPlayersAll(), ( GetPlayerName(GetTriggerPlayer()) + " has been kicked!" ) )
endloop
call DestroyGroup(g)
set g=null
endif
endfunction

//===========================================================================
function InitTrig_kick takes nothing returns nothing
set gg_trg_kick = CreateTrigger( )
call TriggerRegisterPlayerChatEvent( gg_trg_kick, Player (3), "-kick ", false )
call TriggerAddAction( gg_trg_kick, function Trig_kick_Actions )
endfunction


I got close, but it doesn't work. i understand the loop part, just don't know if udg_host is what i'm supposed to put.

The next thing I'm working on is the timer for the spawn zombies, I just want a gui countdown on the screen 90 to 0, but not sure if i want to use that other timer or not.
Edited by 0chspelar, Jul 24 2008, 08:51 AM.
Offline Profile Quote Post Goto Top
 
AwaKening
Member Avatar
How do ya like me now
[ *  *  *  *  *  *  *  *  * ]
I made notes on the stuff I added in for you to make it work how you asked.
Code:
 
function kick_GetPlayerIndexFromColorString takes string color returns integer
local integer playerIndex = -1
if color=="red" or color=="player1" then
set playerIndex = 0
elseif color=="blue" or color=="player2" then
set playerIndex = 1
elseif color=="teal" or color=="player3" then
set playerIndex = 2
elseif color=="purple" or color=="player4" then
set playerIndex = 3
elseif color=="yellow" or color=="player5" then
set playerIndex = 4
elseif color=="orange" or color=="player6" then
set playerIndex = 5
elseif color=="green" or color=="player7" then
set playerIndex = 6
elseif color=="pink" or color=="player8" then
set playerIndex = 7
elseif color=="grey" or color=="gray" or color=="player9" then
set playerIndex = 8
elseif color=="light blue" or color=="lb" or color=="player10" then
set playerIndex = 9
elseif color=="dark green" or color=="dg" or color=="player11" then
set playerIndex = 10
elseif color=="brown" or color=="player12" then
set playerIndex = 11
endif
return playerIndex
endfunction

function Trig_kick_Actions takes nothing returns nothing
local group g
local unit u
local integer pIndex = kick_GetPlayerIndexFromColorString(SubString(GetEventPlayerChatString(), 6, 17))
// Below I am adding in a Statement to check if the Host typed the command
// Also pIndex is making sure that the player number to kick is valid
if pIndex >= 0 and GetTriggerPlayer()==Player(udg_Host) then
call TriggerSleepAction(1)
call RemovePlayer( Player(pIndex), PLAYER_GAME_RESULT_DEFEAT )
set g = CreateGroup()
call GroupEnumUnitsOfPlayer(g, Player(pIndex), null)
loop
set u=FirstOfGroup(g)
exitwhen u==null
call GroupRemoveUnit(g, u)
call KillUnit(u)
endloop
call DisplayTextToForce( bj_FORCE_ALL_PLAYERS, GetPlayerName(Player(pIndex)) + " has been kicked!" )
call DestroyGroup(g)
set g=null
endif
endfunction

//===========================================================================
function InitTrig_kick takes nothing returns nothing
local integer i=0 // Added for player numbers
set gg_trg_kick = CreateTrigger( )
// Notice below how i create a loop that registers player 0-12 Player(i)
loop
exitwhen i>11
call TriggerRegisterPlayerChatEvent( gg_trg_kick, Player (i), "-kick ", false )
set i=i+1
endloop
call TriggerAddAction( gg_trg_kick, function Trig_kick_Actions )
endfunction
Women, learn to work the toilet seat. You're a big girl. If it's up, put it down.
We need it up, you need it down.
You don't hear us complaining about you leaving it down.
Offline Profile Quote Post Goto Top
 
1 user reading this topic (1 Guest and 0 Anonymous)
« Previous Topic · Mapping · Next Topic »
Add Reply

Skinned by AwaKening