SA-MP Forums Archive
Changing amount of max players in-game? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Changing amount of max players in-game? (/showthread.php?tid=252490)



Changing amount of max players in-game? - Skylar Paul - 01.05.2011

Well, I'm a bit rusty as of lately, and I've completely forgotten how to change my max player amount in-game, currently I have:

pawn Код:
#define     cfg_SERVER_MAXPLAYERS   "100" //PARAMETERS: Number value (1-500 as of 0.3c)
    SendRconCommand("maxplayers " cfg_SERVER_MAXPLAYERS);
    printf("\t[-] Server Max Players: %s", cfg_SERVER_MAXPLAYERS);
Now, it sets the value correctly, but the RCON Command doesn't seem to be working - Does anybody know what i'm doing wrong? I'm sure it's something stupid, but I can't see it at the moment.

Thank you in advance.


Re: Changing amount of max players in-game? - admantis - 01.05.2011

Umm.. first, SendRconCommand has only 1 parameter (which is the command itself), and the second error is that you're printing the max players as a string while it is a integer (or you can use strval to convert it to a integer), and last thing is that you've defined cfg_SERVER_MAX_PLAYERS as a string.

You can either use format() and strval() or use format() and converting your values to integer.
Solution 1:
pawn Код:
#define     cfg_SERVER_MAXPLAYERS   100 //PARAMETERS: Number value (1-500 as of 0.3c)

new le[32];
format(le, 32, "maxplayers %d", cfg_SERVER_MAXPLAYERS);
SendRconCommand(le);

printf("\t[-] Server Max Players: %d", cfg_SERVER_MAXPLAYERS);
Solution 2:
pawn Код:
#define     cfg_SERVER_MAXPLAYERS   "100" //PARAMETERS: Number value (1-500 as of 0.3c)

new number, le[32];
number = strval(cfg_SERVER_MAXPLAYERS);
format(le, 32, "maxplayers %d", number);

SendRconCommand(le);

printf("\t[-] Server Max Players: %d", strval(cfg_SERVER_MAXPLAYERS));



Re: Changing amount of max players in-game? - Skylar Paul - 01.05.2011

Quote:
Originally Posted by admantis
Посмотреть сообщение
Umm.. first, SendRconCommand has only 1 parameter (which is the command itself), and the second error is that you're printing the max players as a string while it is a integer (or you can use strval to convert it to a integer), and last thing is that you've defined cfg_SERVER_MAX_PLAYERS as a string.

You can either use format() and strval() or use format() and converting your values to integer.
Solution 1:
pawn Код:
#define     cfg_SERVER_MAXPLAYERS   100 //PARAMETERS: Number value (1-500 as of 0.3c)

new le[32];
format(le, 32, "maxplayers %d", cfg_SERVER_MAXPLAYERS);
SendRconCommand(le);

printf("\t[-] Server Max Players: %d", cfg_SERVER_MAXPLAYERS);
Solution 2:
pawn Код:
#define     cfg_SERVER_MAXPLAYERS   "100" //PARAMETERS: Number value (1-500 as of 0.3c)

new number, le[32];
number = strval(cfg_SERVER_MAXPLAYERS);
format(le, 32, "maxplayers %d", number);

SendRconCommand(le);

printf("\t[-] Server Max Players: %d", strval(cfg_SERVER_MAXPLAYERS));
Neither solution seems to be working -

Quote:

SA-MP Dedicated Server
----------------------
v0.3c R2, ©2005-2011 SA-MP Team

[14:11:38] filterscripts = "" (string)
[14:11:38]
[14:11:38] Server Plugins
[14:11:38] --------------
[14:11:38] Loading plugin: sscanf
[14:11:38]

[14:11:38] ===============================

[14:11:38] sscanf plugin loaded.

[14:11:38] © 2009 Alex "******" Cole

[14:11:38] ===============================

[14:11:38] Loaded.
[14:11:38] Loading plugin: streamer
[14:11:38]

*** Streamer Plugin v2.5.1 by Incognito loaded ***

[14:11:38] Loaded.
[14:11:38] Loaded 2 plugins.

[14:11:38]
[14:11:38] Filter Scripts
[14:11:38] ---------------
[14:11:38] Loaded 0 filter scripts.

[14:11:38] [+] SERVER CONFIGURATION
[14:11:38]
[14:11:38] [-] Server Name: Land o' Casinos Roleplay
[14:11:38] [-] Server Version: LoC v1.0
[14:11:38] maxplayers = 3 (int, read-only) //Problem area.
[14:11:38] [-] Server Max Players: d
[14:11:38] [-] CJ Run: [ON]
[14:11:38] [-] 1 Pickup(s) loaded from "Pickups.txt"
[14:11:38] [-] 0 Vehicle(s) loaded from "Vehicles.txt"
[14:11:38] [-] 1 Label(s) loaded from "Labels.txt"
[14:11:38] [-] 1 Map Icon(s) loaded from "MapIcons.txt"
[14:11:38]
[14:11:38] [+] SERVER ONLINE!
[14:11:38] Number of vehicle models: 0

Code:

pawn Код:
new MPlayers, MPlayersFormated[32];
    MPlayers = strval(cfg_SERVER_MAXPLAYERS);
    format(MPlayersFormated, 32, "maxplayers %d", MPlayers);
    SendRconCommand(MPlayersFormated);
    printf("\t[-] Server Max Players: %s", strval(cfg_SERVER_MAXPLAYERS));



Re: Changing amount of max players in-game? - admantis - 01.05.2011

pawn Код:
printf("\t[-] Server Max Players: %d", strval(cfg_SERVER_MAXPLAYERS));



Re: Changing amount of max players in-game? - Skylar Paul - 01.05.2011

Quote:
Originally Posted by admantis
Посмотреть сообщение
pawn Код:
printf("\t[-] Server Max Players: %d", strval(cfg_SERVER_MAXPLAYERS));
That fixed the print, thanks, but still not working. It's not setting the integer for some reason or another.


Re: Changing amount of max players in-game? - Calgon - 01.05.2011

You can't change that value in-game, it's a read-only value that has no RCON command / entry.


Re: Changing amount of max players in-game? - Skylar Paul - 01.05.2011

Quote:
Originally Posted by Calg00ne
Посмотреть сообщение
You can't change that value in-game, it's a read-only value that has no RCON command / entry.
Well then, that would have been nice to know before-hand, lol. Here I was thinking I was just a moron, thank you anyways Admantis, oh, and thank you calg00ne for telling me it's not possible.