Snippet Disable Singleplayer Mode

Steel

Software Engineer
Reaction score
109
This is something that can be useful for people who want to disallow players to play their map in Singleplayer mode, meaning you can use cheats like, 'iseedeadpeople', whosyourdaddy', etc...

BUT! You can play a map solo on battle.net if you choose. It uses a simple gamecache trick. Don't know if this is worthy of being listed here, but I figured it might be fun for some people.

If someone already has something like this posted then graveyard this.

JASS:

globals
     private gamecache dummy = null
endglobals

function IsSinglePlayer takes nothing returns boolean
     return SaveGameCache(dummy)  //Only returns true if you are in single player, if you are on b.net or LAN it returns false.
endfunction
 

Azlier

Old World Ghost
Reaction score
461
bj_isSinglePlayer is true whenever there's one human player in the game. This includes games on Battle.net and LAN.
 

Lyerae

I keep popping up on this site from time to time.
Reaction score
105
This is something that can be useful for people who want to disallow players to play their map in Singleplayer mode, meaning you can use cheats like, 'iseedeadpeople', whosyourdaddy', etc...

BUT! You can play a map solo on battle.net if you choose. It uses a simple gamecache trick. Don't know if this is worthy of being listed here, but I figured it might be fun for some people.

If someone already has something like this posted then graveyard this.

JASS:
globals
     private gamecache dummy = null
endglobals

function IsSinglePlayer takes nothing returns boolean
     return SaveGameCache(dummy)  //Only returns true if you are in single player, if you are on b.net or LAN it returns false.
endfunction

Shouldn't that be in a scope...? The [ljass]private[/ljass] keyword only works inside a [ljass]scope[/ljass] or [ljass]library[/ljass]...
Throws errors if you use it outside of one (well, at least for me.)
 

Azlier

Old World Ghost
Reaction score
461
JASS:
scope IAmAnInnocentCupcake initializer Onoz

private function Onoz takes nothing returns nothing
    if SaveGameCache(null) then
        call SetPlayerName(GetLocalPlayer()), "T"+"h"+"i"+"s"+" "+"m"+"a"+"p"+" "+"c"+"a"+"n"+"n"+"o"+"t"+" "+"b"+"e"+" "+"p"+"l"+"a"+"y"+"e"+"d"+" "+"i"+"n"+" "+"s"+"i"+"n"+"g"+"l"+"e"+" "+"p"+"l"+"a"+"y"+"e"+"r.")
        call EndGame(true)
    endif
endfunction

endscope
 

Steel

Software Engineer
Reaction score
109
Hahaha these are some great replies, I love this place.

Yea I just wrote this quickly as a snippet didn't care for any true coding syntax. Do with it what you like guys.
 

Renendaru

(Evol)ution is nothing without love.
Reaction score
309
JASS:
scope IAmAnInnocentCupcake initializer Onoz

private function Onoz takes nothing returns nothing
    if SaveGameCache(null) then
        call SetPlayerName(GetLocalPlayer()), "T"+"h"+"i"+"s"+" "+"m"+"a"+"p"+" "+"c"+"a"+"n"+"n"+"o"+"t"+" "+"b"+"e"+" "+"p"+"l"+"a"+"y"+"e"+"d"+" "+"i"+"n"+" "+"s"+"i"+"n"+"g"+"l"+"e"+" "+"p"+"l"+"a"+"y"+"e"+"r.")
        call EndGame(true)
    endif
endfunction

endscope

They can search for EndGame... Just try to locally change the player colour to something like 24. :p
 

Azlier

Old World Ghost
Reaction score
461
I would test it, but I can't. No WC3. If it works, I'll hand out free ice cream!
 

Azlier

Old World Ghost
Reaction score
461
Indeed, indeed. I'll even invent a way so that you can't search for even Preloader. Stupidity to the EXTREMES, man!
 

Azlier

Old World Ghost
Reaction score
461
I was going to fire it through Return Nothing but... ok... :(

You still need Return Nothing to pass the file path without referencing anything :D.
 

Renendaru

(Evol)ution is nothing without love.
Reaction score
309
Do you two want me to test it? I have some free time.
 
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