Single Player Kick

Crazy_Dead

New Member
Reaction score
24
On almost every ORPG on WC3, there is a Single Player Kick.
If You are alone in the map, you get kicked, or you get ALOT of lag.

How would i go do that?
 

SineCosine

I'm still looking for my Tangent
Reaction score
77
Okay, loops are your buddy =)
Something like..
JASS:

library DisallowSinglePlayer initializer Init

    private function Init takes nothing returns nothing
        local integer i = 0
        local integer Players = 0     

        loop
        exitwhen i == 12

            if GetPlayerSlotState(Player(i)) == PLAYER_SLOT_STATE_PLAYING then
                set Players = Players + 1
            endif

        set i = i + 1
        endloop

        if Players == 1 then
            //Call Some Defeat thingy, I duno the native for it, sorry =x
            //Free-handed, may have errors
        endif
    endfunction
endlibrary
 

Komaqtion

You can change this now in User CP.
Reaction score
469
Just check if there is more than on active player at map init, if not, then end the game... ?
 

Trollvottel

never aging title
Reaction score
262
you can use Sine's solution, however you shouldd also check if the looped player is a computer or if he's human.
 

SineCosine

I'm still looking for my Tangent
Reaction score
77
I forgot to add that ._.
JASS:

library DisallowSinglePlayer initializer Init
    private function Init takes nothing returns nothing
        local integer i = 0
        local integer Players = 0     

        loop
        exitwhen i == 12

            if GetPlayerSlotState(Player(i)) == PLAYER_SLOT_STATE_PLAYING and GetPlayerController(Player(i)) ==  MAP_CONTROL_USER /*I'm not sure if this is how you check for human players >.>*/ then
                set Players = Players + 1
            endif

        set i = i + 1
        endloop

        if Players == 1 then
            //Call Some Defeat thingy, I duno the native for it, sorry =x
            //Free-handed, may have errors
        endif
    endfunction
endlibrary
 

Azlier

Old World Ghost
Reaction score
461
You might want to forbid only single player through the Single Player option, where cheats can be used. Else nobody can play without another person.

The solution I recommend be this.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top