Raised This Month: $51 Target: $400
 12% 

DeathMsg error


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
karaulov
Senior Member
Join Date: Jul 2018
Old 11-08-2020 , 13:30   DeathMsg error
Reply With Quote #1

Code:
	register_event("DeathMsg","EVENT_Death", "a", "1>0");
Code:
public EVENT_Death()
{
	//log_message("EVENT_Death")
	static killer_id, victim_id;
	killer_id = read_data(1);
	victim_id = read_data(2); 
	
}
I got sometimes victim_id > 33, why?

AMX MODX 1.10 latest build
karaulov is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 11-08-2020 , 13:47   Re: DeathMsg error
Reply With Quote #2

Please show the full code with logs included.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
karaulov
Senior Member
Join Date: Jul 2018
Old 11-08-2020 , 22:24   Re: DeathMsg error
Reply With Quote #3

Quote:
Originally Posted by OciXCrom View Post
Please show the full code with logs included.
Plugin not for public (For one my server)
I sent my plugin in PM.
But I add here && victim_id >= 0 && victim_id < 33 in 154 line.


I Use AMX MOD X 1.10 latest build.
Code:
public EVENT_Death()
{
	//log_message("EVENT_Death")
	static killer_id, victim_id;
	killer_id = read_data(1);
	victim_id = read_data(2); 
	
}
Run time error 4: index out of bounds

g_PlayerData[victim_id]

Last edited by karaulov; 11-08-2020 at 22:50.
karaulov is offline
Shadows Adi
AlliedModders Donor
Join Date: Aug 2019
Location: Romania
Old 11-09-2020 , 00:57   Re: DeathMsg error
Reply With Quote #4

You should always check if the entity is in range
PHP Code:
if ( !(<= victim_id <= 32) || !(<= killer_id<= 32) ) return PLUGIN_HANDLED 
__________________


Accepting Paid Requests, contact PM.

MVP Of The Round View project on GITHUB / AlliedModders
CSGO REMAKE ~ CSGO MOD [STABLE + SOURCE CODE]
Shadows Adi is offline
karaulov
Senior Member
Join Date: Jul 2018
Old 11-09-2020 , 03:27   Re: DeathMsg error
Reply With Quote #5

But who can be dead instead of the player??

Last edited by karaulov; 11-09-2020 at 03:28.
karaulov is offline
Celena Luna
Veteran Member
Join Date: Aug 2013
Location: Nagazora
Old 11-09-2020 , 03:38   Re: DeathMsg error
Reply With Quote #6

Quote:
Originally Posted by karaulov View Post
But who can be dead instead of the player??
You can try to get the it class and find out what is it.
Who know? It happen all the time. And if it is not what we need, ignore it.
usually, if you just want player, check is_user_connected to bypass that out of bound error.
__________________
My plugin:

Last edited by Celena Luna; 11-09-2020 at 03:40.
Celena Luna 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 10:45.


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