Forum

> > CS2D > General > Equip nightvision
Forums overviewCS2D overviewGeneral overviewLog in to reply

English Equip nightvision

3 replies
To the start Previous 1 Next To the start

old Equip nightvision

Alistaire
User Off Offline

Quote
1
2
3
4
if player(id, 'money') >= 195 then 
	parse('setmoney '..id..' '..player(id, 'money')-195) 
	parse('equip '..id..' '..59)
end

Lua Error #1 has written
ERROR: strip - cannot strip 59 - Night Vision (this would lead to problems)!


So - I know this has been posted many times - is it possible to drop it under the player? So that I don't break DC's precious rules? And still make it possible?

old Re: Equip nightvision

DC
Admin Off Offline

Quote
sure cs2d cmd spawnitem
but the player has to walk over it. spawning it on a tile on which the player is already standing will not make the player collect it. you can try to use cs2d cmd setpos twice (move to another position and back to the old one) this should make the player collect the item.

old Re: Equip nightvision

Apache uwu
User Off Offline

Quote
@DC please make "equip" items such as bomb, nightvision, and gasmask

but for now:
1
2
3
4
5
6
if player(id, 'money') >= 195 then 
	parse("spawnitem 59 "..player(id,"tilex").." "..player(id,"tiley"))
	tmp={player(id,"x"),player(id,"y")}
	parse("setpos "..id.." 1 1")
	parse("setpos "..id.." "..tmp[1].." "..tmp[2])
end

I guess you could make a lua function for that like...

1
2
3
4
5
6
function equip(id,item)
	parse("spawnitem "..item.." "..player(id,"tilex").." "..player(id,"tiley"))
	local tmp={player(id,"x"),player(id,"y")}
	parse("setpos "..id.." " 1 1")
	parse("setpos "..id.." "..tmp[1].." "..tmp[2])
end
To the start Previous 1 Next To the start
Log in to replyGeneral overviewCS2D overviewForums overview