AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Removing entity on player disconnect. (https://forums.alliedmods.net/showthread.php?t=252619)

KiLLeR. 12-06-2014 09:06

Removing entity on player disconnect.
 
When a player disconnect from the server, I use this code for abolishing its entities.
PHP Code:

public client_disconnect(id)
{    
    if(
is_valid_ent(find_ent_by_owner(-1"info_mine"id)))
    {
        
remove_entity(find_ent_by_owner(-1"info_mine"id));
    }


That is correct way?

RateX 12-06-2014 09:15

Re: Removing entity on player disconnect.
 
Did you test it?
BTW, instead of calling native twice, cache the result.:)

KiLLeR. 12-06-2014 09:31

Re: Removing entity on player disconnect.
 
Yes, I test it and working, but sometime i see error in the server console that shows code in first post.

YamiKaitou 12-06-2014 09:39

Re: Removing entity on player disconnect.
 
What is the error?

HamletEagle 12-06-2014 09:42

Re: Removing entity on player disconnect.
 
Check if the ent is valid before removing it.

KiLLeR. 12-06-2014 13:53

Re: Removing entity on player disconnect.
 
Quote:

Originally Posted by YamiKaitou (Post 2231794)
What is the error?

If i still see the error, will copy here.

HamletEagle 12-06-2014 14:47

Re: Removing entity on player disconnect.
 
Quote:

Originally Posted by HamletEagle (Post 2231797)
Check if the ent is valid before removing it.


KiLLeR. 12-07-2014 13:33

Re: Removing entity on player disconnect.
 
Quote:

Originally Posted by HamletEagle (Post 2231797)
Check if the ent is valid before removing it.

I have check when removing an entity.

baneado 12-07-2014 19:09

Re: Removing entity on player disconnect.
 
see my thread please:
https://forums.alliedmods.net/showthread.php?t=246902

KiLLeR. 12-13-2014 12:21

Re: Removing entity on player disconnect.
 
The error is:
Code:

L 12/13/2014 - 18:59:18: [ENGINE] Invalid entity 112
L 12/13/2014 - 18:59:18: [AMXX] Displaying debug trace (plugin "toxic_bomb.amxx")
L 12/13/2014 - 18:59:18: [AMXX] Run time error 10: native error (native "entity_get_int")
L 12/13/2014 - 18:59:18: [AMXX]    [0] toxic_bomb.sma::toxic_think (line 154)

I get this error when player is killed from thinking entity.


All times are GMT -4. The time now is 15:18.

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