Key Inputs
I've got a problem with the Key Inputs
I will do a Function in Think() when I press a key. But a if-clause with the PlayerCommand.Keys as arguement doesnt work, because the Function will be call very much times. Does anybody know, how could do that the function is called only 1 time when the key is pressed
Sry for my Englisch , I'm German
I will do a Function in Think() when I press a key. But a if-clause with the PlayerCommand.Keys as arguement doesnt work, because the Function will be call very much times. Does anybody know, how could do that the function is called only 1 time when the key is pressed
Sry for my Englisch , I'm German
I made a private Variable bool Enable_Key_Walk and put this code in Think()
if ((Keys & PCK_Walk) && (Enable_Key_Walk))
{
if (Class == Class_Medic)
{
Enable_Key_Walk = 0;
EngineFunctions->PrintDebug("Code")
...Code: Select all
... } } if (((Keys & PCK_Walk) == 0) && (Enable_Key_Walk == 0)) { EngineFunctions->PrintDebug("Switch") Enable_Key_Walk = 1; } [/quote] But the [Code] and "Switch" is still called 2 times. I dont understand this :?: PS: The Code Display dont work, and by Quote Display there is no formation, sry
ok i understand, it may not be your code but because of the think function :
think is called two time :
- 1 by the server side
- 1 by the client side
so if you test as me in only one computer then the two call occure...
perhaps you could use a variable named "think_on_serverside" (or something like that) to add a test.
think is called two time :
- 1 by the server side
- 1 by the client side
so if you test as me in only one computer then the two call occure...
perhaps you could use a variable named "think_on_serverside" (or something like that) to add a test.
I got it
The code is called twice because it is called on Client and on Server Side
So you have to add ThinkingOnServerSide as arguement in the if clauses and it works
The code is called twice because it is called on Client and on Server Side
So you have to add ThinkingOnServerSide as arguement in the if clauses and it works
if ((Keys & PCK_Walk) && (Enable_Key_Walk) && (ThinkingOnServerSide))
{
if (Class == Class_Medic)
{
Enable_Key_Walk = 0;
EngineFunctions->PrintDebug("Code")
...Code: Select all
... } } if (((Keys & PCK_Walk) == 0) && (Enable_Key_Walk == 0) && (ThinkingOnServerSide)) { EngineFunctions->PrintDebug("Switch") Enable_Key_Walk = 1; } [/quote] Edit: Hmm, you were faster :wink:
Who is online
Users browsing this forum: No registered users and 22 guests