PDA

View Full Version : Script bug



Loveboy
20th December 2013, 21:32
Hello Guys, I have got a bug, which is for me very hard to fix it, I really don't know why that happens:

I made a new key, so if someone is on killstreak 5, then the script ist waiting for the button K (so self waittil("key_k").
So if Player 1 killed Player 2, then Player can't spawn, but if Player 1 is pressing K, then Player 2 is spawning.
Why this happens? I didn't added specifically in PlayerKilled or spawnPlayer.

Can somebody help me please?
Thank you!

YuriJurek
20th December 2013, 23:01
Can you please show the actual code involved in it ? cuz I can't rlly tell any error in it, unless I've got some point, anything.
And why are you using waittill?

kung foo man
21st December 2013, 00:11
Like Yuri said, we need some code. It sounds like a missing "thread"

Loveboy
21st December 2013, 09:14
There is nothing missing. Just if I use "waittill" ( self waittill("key_k"); ), then the player 2 will not respawn, he will be respawn if player 1 press the key K ( so cause of the self waittill("key_k"); ). Can't I use something else (so not waittill)?

Tally
21st December 2013, 09:30
There is nothing missing. Just if I use "waittill" ( self waittill("key_k"); ), then the player 2 will not respawn, he will be respawn if player 1 press the key K ( so cause of the self waittill("key_k"); ). Can't I use something else (so not waittill)?

When you use waittill() you need to thread to it, otherwise the code will stop you doing anything else while it is running. This explains why your player wont respawn, because the code is "stuck" in the loop waiting for "key_k" notification, and can't move on.

PLEASE POST YOUR CODE.

If you refuse to post your code, no one will be able to help you.

Loveboy
21st December 2013, 10:01
The script what I use works now, my friend fixed it.
Tally has got right, I didn't thread it to the script. The key K will be able to use it by Killstreaks.
So on Callback_PlayerKilled() it was before:



attacker.killstreak++;
attacker maps\mp\gametypes\_killstreak::getReward();


Now it looks so:



attacker.killstreak++;
attacker thread maps\mp\gametypes\_killstreak::getReward();