May 16, 2022, 02:57:23 am

The Gang Garrison 2 Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

NOTICE: Due to a rise in bot activity, new posters need to be approved before posting.

Join the community Discord server!

Pages: [1]

Author Topic: Password  (Read 1145 times)

NAGN

  • Developer
  • ******
  • Karma: 146
  • Offline Offline
  • Posts: 16769
  • Yeah so now I have an idea
Password
« on: October 02, 2012, 03:53:26 pm »

Code: (Password.gml) [Select]
object_event_add(GameServer, ev_step, ev_step_begin, '
player_threshhold = 0;
server_password_string = "";
if (global.isHost) {
    if (ds_list_size(global.players) > player_threshhold) {
        global.serverPassword = server_password_string;
    }else{
        global.serverPassword = "";
    }
}
')

Copy and paste this into a text file and make the extension .gml. Modify the player_threshhold and server_password_string values to be something else... e.g.

Code: (Password.gml) [Select]
object_event_add(GameServer, ev_step, ev_step_begin, '
player_threshhold = 14;
server_password_string = "1111";
if (global.isHost) {
    if (ds_list_size(global.players) > player_threshhold) {
        global.serverPassword = server_password_string;
    }else{
        global.serverPassword = "";
    }
}
')

Note that this WILL override any password settings you have in the game. If you attempt to host with this plugin, you must remove the plugin before hosting a normal locked server
« Last Edit: October 02, 2012, 03:53:41 pm by NAGN »
Logged

Phantom Brave

  • All Hail Classicwell
  • Moderator
  • *****
  • Karma: 70
  • Offline Offline
  • Posts: 12701
  • Another one --
Re: Password
« Reply #1 on: October 02, 2012, 04:51:17 pm »

or you can set threshold to -1
« Last Edit: October 02, 2012, 04:51:33 pm by Chartreuse »
Logged

http://steamcommunity.com/id/wareya/
ladies and gentlemen i would like to announce that the fact of the matter is up that the fact of the matter is a fact and it matters

Machidro

  • 2013 Haxxy Award Winner
  • *
  • Karma: 5
  • Offline Offline
  • Posts: 1675
  • Gardicolo time is over.
Re: Password
« Reply #2 on: October 02, 2012, 05:42:58 pm »

Run two more if checks after ds list size to make this compatible with our current password system.

Quote
object_event_add(GameServer, ev_step, ev_step_begin, '
player_threshhold = 0;
server_password_string = "";
if (global.isHost) {
    if (ds_list_size(global.players) > player_threshhold) {
        //if a password is already set, don't replace it.
        if global.serverPassword = "" {
               global.serverPassword = server_password_string;
        }
    }else{
        //Only remove the password if it was set by this plugin
        if global.serverPassword = server_password_string {
        global.serverPassword = "";
        }
    }
}
')
« Last Edit: October 02, 2012, 05:44:24 pm by Gardicolo »
Logged
A CHALLENGER HAS ARRIVED.
Pages: [1]
 

Page created in 0.024 seconds with 37 queries.