Raised This Month: $ Target: $400
 0% 

SuperHero Tracker Invalid player id 0 problem


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
gameplayonline
Member
Join Date: Jun 2017
Old 07-01-2018 , 10:30   SuperHero Tracker Invalid player id 0 problem
Reply With Quote #1

Hello i have this code:
Code:
public tracker_damage(id)
{
  new victim
  victim = id
  new attacker
  if (get_user_attacker(victim) > 0)  
	attacker = get_user_attacker(victim)
  else
	return PLUGIN_CONTINUE
  
  new maxTargets = get_cvar_num("tracker_maxtargets")
  
  if(maxTargets == 0)
    maxTargets = 33
    
  if ( attacker <= 0 || attacker > 33 || victim <= 0 || victim > 33) 
        return PLUGIN_CONTINUE  

  if (victim==0) 
        return PLUGIN_CONTINUE  
  
  if(attacker > 0 && attacker <= 33 && victim > 0 && victim <= 33 && hasTrackerPowers[attacker] && attacker!=victim && get_user_team(attacker)!=get_user_team(victim) && numTargets[attacker]<maxTargets)
  {
    isTagged[attacker][victim] = true
    numTargets[attacker] = numTargets[attacker]++
    timeLeft[attacker][victim] = get_cvar_float("tracker_timetargeted")
    if(timeLeft[attacker][victim]==0.0)
      timeLeft[attacker][victim] = -1.0
  }
  else
	return PLUGIN_CONTINUE  
	
  return PLUGIN_CONTINUE
}
My problem is this error in error log:
Code:
L 07/01/2018 - 12:02:16: Invalid player id 0
L 07/01/2018 - 12:02:16: [AMXX] Displaying debug trace (plugin "sh_tracker.amxx")
L 07/01/2018 - 12:02:16: [AMXX] Run time error 10: native error (native "get_user_attacker")
L 07/01/2018 - 12:02:16: [AMXX]    [0] sh_tracker.sma::tracker_damage (line 105)
L 07/01/2018 - 12:04:12: Invalid player id 0
I tried fix it but still im not able to fix. Can somebody help me please?
gameplayonline is offline
maqi
Senior Member
Join Date: Apr 2017
Location: Serbia
Old 07-01-2018 , 10:35   Re: SuperHero Tracker Invalid player id 0 problem
Reply With Quote #2

Simply check if victim is 1 to max clients and/or is_user_connected()
__________________
stuff
maqi is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 07-01-2018 , 14:40   Re: SuperHero Tracker Invalid player id 0 problem
Reply With Quote #3

Just is_user_connected() is required here.
__________________
fysiks is offline
gameplayonline
Member
Join Date: Jun 2017
Old 07-01-2018 , 16:43   Re: SuperHero Tracker Invalid player id 0 problem
Reply With Quote #4

Thanks
gameplayonline 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 12:24.


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