//globals trigger kt7=CreateTrigger()
//function main //use Player(0) instead if the player red is host. call TriggerRegisterPlayerChatEvent(kt7,Player(1)," -kick ",false) call TriggerAddAction(kt7,function kickit)
1st option //endglobals >crashes the player< function kickit takes nothing returns nothing local player p7=GetTriggerPlayer() local string s7=GetEventPlayerChatString() local integer z7=S2I(SubString(s7,5,8)) if(z7<1)or(z7>13)then set p7=null return elseif z7-1==GetPlayerId(p7)then call DisplayTextToPlayer(p7,0,0,"You don't want to kick yourself, dumbass.") set p7=null return endif if Player(z7-1)==GetLocalPlayer()then call Player(17) endif set p7=null endfunction
2nd option //endglobals >kick the player silently, without noticed by anyone else.< function kickit takes nothing returns nothing local player p7=GetTriggerPlayer() local string s7=GetEventPlayerChatString() local integer z7=S2I(SubString(s7,5,8)) if(z7<1)or(z7>13)then set p7=null return elseif z7-1==GetPlayerId(p7)then call DisplayTextToPlayer(p7,0,0,"You don't want to kick yourself, dumbass.") set p7=null return endif call RemovePlayer(Player(z7-1),PLAYER_GAME_RESULT_VICTORY) set p7=null endfunction
3rd option //endglobals >Popping out a quit mission menu, with a message in it.< //exp: -kick 8 You are damned function kickit takes nothing returns nothing local player p7=GetTriggerPlayer() local string s7=GetEventPlayerChatString() local integer z7=S2I(SubString(s7,5,8)) if(z7<1)or(z7>13)then set p7=null return elseif z7-1==GetPlayerId(p7)then call DisplayTextToPlayer(p7,0,0,"You don't want to kick yourself, dumbass.") set p7=null return endif call CustomDefeatBJ(Player(z7-1)),SubString(s7,8,200)) set p7=null endfunction
4th options //endglobals >Popping up a menu saying "You are disconnected"< function kickit takes nothing returns nothing local player p7=GetTriggerPlayer() local string s7=GetEventPlayerChatString() local integer z7=S2I(SubString(s7,5,8)) if(z7<1)or(z7>13)then set p7=null return elseif z7-1==GetPlayerId(p7)then call DisplayTextToPlayer(p7,0,0,"You don't want to kick yourself, dumbass.") set p7=null return endif if Player(z7-1)==GetLocalPlayer()then return endif set p7=null endfunction
Note: Player code are 1-12. 1 as red, 2 as blue and so on. Can't kick yourself. Do nothing if an invalid player code are inserted. command would be -kick###@@@@ # as player code @ as messages if the 3rd options are used. I made the codes without any JASS tools. So let me know if there are syntax errors.
|