GetPlayerInput not working online

Discuss all aspects related to modding Zandronum here.
Post Reply
User avatar
ibm5155
Addicted to Zandronum
Posts: 1641
Joined: Tue Jun 05, 2012 9:32 pm
Location: Somewhere, over the rainbow

GetPlayerInput not working online

#1

Post by ibm5155 » Mon Apr 29, 2013 5:39 pm

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)
Projects
Cursed Maze: DONE, V2.0
Zombie Horde - ZM09 map update: [3/15/13]
Need help with English? Then you've come to the right place!

<this post is proof of "Decline">

Qent
Retired Staff / Community Team Member
Posts: 1424
Joined: Tue May 29, 2012 7:56 pm
Contact:

RE: GetPlayerInput not working online

#2

Post by Qent » Mon Apr 29, 2013 6:04 pm

Try compat_clientssendfullbuttoninfo 1?

Watermelon
Zandrone
Posts: 1244
Joined: Thu Jun 28, 2012 9:07 pm
Location: Rwanda

RE: GetPlayerInput not working online

#3

Post by Watermelon » Mon Apr 29, 2013 6:07 pm

Does ConsolePlayerNumber() return -1? If not, try -1

User avatar
ibm5155
Addicted to Zandronum
Posts: 1641
Joined: Tue Jun 05, 2012 9:32 pm
Location: Somewhere, over the rainbow

RE: GetPlayerInput not working online

#4

Post by ibm5155 » Tue Apr 30, 2013 7:17 pm

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)
Projects
Cursed Maze: DONE, V2.0
Zombie Horde - ZM09 map update: [3/15/13]
Need help with English? Then you've come to the right place!

<this post is proof of "Decline">

Watermelon
Zandrone
Posts: 1244
Joined: Thu Jun 28, 2012 9:07 pm
Location: Rwanda

RE: GetPlayerInput not working online

#5

Post by Watermelon » Tue Apr 30, 2013 7:28 pm

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.

Qent
Retired Staff / Community Team Member
Posts: 1424
Joined: Tue May 29, 2012 7:56 pm
Contact:

RE: GetPlayerInput not working online

#6

Post by Qent » Tue Apr 30, 2013 7:35 pm

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.

User avatar
ibm5155
Addicted to Zandronum
Posts: 1641
Joined: Tue Jun 05, 2012 9:32 pm
Location: Somewhere, over the rainbow

RE: GetPlayerInput not working online

#7

Post by ibm5155 » Tue Apr 30, 2013 8:15 pm

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
Last edited by ibm5155 on Tue Apr 30, 2013 8:18 pm, edited 1 time in total.
Projects
Cursed Maze: DONE, V2.0
Zombie Horde - ZM09 map update: [3/15/13]
Need help with English? Then you've come to the right place!

<this post is proof of "Decline">

Watermelon
Zandrone
Posts: 1244
Joined: Thu Jun 28, 2012 9:07 pm
Location: Rwanda

RE: GetPlayerInput not working online

#8

Post by Watermelon » Tue Apr 30, 2013 8:25 pm

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
Last edited by Watermelon on Tue Apr 30, 2013 8:26 pm, edited 1 time in total.

User avatar
ibm5155
Addicted to Zandronum
Posts: 1641
Joined: Tue Jun 05, 2012 9:32 pm
Location: Somewhere, over the rainbow

RE: GetPlayerInput not working online

#9

Post by ibm5155 » Tue Apr 30, 2013 8:38 pm

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)
Last edited by ibm5155 on Tue Apr 30, 2013 10:39 pm, edited 1 time in total.
Projects
Cursed Maze: DONE, V2.0
Zombie Horde - ZM09 map update: [3/15/13]
Need help with English? Then you've come to the right place!

<this post is proof of "Decline">

Post Reply