Forum

> > CS2D > Scripts > Just Some Scripts needed
Forums overviewCS2D overview Scripts overviewLog in to reply

English Just Some Scripts needed

2 replies
To the start Previous 1 Next To the start

old Just Some Scripts needed

Man Of Steel
User Off Offline

Quote
Hi everyone,

I'm always glad,whenever i'm ask any problem here, and he solved always.

Today, i want an script maybe anyone can make for me :P,

I want that when anybody left the game so his all items are dropped in server/map and others players can take it.

And I've another request, i want that Npc are only attack
Terrorist,but don't gotta for Counter-Terrorist, Specially Solider npcs

I shall be very happy if you are help me for this matter.

Thanks for attention,

old Re: Just Some Scripts needed

GeoB99
Moderator Off Offline

Quote
For the first script, I would go by checking the items that a player carries by using cs2d lua cmd playerweapons, check their position and spawn them using cs2d cmd spawnitem approach. To sum all up, here's the code:
1
2
3
4
5
6
7
8
9
10
function DropWeaponsOnLeave(id, reason)
  for _, DropItem in pairs( playerweapons(id) ) do

    local GetItemPos = {player(DropItem, 'tilex'), player(DropItem, 'tiley')}

    parse('spawnitem ' .. GetItemPos[1] .. ' ' .. GetItemPos[2])
  end
end

addhook('leave', 'DropWeaponsOnLeave')
Beware that it is not guaranteed my approach may work but give it a try. If bugs occur within the console, please post them.
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview