Forum

> > CS2D > Scripts > mp_randomspawn with lua
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch mp_randomspawn with lua

5 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt mp_randomspawn with lua

Nori-chan
User Off Offline

Zitieren
Hello guys.
I trying to add something simple in my script:
- When the round starts, mp_randomspawn will be 0. And after 10 seconds, mp_randomspawn will be 1. And it will be 0 on every round start.

My simple code:

Spoiler >


PS: the "seccs" is the number of seconds.

thank you guys for helping me.

alt Re: mp_randomspawn with lua

VADemon
User Off Offline

Zitieren
cs2d lua cmd timer

1
2
3
4
5
addhook("startround","spawnn_")
function spawnn_()
     parse("mp_randomspawn 0")
     timer(10000, "parse", "mp_randomspawn 1")
end

alt Re: mp_randomspawn with lua

Nori-chan
User Off Offline

Zitieren
user VADemon hat geschrieben
cs2d lua cmd timer

1
2
3
4
5
addhook("startround","spawnn_")
function spawnn_()
     parse("mp_randomspawn 0")
     timer(10000, "parse", "mp_randomspawn 1")
end


Just tested it, but it looks like it doesn't work.
Even through it doesn't give any errors.

EDIT: Nevermind, it's working
But, I don't know why, but when I create a server, only after the first round, the randonspawn code works.
3× editiert, zuletzt 01.08.13 03:12:02

alt Re: mp_randomspawn with lua

UnkN
User Off Offline

Zitieren
parse("restart") paste the following
function startround. Or copy parse, timer from hook and past at script begin.

alt Re: mp_randomspawn with lua

Nori-chan
User Off Offline

Zitieren
user UnkN hat geschrieben
parse("restart") paste the following
function startround. Or copy parse, timer from hook and past at script begin.


Thank you for the answer.
I did something different here, but it gave the same results.
So yeah, thank you again for helping me.

alt Re: mp_randomspawn with lua

VADemon
User Off Offline

Zitieren
user Nori-chan hat geschrieben
But, I don't know why, but when I create a server, only after the first round, the randonspawn code works.

Because you used the normal startround hook. For this cs2d lua hook startround_prespawn hook is needed.

Completely fixed code:
1
2
3
4
5
addhook("startround_prespawn","spawnn_")
function spawnn_()
     parse("mp_randomspawn 0")
     timer(10000, "parse", "mp_randomspawn 1")
end

With standard hook the randomspawn==ONE for the first wave of spawning (except its ZERO on first round)
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht