Raised This Month: $ Target: $400
 0% 

[CSTRIKE] Player out of RANGE (0)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
deprale
Senior Member
Join Date: Oct 2018
Location: Leeds
Old 01-04-2019 , 13:57   [CSTRIKE] Player out of RANGE (0)
Reply With Quote #1

What it is supposed to do: Basically it has to check every 5 seconds if someone joined a team and hasn't respawned yet. It's a small add-on for my pug plugin, basically respawn in warmup

PHP Code:
public client_connectid )
{
    
g_iFragsid ] = 0;
    
set_task(2.0"checkname"id);
    if(
mixon==0)
    {
        
set_task(1.0"warmup"___"b" );
        
set_task(5.0"checkdead"___"b"id);
    }
}

public 
checkdead(id)
{
    if(!
is_user_alive(id) && (cs_get_user_team(id) == CS_TEAM_CT || CS_TEAM_T) && mixon==0)
    {
    
set_task(0.5"respawn"id);
    }
    else if(!
is_user_alive(id) && (cs_get_user_team(id) == CS_TEAM_SPECTATOR))
    return 
HAM_IGNORED;
    else if(!
is_user_alive(id) && (cs_get_user_team(id) == CS_TEAM_UNASSIGNED))
    {
        return 
HAM_IGNORED;
    }
    return 
PLUGIN_CONTINUE;

Error code:
PHP Code:
L 01/04/2019 21:18:19: [CSTRIKEPlayer out of range (0)
L 01/04/2019 21:18:19: [AMXXRun time error 10 (plugin "evils-mix.amxx") (native "cs_get_user_team") - debug not enabled!
L 01/04/2019 21:18:19: [AMXXTo enable debug modeadd "debug" after the plugin name in plugins.ini (without quotes).
L 01/04/2019 21:18:24: [CSTRIKEPlayer out of range (0)
L 01/04/2019 21:18:24: [AMXXRun time error 10 (plugin "evils-mix.amxx") (native "cs_get_user_team") - debug not enabled!
L 01/04/2019 21:18:24: [AMXXTo enable debug modeadd "debug" after the plugin name in plugins.ini (without quotes).
L 01/04/2019 21:18:29: [CSTRIKEPlayer out of range (0)
L 01/04/2019 21:18:29: [AMXXRun time error 10 (plugin "evils-mix.amxx") (native "cs_get_user_team") - debug not enabled!
L 01/04/2019 21:18:29: [AMXXTo enable debug modeadd "debug" after the plugin name in plugins.ini (without quotes).
L 01/04/2019 21:18:34: [CSTRIKEPlayer out of range (0)
L 01/04/2019 21:18:34: [AMXXRun time error 10 (plugin "evils-mix.amxx") (native "cs_get_user_team") - debug not enabled!
L 01/04/2019 21:18:34: [AMXXTo enable debug modeadd "debug" after the plugin name in plugins.ini (without quotes).
L 01/04/2019 21:18:39: [CSTRIKEPlayer out of range (0)
L 01/04/2019 21:18:39: [AMXXRun time error 10 (plugin "evils-mix.amxx") (native "cs_get_user_team") - debug not enabled!
L 01/04/2019 21:18:39: [AMXXTo enable debug modeadd "debug" after the plugin name in plugins.ini (without quotes). 
It was working fine before I changed something... Don't know exactly what tbh.

Any help is appreciated, thanks!


EDIT: Nevermind I'm so god damn dumb, I even looked like an ape at this : https://www.amxmodx.org/api/amxmodx/set_task for about a solid 20 minutes and I completely ignored where the "id" should stand. Never make the same mistake, the issue was in
PHP Code:
set_task(5.0"checkdead"___"b"id); 
shoulda been
PHP Code:
set_task(5.0"checkdead"id__"b"); 
God DAMN! FACEPALM! Lesson learned

Last edited by deprale; 01-04-2019 at 14:32.
deprale is offline
Ghosted
Veteran Member
Join Date: Apr 2015
Location: Georgia
Old 01-04-2019 , 14:03   Re: [CSTRIKE] Player out of RANGE (0)
Reply With Quote #2

1. Maybe player left game before task was executed?
So you should use is_user_connected in checkdead
2. Use putinserver and not connect

Code:
public checkdead(id)
{
if(!is_user_connected(id) || is_user_alive(id))
return;

new Team = cs_get_user_team(id);

if (Team < 1 || Team > 2)
return;

/// Player is ready for spawning, your code here
}

EDIT (2): in set_task you should pass playerIndex (id) as task id, if you need infinity in set_task then you should use remove_task(id) in client disconnect/disconnected forward
__________________

[MOD] CS Weapon Mod V1.7.1
[MM] MetaMod-C V1.0
[MOD] CS NPC Mod (5%)


Probably Left AM

Last edited by Ghosted; 01-04-2019 at 14:14.
Ghosted is offline
deprale
Senior Member
Join Date: Oct 2018
Location: Leeds
Old 01-04-2019 , 14:09   Re: [CSTRIKE] Player out of RANGE (0)
Reply With Quote #3

The problem is that the code worked fine before, but as soon as I set the task as an infinite loop ("b") flag the players just don't get respawned and they get kicked

Also: Added the check if player has disconnected.


EDIT: Nevermind I'm so god damn dumb, I even looked like an ape at this : https://www.amxmodx.org/api/amxmodx/set_task for about a solid 20 minutes and I completely ignored where the "id" should stand.
God DAMN! FACEPALM!

Fixed,Thanks Ghosted for your suggestion, I did indeed add the check if player has disconnected!

Last edited by deprale; 01-04-2019 at 14:13.
deprale is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 01-05-2019 , 08:36   Re: [CSTRIKE] Player out of RANGE (0)
Reply With Quote #4

PHP Code:
(cs_get_user_team(id) == CS_TEAM_CT || CS_TEAM_T
This is incorrect as well. You can't check more than one statement like that. It needs to be:

PHP Code:
(cs_get_user_team(id) == CS_TEAM_CT || cs_get_user_team(id) == CS_TEAM_T
You should also store the "cs_get_user_team(id)" value in a variable because you will be using it more than once.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 01-05-2019 , 09:59   Re: [CSTRIKE] Player out of RANGE (0)
Reply With Quote #5

Quote:
Originally Posted by OciXCrom View Post
PHP Code:
(cs_get_user_team(id) == CS_TEAM_CT || CS_TEAM_T
This is incorrect as well. You can't check more than one statement like that. It needs to be:

PHP Code:
(cs_get_user_team(id) == CS_TEAM_CT || cs_get_user_team(id) == CS_TEAM_T
You should also store the "cs_get_user_team(id)" value in a variable because you will be using it more than once.
You can do:
PHP Code:
if ( CS_TEAM_T <= cs_get_user_teamid ) <= CS_TEAM_CT )
{
    
//T or CT
}
else
{
    
//unassigned or spectator

__________________

Last edited by Bugsy; 01-05-2019 at 10:02.
Bugsy is offline
Reply


Thread Tools
Display Modes

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 19:28.


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