Raised This Month: $32 Target: $400
 8% 

[CSGO] Simple bullet damage


Post New Thread Reply   
 
Thread Tools Display Modes
Gabrielel
New Member
Join Date: Aug 2019
Old 08-08-2019 , 05:46   Re: [CSGO] Simple bullet damage
Reply With Quote #11

Quote:
Originally Posted by m22b View Post
Code:
L 07/18/2019 - 02:34:44: SourceMod error session started
L 07/18/2019 - 02:34:44: Info (map "de_dust2") (file "errors_20190718.log")
L 07/18/2019 - 02:34:44: [SM] Exception reported: Invalid client index 0
L 07/18/2019 - 02:34:44: [SM] Blaming: dpt_bulletdamage.smx
L 07/18/2019 - 02:34:44: [SM] Call stack trace:
L 07/18/2019 - 02:34:44: [SM]   [0] ShowHudText
L 07/18/2019 - 02:34:44: [SM]   [1] Line 30, C:\Users\Ahmed\Desktop\spedit1.2.0.3\sourcepawn\scripts\dpt_bulletdamage.sp::Event_PlayerHurt
Same error for me.
Running on a public dedicated linux server.
Gabrielel is offline
BHaType
Great Tester of Whatever
Join Date: Jun 2018
Old 08-08-2019 , 05:54   Re: [CSGO] Simple bullet damage
Reply With Quote #12

Quote:
Originally Posted by DPT View Post
This is the source of the problem. This plugin will not work properly with listen servers.
lol
No matter what server, it's a problem with your code

Just add a check on the validity of the player
Attached Files
File Type: sp Get Plugin or Get Source (dpt_bulletdamage.sp - 296 views - 746 Bytes)
__________________
cry

Last edited by BHaType; 08-08-2019 at 06:04.
BHaType is offline
Send a message via AIM to BHaType
eyal282
Veteran Member
Join Date: Aug 2011
Old 08-09-2019 , 06:47   Re: [CSGO] Simple bullet damage
Reply With Quote #13

Just add if(attacker == 0) return; to stop all possible errors that obviously don't relate to listen servers but instead when a player is damaged by a trigger_hurt or something similar that isn't human.
__________________
I am available to make plugins for pay.

Discord: Eyal282#1334
eyal282 is offline
eyal282
Veteran Member
Join Date: Aug 2011
Old 08-09-2019 , 06:49   Re: [CSGO] Simple bullet damage
Reply With Quote #14

Quote:
Originally Posted by BHaType View Post
lol
No matter what server, it's a problem with your code

Just add a check on the validity of the player

int attacker = GetClientOfUserId(event.GetInt("attacker"));

https://sm.alliedmods.net/new-api/cl...ClientOfUserId

Errors: returns a random integer that equals to 0 or to MaxClients+1 and above when the user id is invalid and absolutely DOESN'T just return 0 when the user id is invalid, which is why you don't just check if it equals to 0.
__________________
I am available to make plugins for pay.

Discord: Eyal282#1334
eyal282 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 08:49.


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