Raised This Month: $ Target: $400
 0% 

Player out of range (0)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
GhostMan
Senior Member
Join Date: Jun 2012
Old 08-19-2013 , 16:11   Player out of range (0)
Reply With Quote #1

Quote:
L 08/18/2013 - 22:22:01: [CSTRIKE] Player out of range (0)
L 08/18/2013 - 22:22:01: [AMXX] Displaying debug trace (plugin "jb_days_box_open.amxx")
L 08/18/2013 - 22:22:01: [AMXX] Run time error 10: native error (native "cs_get_user_team")
L 08/18/2013 - 22:22:01: [AMXX] [0] jb_days_box_open.sma::fw_player_killed (line 286)
PHP Code:
public fw_player_killed(victimkillershouldgib)
{            
    switch(
g_SpecDay)
    {
        case 
8:
        {
            new 
CsTeams:vteam cs_get_user_team(victim)
            new 
CsTeams:kteam cs_get_user_team(killer)
            
            if(
IsPlayer(killer) && victim != killer && is_user_alive(killer) && vteam != kteam && kteam == CS_TEAM_T && vteam == CS_TEAM_CT)
            {
                if(
get_user_health(killer) < 200)
                {
                    
set_user_health(killermin(get_user_health(killer) + 50200))
                    
client_print_color(killerkiller"%s You got ^3+50 HP ^1for killing an opponent"PREFIX)
                }
                else
                {
                    
client_print_color(killerkiller"%s You already have ^3200 HP^1, that is the maximum amount."PREFIX)
                }
            }
        }
    }

286 line is this one
PHP Code:
            new CsTeams:kteam cs_get_user_team(killer

Last edited by GhostMan; 08-19-2013 at 16:12.
GhostMan is offline
Black Rose
Veteran Member
Join Date: Feb 2011
Location: Stockholm, Sweden
Old 08-19-2013 , 16:19   Re: Player out of range (0)
Reply With Quote #2

if ( ! is_user_connected(killer) || ! is_user_connected(victim) )
return;
__________________
Black Rose is offline
simanovich
AlliedModders Donor
Join Date: Jun 2012
Location: Israel
Old 08-19-2013 , 17:07   Re: Player out of range (0)
Reply With Quote #3

The killer is the world (index = 0) (trigger_hurt, fall, etc.)
__________________

Last edited by simanovich; 08-19-2013 at 17:08.
simanovich is offline
GhostMan
Senior Member
Join Date: Jun 2012
Old 08-19-2013 , 17:26   Re: Player out of range (0)
Reply With Quote #4

Quote:
Originally Posted by simanovich View Post
The killer is the world (index = 0) (trigger_hurt, fall, etc.)
I'v though i have IsPlayer part for that but apparently it's incorrect.

Now it is
PHP Code:
#define IsPlayer(%0)    (1 <= (%0) <= g_iMaxPlayers) 
Should it be
PHP Code:
#define IsPlayer(%1)    (1 <= (%1) <= g_iMaxPlayers) 
or something?

By the way, that does that %0 (or %1) part means?
GhostMan is offline
^SmileY
Veteran Member
Join Date: Jan 2010
Location: Brazil [<o>]
Old 08-19-2013 , 19:52   Re: Player out of range (0)
Reply With Quote #5

anyway its the same, youre registred g_iMaxPlayers in plugin_init?
__________________
Projects:

- See my Git Hub: https://github.com/SmileYzn
PHP Code:
set_pcvar_num(pCvar, !get_pcvar_num(pCvar)); 
^SmileY is offline
Send a message via MSN to ^SmileY Send a message via Skype™ to ^SmileY
Black Rose
Veteran Member
Join Date: Feb 2011
Location: Stockholm, Sweden
Old 08-20-2013 , 00:07   Player out of range (0)
Reply With Quote #6

The define is correct but you're calling it too late. It has to be before cs_get_user_team().
__________________

Last edited by Black Rose; 08-20-2013 at 12:19.
Black Rose is offline
yokomo
Surprise Ascot!
Join Date: May 2010
Location: Malaysia
Old 08-20-2013 , 04:01   Re: Player out of range (0)
Reply With Quote #7

No need to use IsPlayer just use is_user_alive(killer):

PHP Code:
public fw_player_killed(victimkillershouldgib)
{
    if(!
is_user_alive(killer)) return; //User die, so no ++ hp for him.
    
    //Do your next code

__________________
Team-MMG CS1.6 Servers:
✅ MultiMod -- 103.179.44.152:27016
✅ Zombie Plague -- 103.179.44.152:27015
✅ Zombie Escape -- 103.179.44.152:27017
✅ Klassik Kombat -- 103.179.44.152:27018
✅ Boss-Battle -- 103.179.44.152:27019

Last edited by yokomo; 08-20-2013 at 04:04. Reason: Remove IsPlayer(id)
yokomo 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:49.


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