Raised This Month: $51 Target: $400
 12% 

[L4D2] Keep items from spawing


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Austin
Senior Member
Join Date: Oct 2005
Old 07-07-2022 , 04:11   [L4D2] Keep items from spawing
Reply With Quote #1

Can someone show me how to:
1) Hook when items are spawned
2) On spawn of certain items I would like to keep them from spawning.

Something like
PHP Code:
OnEntityCreated(int entity, const char[] classname)
{
   if (
strcmp(classname"weapon_rifle")==0
   
// kiil entity or keep it from spawning….

Austin is offline
Marttt
Veteran Member
Join Date: Jan 2019
Location: Brazil
Old 07-07-2022 , 11:20   Re: [L4D2] Keep items from spawing
Reply With Quote #2

Depending on what you want,

Some attributes are only available (updated) on SDKHook "OnSpawnPost"
other stuff (like skin or owner) usually needs to wait for a frame (RequestFrame) to have the value updated. (after SpawnPost)
then you just have to kill the entity (KillEntity) or AcceptEntityInput Kill


Just a note, using weapon_rifle as example,

Some entities classname are not just "weapon_rifle" but "weapon_spawn" (then you need the weaponID) or "weapon_rifle_spawn" instead (may have other
variation aswell, eg. weapon_melee / weapon_item_spawn )

Check here: https://developer.valvesoftware.com/..._L4D2_Entities
__________________

Last edited by Marttt; 07-07-2022 at 11:21.
Marttt is offline
HarryPotter
Veteran Member
Join Date: Sep 2017
Location: Taiwan, Asia
Old 07-19-2022 , 16:49   Re: [L4D2] Keep items from spawing
Reply With Quote #3

You might take a look

Quote:
Originally Posted by Silvers View Post
OnEntityCreated - Retrieving Data:
Spoiler

__________________
HarryPotter is offline
Silvers
SourceMod Plugin Approver
Join Date: Aug 2010
Location: SpaceX
Old 07-19-2022 , 17:47   Re: [L4D2] Keep items from spawing
Reply With Quote #4

You'll want to hook SDKHook_SpawnPost from OnEntityCreated and RemoveEntity() in the SpawnPost, otherwise likely to cause a server crash.
__________________

Last edited by Silvers; 07-19-2022 at 17:48.
Silvers is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 14:08.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode