English Auto equip on spawn

14 replies
Goto Page
To the start Previous 1 Next To the start
10.11.17 02:03:10 pm
Up
PersonNamedVictor
User
Offline Off
Hello us , i just wanted to ask if there's a way to auto equip GasMasks on spawn.

Thanks for the help.
IMG:https://i.imgur.com/hNJshpT.png

Admin/mod comment:

Thread moved. /user Borealis
10.11.17 02:41:33 pm
Up
apex2d
User
Offline Off
i thought It would lead to Problems?
Eat Sleep Conquer Repeat. www.Radeon2D.forumid.net
10.11.17 02:43:26 pm
Up
Tw_M
User
Offline Off
@user apex2d:
By Auto-Equipping he means Lua Scripts, not Console Commands.
10.11.17 02:50:33 pm
Up
Promaster
User
Offline Off
Code:
1
2
3
4
addhook("spawn","spawn")
function spawn(id)
     parse("equip "..id.." 60")
end
IMG:https://image.prntscr.com/image/X1Amtfw1T3Wf3eTKzt04Ng.png
10.11.17 02:59:22 pm
Up
Yates
Reviewer
Offline Off
@user Promaster: No. Stop. Bad boy. Read the documentation. Use the return instead to equip items on spawn.

cs2d lua hook spawn

Quote:
Attention: Do NEVER use the "equip" command within this hook! It will probably lead to problems! Use the return value of the hook instead!
10.11.17 03:33:21 pm
Up
apex2d
User
Offline Off
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
Eat Sleep Conquer Repeat. www.Radeon2D.forumid.net
10.11.17 03:37:51 pm
Up
Mora_rus
User
Offline Off
@user apex2d: yes you are.

Code:
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
10.11.17 03:54:33 pm
Up
Masea
Super User
Offline Off
@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?
Create and design your GUI easy and fast: file cs2d GUI Framework (v2) (11) | Go deep of the darkness and try your intrepidity: file cs2d Outlast 2 Modification (25)
10.11.17 04:22:25 pm
Up
PersonNamedVictor
User
Offline Off
oi dont hate on me i just asked cause im worse than a first time coder.but how the hell do i code it with triggers?
IMG:https://i.imgur.com/hNJshpT.png
10.11.17 04:26:08 pm
Up
Yates
Reviewer
Offline Off
@user PersonNamedVictor: He's not talking to you. Notice how his message starts with @user apex2d

The code Mora gave you should suffice unless you need more.
10.11.17 04:27:32 pm
Up
PersonNamedVictor
User
Offline Off
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
IMG:https://i.imgur.com/hNJshpT.png
10.11.17 04:48:42 pm
Up
Masea
Super User
Offline Off
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.
Create and design your GUI easy and fast: file cs2d GUI Framework (v2) (11) | Go deep of the darkness and try your intrepidity: file cs2d Outlast 2 Modification (25)
10.11.17 05:09:25 pm
Up
Yates
Reviewer
Offline Off
@user Masea: I think DC or Simonas mentioned that cs2d cmd equip works for every item now in the current version or should work in the next version.
11.11.17 07:17:40 am
Up
Talented Doge
User
Offline Off
Here you are:

Code:
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
13.11.17 11:56:44 am
Up
apex2d
User
Offline Off
@user Talented Doge:


my method
Eat Sleep Conquer Repeat. www.Radeon2D.forumid.net
To the start Previous 1 Next To the start