Re: [hlcoders] Removing entities

2004-04-29 Thread David Anderson

Some things I found (while making CSDM) on CS entities:

1] You cannot add new spawns dynamically to CS 1.6 anymore.
2] You cannot remove spawns dynamically from CS 1.6 anymore.
3] You can create weapons in two ways - spawning them (in CS 1.6 they will
disappear after 2 seconds though) or by creating "fake ones" and hooking
Touch()
4] You can remove weapons from CS still... you can look into the archives
and see me begging Alfred to help me with this :] but that was met with
nothing.  Calling a weapon's Think() function will destroy it... in
Metamod that's MDLL_Think(edict_t *).  I have not tested deleting spawns
because that is no longer useful to me (now I created an algorithm to use
the old spawns and set origins.

Note that this is how you should remove
weapons: Find the "weaponbox" that has the target weapon model, then
remove the actual entity that has the weapon as the classname, whose owner
is the weaponbox entity.

5] You can test if a player has a shield by seeing what model they have I
think.  That is how many AMX Mod * plugins do it.

To spawn weapons in CS what I did was make my own internally cached "fake"
weapon entities, which are stored in a hash array... then when a player
touches them, I use the item giving code from OLO's fun module.

I'll give you code because I spent weeks figuring this out :] If Valve
decides to break it again in a future update, I will probably quit because
too many people would harass me to fix it :\ but since they are not
obligated to not break it, be aware that this may not work in the future.

 -David "BAILOPAN" Anderson
 http://www.amxmodx.org/

Example code for giving a CS weapon:

int iWeapon = ALLOC_STRING("weapon_awp");
edict_t *pWeapon = CREATE_NAMED_ENTITY(iWeapon);
if (FNullEnt(pWeapon))
return;
pWeapon->v.origin = pEntity->v.origin;
pWeapon->v.spawnflags |= SF_NORESPAWN;

MDLL_Spawn(pWeapon);
int solidstate = pWeapon->v.solid;
MDLL_Touch(pWeapon, ENT(pEntity));

if (pWeapon->v.solid == solidstate)
REMOVE_ENTITY(pWeapon);

Example code for destroying a CS weapon:

#ifdef STEAM
#define RemoveWeapon(x) MDLL_Think(x)
#else
#define RemoveWeapon(x) REMOVE_ENTITY(x)
#endif

void DeleteCSWeapon(char *weaponmodel, char *weapon, int player)
{
edict_t *pPlayer = INDEXENT(player);
edict_t *tEnt = FIND_ENTITY_BY_STRING(NULL, "classname",
"weaponbox");
edict_t *wEnt = NULL;
while (!FNullEnt(tEnt)) {
const char *model = STRING(model);
if (strcmp(model, weaponmodel)==0) {
if (ENTINDEX(tEnt->v.owner)==player) {
wEnt = FIND_ENTITY_BY_STRING(NULL,
"classname", weapon);
while (!FNullEnt(wEnt)) {
if
(ENTINDEX(wEnt->v.owner)==ENTINDEX(tEnt)) {
RemoveWeapon(wEnt);
}
wEnt = FIND_ENTITY_BY_STRING(wEnt,
"classname", weapon);
} //finding wEnts
} //owners matched
RemoveWeapon(tEnt);
} //weapon matched
tEnt = FIND_ENTITY_BY_STRING(tEnt, "classname",
"weaponbox");
} //finding tEnts
}

Code for spawning a permanent weapon the ground: build your own give
weapon wrapper :]


___
To unsubscribe, edit your list preferences, or view the list archives, please visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders



Re: [hlcoders] Removing entities

2004-04-29 Thread Jeffrey \"botman\" Broome
Matt Judge wrote:

Adding and removing of weapons works with 1.6?
Not that I know of.  The only way I know of to remove weapons in
Counter-Strike is to intercept (on the server) the commands used to buy
the weapons and not let the MOD code see these commands (thus the player
will never be able to have the weapon).
Counter-Strike "gives" weapons to players on the fly.  It doesn't spawn
them in the world and wait for a player to pick them up like in
Half-Life deathmatch.  Stripper2 only allows you to remove items that
have been spawned into the world waiting for someone to pick them up.
Stripper2 also can't be used to remove weapons dropped by a player
(since it only intercepts things spawned at the time when the map is
loaded).
All my attempts to remove a spawned weapon causes the server to crash :(
You might try looking at the source code for some other plugins that
prevent players from getting certain weapons (AdminMOD and AMX both
probably have this).
--
Jeffrey "botman" Broome
___
To unsubscribe, edit your list preferences, or view the list archives, please visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders


Re: [hlcoders] Removing entities

2004-04-29 Thread Matt Judge


Deadman Standing wrote:

Any entities you create can be removed without issue (I do it all the
time).
Deleting entities created by the game (like map spawned entities) may
cause issues with the caching mechanism introduced a few releases ago.
At least that is the word as I recall it.


Any sample code for me to "borrow"? ;)

Matt.

___
To unsubscribe, edit your list preferences, or view the list archives, please visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders


RE: [hlcoders] Removing entities

2004-04-29 Thread Deadman Standing
Any entities you create can be removed without issue (I do it all the
time).

Deleting entities created by the game (like map spawned entities) may
cause issues with the caching mechanism introduced a few releases ago.
At least that is the word as I recall it.

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Matt Judge
Sent: Thursday, April 29, 2004 4:59 PM
To: [EMAIL PROTECTED]
Subject: Re: [hlcoders] Removing entities



Jeffrey "botman" Broome wrote:

> Yes.  There are many people that have taken the standard 20 player
maps
> and made 32 player maps from them.  If you want to play around with a
> metamod plugin that allows dynamically adding and remove stuff to/from
a
> map, take a look at my Stripper2 plugin...
>
> http://planethalflife.com/botman/stripper2.shtml

Adding and removing of weapons works with 1.6?  All my attempts to
remove a spawned weapon causes the server to crash :(

I have looked at your code, but I shall revisit it now :)

Matt.


___
To unsubscribe, edit your list preferences, or view the list archives,
please visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders





___
To unsubscribe, edit your list preferences, or view the list archives, please visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders



Re: [hlcoders] Removing entities

2004-04-29 Thread Matt Judge


Jeffrey "botman" Broome wrote:

Yes.  There are many people that have taken the standard 20 player maps
and made 32 player maps from them.  If you want to play around with a
metamod plugin that allows dynamically adding and remove stuff to/from a
map, take a look at my Stripper2 plugin...
http://planethalflife.com/botman/stripper2.shtml
Adding and removing of weapons works with 1.6?  All my attempts to
remove a spawned weapon causes the server to crash :(
I have looked at your code, but I shall revisit it now :)

Matt.

___
To unsubscribe, edit your list preferences, or view the list archives, please visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders


Re: [hlcoders] Removing entities

2004-04-29 Thread Jeffrey \"botman\" Broome
Matt Judge wrote:

I am looking to be able to add or remove spawn points, and also remove
weapons from the CS.
Is this possible?
Yes.  There are many people that have taken the standard 20 player maps
and made 32 player maps from them.  If you want to play around with a
metamod plugin that allows dynamically adding and remove stuff to/from a
map, take a look at my Stripper2 plugin...
http://planethalflife.com/botman/stripper2.shtml

Make sure that spawn points that are added to the map aren't placed to
close to world geometry that would collide with the player (otherwise
the player will be "stuck" and can't move).
2 other questions I have :)

1) Is there a way to force a client to drop a weapon without issuing the
CLIENT_COMMAND(pEntity, "drop")?
That's the only method that I know of.  Clients can't block this command
(unless they are running some clientside cheat that sneaks past VAC and
intercepts server commands).
2) Is there an easy way to see if a shield is being carried but not
deployed?  I have these 2 bits of code which hint on a solution, but I
am hoping that asking here will give me a better insight.
I don't know nuthin' about no shields in Counter-Strike.

--
Jeffrey "botman" Broome
___
To unsubscribe, edit your list preferences, or view the list archives, please visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders


Re: [hlcoders] Removing entities

2004-04-29 Thread Matt Judge


Jeffrey "botman" Broome wrote:

We can spawn entities, look them up, modify certain aspects, why the
hell can't we delete them?


You can.

Please can we have this *bug* fixed.  I see this as a setback to anyone
trying to create a mod.


What entities specifically can't you remove if you are creating your own
MOD?


Oh, this looks like I have got the wrong end of the stick :)

I am looking to be able to add or remove spawn points, and also remove
weapons from the CS.
Is this possible?

This is all new to me, and I am only part way through coding my first
plugin for metamod.  google searches and other peoples code have been
invaluable in finding most things I needed to know.  I have even
downloaded the archived hlcoders mailing list before posting, and my
interpretation of previous posts was that weapons could not be removed
from the game.
2 other questions I have :)

1) Is there a way to force a client to drop a weapon without issuing the
CLIENT_COMMAND(pEntity, "drop")?
2) Is there an easy way to see if a shield is being carried but not
deployed?  I have these 2 bits of code which hint on a solution, but I
am hoping that asking here will give me a better insight.
// Block Server-Crash exploit
if( pPlayer->v.sequence == 86 )
   // Block shield exploit
if( pPlayer->v.sequence == 98 )
Cheers,

Matt.

___
To unsubscribe, edit your list preferences, or view the list archives, please visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders


Re: [hlcoders] Removing entities

2004-04-29 Thread Jeffrey \"botman\" Broome
Matt Judge wrote:

I have seen a number of posts and articales on this, is there any chance
that you can enable people to remove entities without crashing the server?
Huh?  Are you talking about removing entities from the SDK (or from a
MOD)?  If it's MOD related, whether you can remove and entity or not
would depend on what the MOD used it for.  As an example, maps would be
completely useless if you remove the player spawn point entity from them.
We can spawn entities, look them up, modify certain aspects, why the
hell can't we delete them?
You can.

Please can we have this *bug* fixed.  I see this as a setback to anyone
trying to create a mod.
What entities specifically can't you remove if you are creating your own
MOD?
--
Jeffrey "botman" Broome
___
To unsubscribe, edit your list preferences, or view the list archives, please visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders


Re: [hlcoders] Re: [hlds_linux] Possible bug in STEAM + Metamod

2004-04-29 Thread Pavol Marko
Yes and it is called MetamodX (somewhere on http://www.amxmodx.org). Also, a
new metamod should come out within a few weeks...



___
To unsubscribe, edit your list preferences, or view the list archives, please visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders



RE: [hlcoders] Re: [hlds_linux] Possible bug in STEAM + Metamod

2004-04-29 Thread John Carr
AMX uses metamod so they made a fix for metamod so AMX works (i think?)

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of c0ldfyr3
Sent: 29 April 2004 18:02
To: [EMAIL PROTECTED]
Subject: Re: [hlcoders] Re: [hlds_linux] Possible bug in STEAM + Metamod


But this has nothing to do with AMX ..

- Original Message -
From: "Jeff 'Kuja' Katz" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, April 29, 2004 5:17 AM
Subject: RE: [hlcoders] Re: [hlds_linux] Possible bug in STEAM + Metamod


The amxx people have an updated metamod binary.

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Brian A.
Stumm
Sent: Wednesday, April 28, 2004 12:19 AM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: [hlcoders] Re: [hlds_linux] Possible bug in STEAM + Metamod


On Tue, 27 Apr 2004, Matt Judge wrote:

> Hi,
>
> I am sorry if this is on the wrong list but I am not subscribed to any

> other Valve lists, and I am pretty much a noob when it comes to coding

> mods for HL.
>
> I am in the process of converting my AMX code to work directly with
> metamod, thereby cutting out the middle man and saving me some
> precious CPU cycles.
>
> In the process of working out how things piece together I have lots of

> print statements scattered about my code.  During my tests, I have
> noted that if you buy armour, throw a grenade at yourself, the system
> sends a gmsgBattery message, then continues to send them at a rate of
> 20+ per second until the next round starts or you buy more armour.
>
> I don't know whether this is a bug with metatmod 1.17 or STEAM.  To
> check it is not something introduced by my code, I have even used the
> basic stub which is provided with metamod, and this flood of messages
> is still apparrent.
>
> I have yet to see if this problem would be solved in a multiplayer
> environment as my code is not yet ready.

Need to amend that email, the messages continue round after round until
you die or buy more armour.

>
> Cheers,
>
> Matt.
>

HLCoders is the place to ask... Crossposted...

On a side note, the metamod 1.17 binary and source on metamod.org is not
fully steam compatible. Alfred posted info to the hlcoders mailing list
about some changes. One can research hlcoders and other valve mailing
lists archives at
http://www.mail-archive.com/[EMAIL PROTECTED]/mail5.html#0
1224

HTH


___
To unsubscribe, edit your list preferences, or view the list archives,
please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders


___
To unsubscribe, edit your list preferences, or view the list archives,
please visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders





___
To unsubscribe, edit your list preferences, or view the list archives,
please visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders



___
To unsubscribe, edit your list preferences, or view the list archives, please visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders



[hlcoders] Removing entities

2004-04-29 Thread Matt Judge
I have seen a number of posts and articales on this, is there any chance
that you can enable people to remove entities without crashing the server?
We can spawn entities, look them up, modify certain aspects, why the
hell can't we delete them?
Please can we have this *bug* fixed.  I see this as a setback to anyone
trying to create a mod.
My 2 pennies worth,

Matt.

___
To unsubscribe, edit your list preferences, or view the list archives, please visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders


Re: [hlcoders] Re: [hlds_linux] Possible bug in STEAM + Metamod

2004-04-29 Thread c0ldfyr3
But this has nothing to do with AMX ..

- Original Message -
From: "Jeff 'Kuja' Katz" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, April 29, 2004 5:17 AM
Subject: RE: [hlcoders] Re: [hlds_linux] Possible bug in STEAM + Metamod


The amxx people have an updated metamod binary.

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Brian A.
Stumm
Sent: Wednesday, April 28, 2004 12:19 AM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: [hlcoders] Re: [hlds_linux] Possible bug in STEAM + Metamod


On Tue, 27 Apr 2004, Matt Judge wrote:

> Hi,
>
> I am sorry if this is on the wrong list but I am not subscribed to any

> other Valve lists, and I am pretty much a noob when it comes to coding

> mods for HL.
>
> I am in the process of converting my AMX code to work directly with
> metamod, thereby cutting out the middle man and saving me some
> precious CPU cycles.
>
> In the process of working out how things piece together I have lots of

> print statements scattered about my code.  During my tests, I have
> noted that if you buy armour, throw a grenade at yourself, the system
> sends a gmsgBattery message, then continues to send them at a rate of
> 20+ per second until the next round starts or you buy more armour.
>
> I don't know whether this is a bug with metatmod 1.17 or STEAM.  To
> check it is not something introduced by my code, I have even used the
> basic stub which is provided with metamod, and this flood of messages
> is still apparrent.
>
> I have yet to see if this problem would be solved in a multiplayer
> environment as my code is not yet ready.

Need to amend that email, the messages continue round after round until
you die or buy more armour.

>
> Cheers,
>
> Matt.
>

HLCoders is the place to ask... Crossposted...

On a side note, the metamod 1.17 binary and source on metamod.org is not
fully steam compatible. Alfred posted info to the hlcoders mailing list
about some changes. One can research hlcoders and other valve mailing
lists archives at
http://www.mail-archive.com/[EMAIL PROTECTED]/mail5.html#0
1224

HTH


___
To unsubscribe, edit your list preferences, or view the list archives,
please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders


___
To unsubscribe, edit your list preferences, or view the list archives,
please visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders





___
To unsubscribe, edit your list preferences, or view the list archives, please visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders