Page 1 of 2

I need a total control over the player >:D

Posted: Thu Aug 14, 2014 3:10 am
by Zeberpal
So I make a mod, where I HAVE TO force players to use basic Skin and limit their free mouselook to dimensions like in software render.
Ofcourse, I want to do so only for a time they play my mod, I don't want new settings to be saved in the zandronum.ini forever. I tried to make a script for this temporary thingy:

Script 1 OPEN Clientside
{
if(GetCVar("disable_autoconfig") <= 0)
{
ConsoleCommand("set disable_autoconfig 0");
ConsoleCommand("archivecvar disable_autoconfig");
}}


Script 2 ENTER Clientside
{
if(GetCVar("disable_autoconfig") == True) Terminate;
While(1)
{
if(getcvar("cl_skins") == True) Consolecommand("cl_skins false"); //////////////////////////////////////<---This doesn't work :(
if(getcvar("cl_disallowfullpitch") == False) Consolecommand("cl_disallowfullpitch True"); //////////////<---This doesn't work :(
if(getcvar("sv_noidentifytarget") == False) Consolecommand("sv_noidentifytarget true"); ////////////<---This works :D
Delay(1);
}
Delay(1);
}
//Catastrophed


And it still save it in .ini, except where "This works"
As you can see, SV cvars do that and CL cvars don't. Is there any other way ???

P.S. I found this issue in bug tracker. Does it mean, if they add official CVar support to ACS, I will be able to accomplish my target?

RE: I need a total control over the player >:D

Posted: Thu Aug 14, 2014 3:52 am
by Catastrophe
Why is script 2 not clientsided? Also why is it not an enter script instead? Script 1 needs to be clientsided as well. Please look here: http://wiki.zandronum.com/Clientside_Scripting

RE: I need a total control over the player >:D

Posted: Thu Aug 14, 2014 5:16 am
by Zeberpal
I did so Catastrophe, thanks for pointing this out. It doesn't solve my main problem obviously though.

RE: I need a total control over the player >:D

Posted: Thu Aug 14, 2014 5:33 am
by Absolute Zero
Make a new server-side script for sv_noidentifytarget.

RE: I need a total control over the player >:D

Posted: Thu Aug 14, 2014 5:56 am
by Zeberpal
It's not connected Absolute Zero. I deleted sv_noidentifytarget line at all just to make sure. It still saves cl_dissalowfullpitch 1 and cl_skins 0 to config.

RE: I need a total control over the player >:D

Posted: Thu Aug 14, 2014 9:37 am
by ZzZombo
Add +NOSKIN to the player class. No need to mess with settings.

RE: I need a total control over the player >:D

Posted: Thu Aug 14, 2014 10:34 am
by Zeberpal
ZzZombo, true. Anyway, I guess i'll have to look forward for CVARINFO backport. Can't wait.

RE: I need a total control over the player >:D

Posted: Thu Aug 14, 2014 3:56 pm
by Catastrophe
Script 1 OPEN
{
if(getcvar("sv_noidentifytarget") == False) Consolecommand("sv_noidentifytarget true");
}


Script 2 ENTER Clientside
{
if(consoleplayernumber() != playernumber()) terminate;
if(GetCVar("disable_autoconfig") <= 0)
{
ConsoleCommand("set disable_autoconfig 0");
ConsoleCommand("archivecvar disable_autoconfig");
}
if(GetCVar("disable_autoconfig") == True) Terminate;
While(1)
{
if(getcvar("cl_skins") == True) Consolecommand("cl_skins false");
if(getcvar("cl_disallowfullpitch") == False) Consolecommand("cl_disallowfullpitch True");
Delay(1);
}
Delay(1);
}

RE: I need a total control over the player >:D

Posted: Fri Aug 15, 2014 6:11 am
by Torr Samaho
Note that we are planning to remove ConsoleCommand from 2.0 (CVARINFO and SetCVar were the last major things missing to replace the legit uses of ConsoleCommand), so unless you release your mod before 2.0 comes out, I recommend you not to rely on ConsoleCommand. If you need to restrict the pitch, request something like sv_disallowfullpitch at the tracker.

RE: I need a total control over the player >:D

Posted: Fri Aug 15, 2014 10:43 am
by Vincent(PDP)
Torr Samaho wrote: Note that we are planning to remove ConsoleCommand from 2.0 (CVARINFO and SetCVar were the last major things missing to replace the legit uses of ConsoleCommand), so unless you release your mod before 2.0 comes out, I recommend you not to rely on ConsoleCommand. If you need to restrict the pitch, request something like sv_disallowfullpitch at the tracker.
Puking scripts though ConsoleCommand is sometimes useful for modders. :G

RE: I need a total control over the player >:D

Posted: Fri Aug 15, 2014 11:04 am
by Hypnotoad
Torr Samaho wrote: Note that we are planning to remove ConsoleCommand from 2.0 (CVARINFO and SetCVar were the last major things missing to replace the legit uses of ConsoleCommand), so unless you release your mod before 2.0 comes out, I recommend you not to rely on ConsoleCommand. If you need to restrict the pitch, request something like sv_disallowfullpitch at the tracker.
What if you want to dynamically change Zandro's built in CVARs? As far as I understand it SetCvar and CVARINFO only allows you to set and change mod specific CVARs.

RE: I need a total control over the player >:D

Posted: Fri Aug 15, 2014 12:06 pm
by Ijon Tichy
Vincent(PDP) wrote: Puking scripts though ConsoleCommand is sometimes useful for modders. :G
That got addressed too.

RE: I need a total control over the player >:D

Posted: Fri Aug 15, 2014 5:58 pm
by Torr Samaho
Hypnotoad wrote: What if you want to dynamically change Zandro's built in CVARs? As far as I understand it SetCvar and CVARINFO only allows you to set and change mod specific CVARs.
Messing with user settings was never an intended purpose of ConsoleCommand. Actually, this was abused several times by mods to the point that I almost removed ConsoleCommand without having replacements for its legitimate uses in place.

If you have a specific example of a usage case you consider legitimate that has no replacement, I'd be happy to discuss this in the tracker ticket.

RE: I need a total control over the player >:D

Posted: Fri Aug 15, 2014 6:56 pm
by Hypnotoad
Torr Samaho wrote:
Hypnotoad wrote: What if you want to dynamically change Zandro's built in CVARs? As far as I understand it SetCvar and CVARINFO only allows you to set and change mod specific CVARs.
Messing with user settings was never an intended purpose of ConsoleCommand. Actually, this was abused several times by mods to the point that I almost removed ConsoleCommand without having replacements for its legitimate uses in place.

If you have a specific example of a usage case you consider legitimate that has no replacement, I'd be happy to discuss this in the tracker ticket.
I suggested in #zatesting that a new thread be made, possibly on the forums rather than in the tracker because it will get more exposure, where we attempt to list all the legitimate uses of consolecommand() and let mod authors submit their own uses, then we use this list as a checklist of sorts to make sure we can recreate this with new 2.0 commands before releasing 2.0.

RE: I need a total control over the player >:D

Posted: Sat Aug 16, 2014 8:02 am
by ZzZombo
How

Code: Select all

if(ConsolePlayerNumber()!=PlayerNumber())
is supposed to work? For each player these functions return identical values when called from a clientside script.

RE: I need a total control over the player >:D

Posted: Sat Aug 16, 2014 11:36 am
by Torr Samaho
Hypnotoad wrote: I suggested in #zatesting that a new thread be made, possibly on the forums rather than in the tracker because it will get more exposure, where we attempt to list all the legitimate uses of consolecommand() and let mod authors submit their own uses, then we use this list as a checklist of sorts to make sure we can recreate this with new 2.0 commands before releasing 2.0.
Alright, I'll create such a thread when I release the next 2.0 beta build. This way people can easily check what's possible with 2.0 now.
ZzZombo wrote: How

Code: Select all

if(ConsolePlayerNumber()!=PlayerNumber())
is supposed to work? For each player these functions return identical values when called from a clientside script.
No, ConsolePlayerNumber returns a different value on each client.

RE: I need a total control over the player >:D

Posted: Sat Aug 16, 2014 5:29 pm
by Vincent(PDP)
PlayerNumber returns the player's number that activated the script. ConsolePlayerNumber returns your current player number. So if there's a server with 8 players, and player 3 activated the script but it for some reason still was executed to everybody, PlayerNumber would always return 3, while ConsolePlayerNumber would return 0 for player 1 and 1 for player 2, 2 for player 3 etc etc etc.

RE: I need a total control over the player >:D

Posted: Sat Aug 16, 2014 5:31 pm
by Catastrophe
ZzZombo wrote: How

Code: Select all

if(ConsolePlayerNumber()!=PlayerNumber())
is supposed to work? For each player these functions return identical values when called from a clientside script.
See http://wiki.zandronum.com/ConsolePlayerNumber

RE: I need a total control over the player >:D

Posted: Sat Aug 16, 2014 5:35 pm
by Vincent(PDP)
One question, anybody that knows this... Will DISCONNECT scripts be activated when closing a Singleplayer game?

RE: I need a total control over the player >:D

Posted: Sat Aug 16, 2014 8:30 pm
by Dusk
I highly doubt it. Once you close a singleplayer game no scripts will be running anyway.