It still Seg Faults. I threw this in before the strcpy(targetname.....:
if(target->pev->netname == NULL)
    continue;
But I still seg fault.
----- Original Message -----
From: "botman" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, September 08, 2003 1:40 PM
Subject: Re: [hlcoders] Seg Fault


> > I'm trying to create a function in which users will be able to exchange
> "Money." They can do this through a command, with this syntax: givemoney
> <part of targetname> <ammount>
> >
> <snip>
> >
> > If you could find a solution, i'd appreciate it.
> > --
>
> In this code...
>
>   while( ((target = (CBasePlayer *)UTIL_FindEntityByClassname(target,
> "player")) != NULL) && !FNullEnt(target->edict())){
>    CLIENT_PRINTF(pEntity,print_console,UTIL_VarArgs("Ok"));
>    strcpy(targetname,STRING(target->pev->netname));
>    buffer = strcasestr(targetname,arg1);
>
> ...target->edict() can be non-null, but target>-pev->netname can be NULL.
>
> The engine will reuse player slots after they have been allocated and the
> player has left the server.  The edict pointer will still be valid
(pointing
> to an unused player slot) but the name will be null.  You should test for
a
> null netname as well as a null edict pointer.
>
> Jeffrey "botman" Broome
>
>
> _______________________________________________
> 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

Reply via email to