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

Problem w/ speed timer


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
NWayne
Junior Member
Join Date: Aug 2017
Location: Warsaw, Europe
Old 08-27-2017 , 15:00   Problem w/ speed timer
Reply With Quote #1

Hello Guys,

I've got problem w/ my speed timer. Please help me fix it

Logs:
Code:
L 08/27/2017 - 19:59:32: [SM] Exception reported: Client index 0 is invalid
L 08/27/2017 - 19:59:32: [SM] Blaming: nwayne_hud.smx
L 08/27/2017 - 19:59:32: [SM] Call stack trace:
L 08/27/2017 - 19:59:32: [SM]   [0] IsClientInGame
L 08/27/2017 - 19:59:32: [SM]   [1] Line 17, C:\Users\KORDIAN\Desktop\Do Kompilacji\nwayne_hud.sp::showHUD
My .sp file
Code:
#include <sourcemod>
#include <cstrike>
#include <sdkhooks>
 
float fSpeed[3];
float fSpeed_New;
 
public void OnPluginStart()
{
	CreateTimer(0.1, showHUD, _, TIMER_REPEAT);
}

public Action showHUD(Handle timer, any something)
{
	for(int i; i < MaxClients; i++)
	{
		if(IsClientInGame(icontent))
		{
			GetEntPropVector(i, Prop_Data, "m_vecVelocity", fSpeed);
			fSpeed_New = SquareRoot(Pow(fSpeed[0], 2.0) + Pow(fSpeed[1], 2.0));
			PrintHintText(i, "~HardStrike.EU~\n%.02f", fSpeed_New);
		}
	}
}
NWayne is offline
CamerDisco
AlliedModders Donor
Join Date: Aug 2015
Location: Poland
Old 08-27-2017 , 15:30   Re: Problem w/ speed timer
Reply With Quote #2

Start loop from 1.
__________________


Max-Play.pl - the best polish servers
CamerDisco is offline
NWayne
Junior Member
Join Date: Aug 2017
Location: Warsaw, Europe
Old 08-27-2017 , 15:51   Re: Problem w/ speed timer
Reply With Quote #3

Quote:
Originally Posted by CamerDisco View Post
Start loop from 1.
How ?
NWayne is offline
Vaggelis
Senior Member
Join Date: May 2017
Old 08-27-2017 , 15:56   Re: Problem w/ speed timer
Reply With Quote #4

Quote:
Originally Posted by NWayne View Post
How ?
for(int i = 1; i <= MaxClients; i++)

Last edited by Vaggelis; 08-27-2017 at 15:57.
Vaggelis is offline
NWayne
Junior Member
Join Date: Aug 2017
Location: Warsaw, Europe
Old 08-27-2017 , 16:00   Re: Problem w/ speed timer
Reply With Quote #5

Quote:
Originally Posted by Vaggelis View Post
for(int i = 1; i <= MaxClients; i++)
that's all?
NWayne is offline
fiction
Member
Join Date: May 2017
Old 08-27-2017 , 16:05   Re: Problem w/ speed timer
Reply With Quote #6

Quote:
Originally Posted by NWayne View Post
that's all?
That is all, if you run IsClientInGame(0) you will get that error.
fiction is offline
NWayne
Junior Member
Join Date: Aug 2017
Location: Warsaw, Europe
Old 08-27-2017 , 16:08   Re: Problem w/ speed timer
Reply With Quote #7

Okay, thank you guys for help me fix it
NWayne is offline
NWayne
Junior Member
Join Date: Aug 2017
Location: Warsaw, Europe
Old 08-28-2017 , 05:28   Re: Problem w/ speed timer
Reply With Quote #8

Guys, it's still doesn't work

Quote:
L 08/28/2017 - 10:26:11: [SM] Exception reported: Entity 2 (2) is invalid
L 08/28/2017 - 10:26:11: [SM] Blaming: nwayne_hud.smx
L 08/28/2017 - 10:26:11: [SM] Call stack trace:
L 08/28/2017 - 10:26:11: [SM] [0] GetEntPropVector
L 08/28/2017 - 10:26:11: [SM] [1] Line 19, C:\Users\KORDIAN\Desktop\surf\nwayne_hud.sp:: showHUD
NWayne is offline
Vaggelis
Senior Member
Join Date: May 2017
Old 08-28-2017 , 06:46   Re: Problem w/ speed timer
Reply With Quote #9

Quote:
Originally Posted by NWayne View Post
Guys, it's still doesn't work
Why if(IsClientInGame(icontent)) and not if(IsClientInGame(i)) ?
Vaggelis is offline
NWayne
Junior Member
Join Date: Aug 2017
Location: Warsaw, Europe
Old 08-28-2017 , 07:38   Re: Problem w/ speed timer
Reply With Quote #10

Quote:
Originally Posted by Vaggelis View Post
Why if(IsClientInGame(icontent)) and not if(IsClientInGame(i)) ?
Idk
NWayne 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 22:08.


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