RE: [hlcoders] Removing entities

2004-04-30 Thread Deadman Standing
1] You cannot add new spawns dynamically to CS 1.6 anymore.
2] You cannot remove spawns dynamically from CS 1.6 anymore.

Double check how you were creating entities as CREATE_NAMED_ENTITY() and
REMOVE_ENTITY() work fine in CS 1.6.



___
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-30 Thread David Anderson
No, they don't.  As has been stated before, they are cached internally.
When I delete or add spawns, I get spawned at 0,0,0 and then the game
crashes.  You can CREATE_NAMED_ENTITY() just about anything but a spawn
point, and you can REMOVE_ENTITY() only things you created with
CREATE_NAMED_ENTITY().  This may have changed since I first found this out
(mid February), but try it yourself...

 -David BAILOPAN Anderson

On Fri, 30 Apr 2004, Deadman Standing wrote:

 1] You cannot add new spawns dynamically to CS 1.6 anymore.
 2] You cannot remove spawns dynamically from CS 1.6 anymore.

 Double check how you were creating entities as CREATE_NAMED_ENTITY() and
 REMOVE_ENTITY() work fine in CS 1.6.



 ___
 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-30 Thread Matt Judge
Help!

(I have never coded for 1.5, but I am beginning to wish I had.  Are they
going to make it this hard for us to do stuff in HL2?)
The DeleteCSWeapon is not working for me.

DeleteCSWeapon(models/w_awp.mdl,weapon_awp,index);

Am I using this wrong?

If I call this function when the player is carrying an AWP and there is
also an AWP on the floor, the server crashes.
Here is my code (I added your solidstate stuff to it):

void GiveNamedItem(edict_t *pEdict, const char *pszName)
{
   if(strncmp(pszName,weapon_,7) == 0||
strncmp(pszName,item_,5) == 0|| strncmp(pszName,ammo_,5) == 0)
   {
   edict_t *pent;
   int istr = MAKE_STRING(pszName);
   pent = CREATE_NAMED_ENTITY(istr);
   if(FNullEnt(pent))
   {
   ALERT(at_console, NULL Ent in GiveNamedItem!\n);
   return;
   }
   VARS(pent)-origin = VARS(pEdict)-origin;
   pent-v.spawnflags |= SF_NORESPAWN;
   (*gpGamedllFuncs-dllapi_table-pfnSpawn)(pent);
   int solidstate = pent-v.solid;
   (*gpGamedllFuncs-dllapi_table-pfnTouch)(pent, pEdict);
   if(pent-v.solid == solidstate)
   REMOVE_ENTITY(pent);
   }
}
And your code copied as is (pretty much).
void DeleteWeapon(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);
   UTIL_LogPrintf(DeleteWeapon: %s\n,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
}


___
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-30 Thread Deadman Standing
Aw by spawn you mean creating the entities: info_player_deathmatch,
info_player_start, or info_vip_start, if I understand you correctly?
Never tried those. I know removing any of the entities that originate in
a map is problematic. I can say I have never had issues adding or
removing the entities: info_target, func_wall, or trigger_auto as I use
them all the time. If I get some spare time I'll try playing with the
spawn entities.


No, they don't.  As has been stated before, they are cached
internally.
When I delete or add spawns, I get spawned at 0,0,0 and then the game
crashes.  You can CREATE_NAMED_ENTITY() just about anything but a
spawn
point, and you can REMOVE_ENTITY() only things you created with
CREATE_NAMED_ENTITY().  This may have changed since I first found this
out
(mid February), but try it yourself...




___
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-30 Thread Matt
along the same lines.. i made a mod that worked for 1.5 that gave every
player all weapons, now in 1.6 it get to 4/5 and crashes, the code im using
is:

  for (int i=0;iMAX_CWEAPONS;i++)
  {
   edict_t *r = CREATE_NAMED_ENTITY(MAKE_STRING(cWeapons[i]));
   r-v.spawnflags |= SF_NORESPAWN;
   r-v.origin = a-v.origin + Vector(1,1,1);
   pEntity = (CBaseEntity *)GET_PRIVATE(r);
   if (pEntity)
   {
pEntity-pev-absmin = pEntity-pev-origin - Vector(1,1,1);
pEntity-pev-absmax = pEntity-pev-origin + Vector(1,1,1);
pEntity-Spawn();
  }
  }

anyone have any ideas why it crashes?


___
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-30 Thread Deadman Standing
I just did a test of creating an info_player_deathmatch entity
(Terrorist spawn point in CS) and had no server crash. I was also able
to remove the spawn point without a crash. I can not guarantee that hlds
actually would use the spawn point since I have no easy way of testing
that functionality.

I looked back in the emails and found your original question David
posted on 2/15/2004 about your deathmatch mod. My geuss your problem
steamed from:

 I have tried blocking REMOVE_ENTITY calls from the CS Engine, and that
sort of works... not.  CS is still making illegal calls (and apparently,
doesn't check to see if they're valid or not).

The basic rule seems to be create it through api calls, free it through
api calls. Don't tamper with its free mechanism or pointers will get
unhappy :)

I can see blocking the REMOVE_ENTITY call as a procedure that would get
the cache out of sync.

Hope this helps.

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of David
Anderson
Sent: Friday, April 30, 2004 12:01 PM
To: [EMAIL PROTECTED]
Subject: RE: [hlcoders] Removing entities

No, they don't.  As has been stated before, they are cached internally.
When I delete or add spawns, I get spawned at 0,0,0 and then the game
crashes.  You can CREATE_NAMED_ENTITY() just about anything but a spawn
point, and you can REMOVE_ENTITY() only things you created with
CREATE_NAMED_ENTITY().  This may have changed since I first found this
out
(mid February), but try it yourself...

 -David BAILOPAN Anderson

On Fri, 30 Apr 2004, Deadman Standing wrote:

 1] You cannot add new spawns dynamically to CS 1.6 anymore.
 2] You cannot remove spawns dynamically from CS 1.6 anymore.

 Double check how you were creating entities as CREATE_NAMED_ENTITY()
and
 REMOVE_ENTITY() work fine in CS 1.6.



 ___
 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



RE: [hlcoders] Removing entities

2004-04-30 Thread Deadman Standing
You are referencing CBaseEntity. Since we do not have the schema they
use for that class is CS you would get crashes.

It appears the class schema differs between the SDK and Counter-Strike.
Methods or attributes were probability added to the classes.

Bottom line is you can only access edict_t data types and can use none
of the SDK class hierarchy.

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Matt
Sent: Friday, April 30, 2004 4:18 PM
To: [EMAIL PROTECTED]
Subject: Re: [hlcoders] Removing entities

along the same lines.. i made a mod that worked for 1.5 that gave every
player all weapons, now in 1.6 it get to 4/5 and crashes, the code im
using
is:

  for (int i=0;iMAX_CWEAPONS;i++)
  {
   edict_t *r = CREATE_NAMED_ENTITY(MAKE_STRING(cWeapons[i]));
   r-v.spawnflags |= SF_NORESPAWN;
   r-v.origin = a-v.origin + Vector(1,1,1);
   pEntity = (CBaseEntity *)GET_PRIVATE(r);
   if (pEntity)
   {
pEntity-pev-absmin = pEntity-pev-origin - Vector(1,1,1);
pEntity-pev-absmax = pEntity-pev-origin + Vector(1,1,1);
pEntity-Spawn();
  }
  }

anyone have any ideas why it crashes?


___
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