Forum

> > CS2D > Scripts > Auto equip on spawn
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch Auto equip on spawn

14 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt Re: Auto equip on spawn

Yates
Reviewer Off Offline

Zitieren
@user Promaster: No. Stop. Bad boy. Read the documentation. Use the return instead to equip items on spawn.

cs2d lua hook spawn

Zitat
Attention: Do NEVER use the "equip" command within this hook! It will probably lead to problems! Use the return value of the hook instead!

alt Re: Auto equip on spawn

apex2d
User Off Offline

Zitieren
i suck at codes but
Pls don't open the Spoiler
this is the nearest result
Spoiler >


That code will spawn a Gaskmask Beneath you

alt Re: Auto equip on spawn

Mora
User Off Offline

Zitieren
@user apex2d: yes you are.

1
2
3
4
addhook("spawn","Equip_")
function Equip_(id)
	return 60
end
As yates mentioned, there is also example how to use it on link he provide:
IMG:https://i.imgur.com/nNcfioQ.png

alt Re: Auto equip on spawn

Masea
Super User Off Offline

Zitieren
@user apex2d: If you're suck at it, why you needed to post on this thread? Or are you also suck as can't even think you shouldn't have done this?

alt Re: Auto equip on spawn

PersonNamedVictor
User Off Offline

Zitieren
i know i meant how do i use the code mora gave. like do i put it in the console? do i put a special ent or trigger?

cause i want the ct's in my map to instantly come with a gasmask on them.

so it fits the lore of the map more

alt Re: Auto equip on spawn

Masea
Super User Off Offline

Zitieren
Gas Masks aren't actually equipable though. If it is as well as up to cs2d lua hook spawn hook.

I could share the code but I'm not at the home now. It basically would be about spawning a gas mask under the player and set player position to anywhere and set back to the original position. And you'll eventually be equipped with a gas mask.

alt Re: Auto equip on spawn

Talented Doge
User Off Offline

Zitieren
Here you are:

1
2
3
4
5
6
7
8
addhook("spawn", "_spawn")

function _spawn(p)
	parse("spawnitem 56 "..player(p, "tilex").." "..player(p, "tiley"))
	local x, y = player(p, "tilex"), player(p, "tiley")
	parse("setpos "..p.." "..(player(p, "tilex") + 0.5) * 32 + 16 .." ".. (player(p, "tiley") + 0.5) * 32 + 16)
	parse("setpos "..p.." "..x * 32 + 16 .." ".. y * 32 + 16)
end
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht