[L4D1] [SM] Native "GetClientHealth" reported: Client index 54 is invalid
PHP Code:
|
[L4D1] [SM] Native "GetClientHealth" reported: Client index 54 is invalid
PHP Code:
|
Re: [L4D1] [SM] Native "GetClientHealth" reported: Client index 54 is invalid
You should post more lines from the log so it shows which line throws the error
Btw is a good practise to also check if the client is valid I always use this stock here stock bool IsValidClient(int iClient) { return (iClient > 0 && iClient <= MaxClients && IsClientInGame(iClient)); } also "userid" returns the ClientUserId and not the ClientId (index) so u need to convert that inside the timer GetClientHealth(GetClientOfUserId(Client)); |
Re: [L4D1] [SM] Native "GetClientHealth" reported: Client index 54 is invalid
Code:
HookEvent("tank_spawn", Event_Tank_Spawn); |
Re: [L4D1] [SM] Native "GetClientHealth" reported: Client index 54 is invalid
Thank you both for your help.
I wrote it wrong. HookEvent("tank_spawn", Event_Tank_Spawn); public Action:Event_Tank_Spawn(Handle:event, String:name[], bool:dontBroadcast) { new Client = GetClientOfUserId(GetEventInt(event, "userid")); CreateTimer(0.5, SetTankG, Client); } Now it works fine. |
Re: [L4D1] [SM] Native "GetClientHealth" reported: Client index 54 is invalid
You should be pushing the userid into CreateTimer and GetClientOfUserID in the timer callback to correctly validate the client. Drixevel already showed you this, your code above is wrong.
|
Re: [L4D1] [SM] Native "GetClientHealth" reported: Client index 54 is invalid
Quote:
|
All times are GMT -4. The time now is 20:51. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.