Raised This Month: $ Target: $400
 0% 

Removing entity on player disconnect.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
KiLLeR.
Senior Member
Join Date: Jul 2014
Location: Bulgaria
Old 12-06-2014 , 09:06   Removing entity on player disconnect.
Reply With Quote #1

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?

Last edited by KiLLeR.; 12-13-2014 at 12:05.
KiLLeR. is offline
RateX
Veteran Member
Join Date: Jun 2012
Location: 0o. SEA .o0
Old 12-06-2014 , 09:15   Re: Removing entity on player disconnect.
Reply With Quote #2

Did you test it?
BTW, instead of calling native twice, cache the result.
RateX is offline
KiLLeR.
Senior Member
Join Date: Jul 2014
Location: Bulgaria
Old 12-06-2014 , 09:31   Re: Removing entity on player disconnect.
Reply With Quote #3

Yes, I test it and working, but sometime i see error in the server console that shows code in first post.
KiLLeR. is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 12-06-2014 , 09:39   Re: Removing entity on player disconnect.
Reply With Quote #4

What is the error?
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
KiLLeR.
Senior Member
Join Date: Jul 2014
Location: Bulgaria
Old 12-06-2014 , 13:53   Re: Removing entity on player disconnect.
Reply With Quote #5

Quote:
Originally Posted by YamiKaitou View Post
What is the error?
If i still see the error, will copy here.

Last edited by KiLLeR.; 12-06-2014 at 13:56.
KiLLeR. is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 12-06-2014 , 09:42   Re: Removing entity on player disconnect.
Reply With Quote #6

Check if the ent is valid before removing it.
__________________
HamletEagle is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 12-06-2014 , 14:47   Re: Removing entity on player disconnect.
Reply With Quote #7

Quote:
Originally Posted by HamletEagle View Post
Check if the ent is valid before removing it.
__________________
HamletEagle is offline
KiLLeR.
Senior Member
Join Date: Jul 2014
Location: Bulgaria
Old 12-07-2014 , 13:33   Re: Removing entity on player disconnect.
Reply With Quote #8

Quote:
Originally Posted by HamletEagle View Post
Check if the ent is valid before removing it.
I have check when removing an entity.

Last edited by KiLLeR.; 12-07-2014 at 13:36.
KiLLeR. is offline
baneado
Veteran Member
Join Date: Dec 2012
Location: amxmodx-es.com
Old 12-07-2014 , 19:09   Re: Removing entity on player disconnect.
Reply With Quote #9

see my thread please:
https://forums.alliedmods.net/showthread.php?t=246902
baneado is offline
KiLLeR.
Senior Member
Join Date: Jul 2014
Location: Bulgaria
Old 12-13-2014 , 12:21   Re: Removing entity on player disconnect.
Reply With Quote #10

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.

Last edited by KiLLeR.; 12-13-2014 at 12:21.
KiLLeR. 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 15:18.


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