Forum

> > CS2D > Scripts > Script Needed
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch Script Needed

16 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt Script Needed

cupcakez
User Off Offline

Zitieren
yoyo my friends of this 2d shooter,

i have no idea of scripting and honestly too busy with job and other stuff to learn it. To make it short i need a script which should contain the following points.

- each player spawns with a deagle every round
- every player has 800$ at the start of every round
- you can only buy equipment (except tactical shield)

if someone could do that, i would be really thankfull

regards rav3r

alt Re: Script Needed

Rygna
User Off Offline

Zitieren
Maybe, i just can give you This.
this is from sample scripts.

1
2
3
4
5
addhook("startround" , "UseDeagle")
function UseDeagle(id)
	parse("equip "..id.." 3")
	parse("setweapon "..id.." 3")
end

alt Re: Script Needed

Yates
Reviewer Off Offline

Zitieren
@user Rygna: Never use equip in the spawn hook, it may lead to problems as stated on the help page.

1
2
3
4
5
6
7
function _spawn(id)
  parse("setmoney "..id.." 800")
  return "3"
end
addhook("spawn", "_spawn")

parse("mp_buymenu '56, 57, 58, 59, 61, 62'")
You can also add the ID 60 to the list, it will allow people to buy the gasmask, which is also seen as an equipment item.

alt Re: Script Needed

Rainoth
Moderator Off Offline

Zitieren
@user Yates: I'll assume you didn't read the command properly.
You do: "Lets allow to buy equipment with these IDs"
While he does "Lets allow to buy equipment without this ID"

It's essentially the same, just a matter of writing more IDs.

If user cupcakez wants ONLY the equipment and not other weapons to be sold then user Yates' command fits better here.

alt Re: Script Needed

cupcakez
User Off Offline

Zitieren
is it also possible to let cts respawn with a defuse kit? can i just include the kit in there or does it lead to any probs when it tries to let tts respawn with a kit?

alt Re: Script Needed

Rainoth
Moderator Off Offline

Zitieren
I believe attempting to equip equipment (only equipment) will fail and print a message in console saying that it would "lead to problems". There are workarounds though.

alt Re: Script Needed

VADemon
User Off Offline

Zitieren
@user cupcakez: you can use file cs2d [ADMN] TooManyWeapons 1.3b 's internal function "TMW.equipUnequipable(id, itemID)" that can give items like defuse kits to players. I don't know how it will work if you call it immediately inside the spawn hook, so you better delay this equip with cs2d lua cmd timer

PS: Ah you can't script. Ok.
1
2
3
4
5
6
7
8
9
10
addhook("spawn", "vademon_equip_defusekit", -10)
function vademon_equip_defusekit(id)
	if TMW then	-- TMW installed / loaded?
		if player(id, "team") == 2 then	-- CT Team?
			TMW.equipUnequipable(id, 56)	-- 56 = defuse kit ID
		end
	else
		print("[ERROR] vademon_equip_defusekit - TooManyWeapons is not installed!")
	end
end

alt Re: Script Needed

cupcakez
User Off Offline

Zitieren
VADemon

no thx, its gonna be far too complicated and i need to be 100% sure that it works.

1
2
3
4
5
6
7
8
9
10
11
12
13
addhook("spawn","_spawn")
function _spawn(id)
	parse("strip "..id.." 1")
	parse("strip "..id.." 2")
	parse("setweapon "..id.." 3")
	parse("setweapon "..id.." 56")
end

addhook("buy","_buy")
function _buy(id,weapon)
	msg2(id,"©255000000You can't buy any weapons.")
return 1
end

^thats how i got so far. The only thing left to add is that they can't buy anything. And also they dont spawn with a deagle or defuse kit. Someone sees the fault?

alt Re: Script Needed

GeoB99
Moderator Off Offline

Zitieren
Setweapon command isn't that good within the spawn hook. Just return those ID values (check the cs2d lua hook spawn hook reference).

alt Re: Script Needed

tontonEd
User Off Offline

Zitieren
1
2
3
4
5
6
7
8
9
10
11
12
13
function _spawn(id)
  parse("setmoney "..id.." 800")
  if player(id,"team")== 1 then
	return "3"
  elseif player(id,"team")== 2 then
	return "3,56"
  else
     return ""
  end 
end
addhook("spawn", "_spawn")

parse('mp_buymenu "|||||51,52,53,54,57,58,59"')

I edited Yates's solution, it works for me.

alt Re: Script Needed

cupcakez
User Off Offline

Zitieren
Dunno whats wrong but it still doesnt work for me. What i need is only a few things now:

- spawn with deagle (old guns removed)
- cts spawn with kit
- no buying allowed

alt Re: Script Needed

Hajt
User Off Offline

Zitieren
user cupcakez hat geschrieben
Dunno whats wrong but it still doesnt work for me. What i need is only a few things now:

- spawn with deagle (old guns removed)
- cts spawn with kit
- no buying allowed

Maybe doesn't work because you're using two smilar scripts, try it:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
rav3r = {}

addhook("buy","rav3r.buy",666)
function rav3r.buy()
   return 1
end

addhook("spawn","rav3r.spawn",666)
function rav3r.spawn(id)
   if player(id,"team") == 2 then
      return "3,56"
   else
      return "3"
   end
end
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht