Page 1 of 1

GetPlayerInput not working online

Posted: Mon Apr 29, 2013 5:39 pm
by ibm5155
here I have a script that isn´t working online =/

Code: Select all

script 30 (void) clientside
{
    int counter=0;
    int posy=-3.0;
    while(posy<=0.05)
    {
        SetFont("NEDML");
        HudMessagebold(s:"A"; HUDMSG_FADEINOUT, 0, CR_UNTRANSLATED, 0.5, posy,0.1,0, 0.3);
        posy+=0.01;
        delay(1);
    }
        SetFont("NEDML");
        HudMessagebold(s:"A"; HUDMSG_PLAIN , 800, counter, 0.5, posy,0,0, 0);
    Music_Played=3;
    setmusic("NEDM",0,0);
    delay(35);
    spawnspot("FlareDisco",87,132,0);
    ACS_Suspend(34,0);
    acs_execute(31,0);Cat 1 script
    acs_Execute(32,0);Cat 2 script
    acs_execute(33,0);Light disco
    while(true)
    {
        if(GetPlayerInput(ConsolePlayerNumber(),INPUT_BUTTONS)==13)//Consoleplayernumber() -> your tid right? and 13 is crouch + jump + fire, I may change it to only altfire
        {
            if(nedm_desactive==true)
            {
                print(s:"nedm actived");
                nedm_desactive=false;
                SetFont("NEDML");
                HudMessagebold(s:"A"; HUDMSG_PLAIN , 800, counter, 0.5, posy,0,0, 0);
                delay(50);
            }
            else
            {
                print(s:"nedm desactived");
                nedm_desactive=true;//Cat script´ll only show the cat if false
                HudMessagebold(s:""; HUDMSG_PLAIN , 800, counter, 0.5, posy,1,1, 1);
                delay(50);
            }
        }
        delay(1);
    
    }
}
The problem is this i think "ConsolePlayerNumber(),INPUT_BUTTONS)==13"
If player crouch + jump + fire it should be 13 (it works offline) it´s like a selector if you want to see the cats on screen or not.
So, did I did some mistake ? :s
(This script show a image, then you can select to see or not see doing that commands, and it should only affect the players who called it)

RE: GetPlayerInput not working online

Posted: Mon Apr 29, 2013 6:04 pm
by Qent
Try compat_clientssendfullbuttoninfo 1?

RE: GetPlayerInput not working online

Posted: Mon Apr 29, 2013 6:07 pm
by Watermelon
Does ConsolePlayerNumber() return -1? If not, try -1

RE: GetPlayerInput not working online

Posted: Tue Apr 30, 2013 7:17 pm
by ibm5155
It returns the console player tid (each player have a tid) ex: player1 and player2, player1 will result 0 on consoleplayernumber and player2 1.
Hmm Does clientside scripts can change global values like nedm_desactive? (This would alow cats on screen to be actived or not)

RE: GetPlayerInput not working online

Posted: Tue Apr 30, 2013 7:28 pm
by Watermelon
Interestingly, the server AND the client have their own values.

Therefore if you do

Code: Select all

int nedm_desactive;
When the server runs it has its own value, and when the client connects it has its own value. If you set one on the client, it changes the clients one only. If you set one on the server, it changes the server's variable only.



If you haven't tried the -1, try it out and tell me if it works or does not.

RE: GetPlayerInput not working online

Posted: Tue Apr 30, 2013 7:35 pm
by Qent
ibm5155 wrote: It returns the console player tid (each player have a tid) ex: player1 and player2, player1 will result 0 on consoleplayernumber and player2 1.
BTW that's a player number, not a tid.

RE: GetPlayerInput not working online

Posted: Tue Apr 30, 2013 8:15 pm
by ibm5155
Watermelon wrote: Interestingly, the server AND the client have their own values.

Therefore if you do

Code: Select all

int nedm_desactive;
When the server runs it has its own value, and when the client connects it has its own value. If you set one on the client, it changes the clients one only. If you set one on the server, it changes the server's variable only.



If you haven't tried the -1, try it out and tell me if it works or does not.
When I discovered the clientside power, I´m using it for many things :D

So you mean to do this?

Code: Select all

if(GetPlayerInput(-1,INPUT_BUTTONS)==13)
{
             ...
}
Well this way offline didn´t worked, but online both players were detecting the comand number O_o

edit: On the print I cannot see the result, but it worked on the if even ofline O_O

RE: GetPlayerInput not working online

Posted: Tue Apr 30, 2013 8:25 pm
by Watermelon
ibm5155 wrote:
Watermelon wrote: Interestingly, the server AND the client have their own values.

Therefore if you do

Code: Select all

int nedm_desactive;
When the server runs it has its own value, and when the client connects it has its own value. If you set one on the client, it changes the clients one only. If you set one on the server, it changes the server's variable only.



If you haven't tried the -1, try it out and tell me if it works or does not.
When I discovered the clientside power, I´m using it for many things :D

So you mean to do this?

Code: Select all

if(GetPlayerInput(-1,INPUT_BUTTONS)==13)
{
             ...
}
Well this way offline didn´t worked, but online both players were detecting the comand number O_o

edit: On the print I cannot see the result, but it worked on the if even ofline O_O
Thats because offline, the client is sort of like the server and the client at the same time.

If you want online/offline capability, you need to do a check to see if its a net game, and if it is then use -1... but if it isn't then use the console player number

CLIENTSIDE scripts are an amazing tool! I made a mouse with it :D

RE: GetPlayerInput not working online

Posted: Tue Apr 30, 2013 8:38 pm
by ibm5155
There´re some things that I need to test like, If only the activator script execute a script that spawn a cyberdemon, does other players´ll see the cyberdemon, or even worse, ´ll they die? D:
or maybe only the activator ll see it and it would generate some problens with players sync (player see others being blocked by cyberdemon while they re just running and don´t see he)

EDIT: I did the test and the result is weird, you can see and pass by the mosnter, you cant hit he but if you jump up he you ll be up (but looking with another player youll be touching the floor while you think you´re on air O_o)