Hi,
I get some errors in my server console from one plugin. What is wrong?
Error code:
Code:
L 07/29/2016 - 04:36:40: [SM] Exception reported: Client index 0 is invalid
L 07/29/2016 - 04:36:40: [SM] Blaming: reklama.smx()
L 07/29/2016 - 04:36:40: [SM] Call stack trace:
L 07/29/2016 - 04:36:40: [SM] [0] IsClientConnected
L 07/29/2016 - 04:36:40: [SM] [1] Line 23, E:\codek\addons\sourcemod\scripting\reklama.sp::Timer_Advertise()
Here is plugin code:
Code:
#include <sourcemod>
#include <sdktools>
#include <cstrike>
public Plugin:myinfo =
{
name = "Reklama",
author = "Kempus",
description = "Plugin wyświetlający reklamę przy wejściu",
version = "1.0",
url = "http://google.pl/"
};
public void OnClientPutInServer(int client)
{
CreateTimer(10.0, Timer_Advertise, GetClientSerial(client), true);
}
public Action Timer_Advertise(Handle timer, any data)
{
int client = GetClientFromSerial(data);
if (!IsClientConnected(client) || CheckCommandAccess(client, "sm_reklama", ADMFLAG_RESERVATION))
return Plugin_Stop; // Our client is gone or have access to the admin command sm_reklama... ABORT!
else if (IsClientInGame(client))
{
FakeClientCommandEx(client, "say !reklama"); // say !reklama
return Plugin_Stop; // We done what we needed, end timer.
}
return Plugin_Continue; // Timer will trigger again.
}