Hello my plugin have got error plz help me =)
(original plugin is smcash)
PHP Code:
#include <sourcemod>
#pragma semicolon 1
#define PLUGIN_VERSION "1.2"
#define YELLOW 0x01
#define GREEN 0x04
public Plugin:myinfo =
{
name = "16k_round",
author = "Lowmach1ne",
description = "16k a chaque round",
version = PLUGIN_VERSION,
url = "http://www.eSport-ReVolution.eu"
};
new g_iAccount = -1;
public OnPluginStart()
{
g_iAccount = FindSendPropOffs("CCSPlayer", "m_iAccount");
if (g_iAccount == -1)
{
PrintToServer("[16k_round] - Unable to start, cannot find necessary send prop offsets.");
return;
}
CreateConVar("sm_16k_version", PLUGIN_VERSION, "16k_round Version", FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY);
RegAdminCmd("sm_cash", Command_SmCash, ADMFLAG_CUSTOM1, "sm_cash <name or #userid or all/t/ct> <amount> - Set target's cash to amount.");
HookEventEx("player_team", PlayerTeamEvent, EventHookMode_Post);
HookEvent("round_start",RoundStartEvent, EventHookMode_Post);
}
public Action:PlayerTeamEvent(Handle:event, const String:name[], bool:dontBroadcast)
{
new client = GetClientOfUserId(GetEventInt(event, "userid"));
if(IsClientInGame(client))
{
PrintToChat(client,"%c[16k_round]%c Give 16k$ all rounds whis lowmach1ne's plugin.",GREEN,YELLOW);
}
return Plugin_Continue;
}
public Action:Command_SmCash(client, args)
{
if (args < 2)
{
ReplyToCommand(client, "[SM] Usage: sm_cash <name or #userid or all/t/ct> <amount>");
return Plugin_Handled;
}
new String:szArg[65];
GetCmdArg(1, szArg, sizeof(szArg));
new iAmount;
decl String:szAmount[64];
GetCmdArg(2, szAmount, 64);
iAmount = StringToInt(szAmount);
if(iAmount == 0 && szAmount[0] != '0')
{
return Plugin_Handled;
}
if(strcmp(szArg, "all", false) == 0)
{
new iMaxClients = GetMaxClients();
for (new i = 1; i <= iMaxClients; i++)
{
if (IsClientInGame(i))
SetMoney(i, iAmount);
}
}
else if(strcmp(szArg, "t", false) == 0 || strcmp(szArg, "ct", false) == 0)
{
new iMaxClients = GetMaxClients();
for (new i = 1; i <= iMaxClients; i++)
{
if (IsClientInGame(i))
{
if(GetClientTeam(i) == (strcmp(szArg, "t", false) == 0 ? 2 : 3))
SetMoney(i, iAmount);
}
}
}
else
{
new iClients[2];
new iNumClients = SearchForClients(szArg, iClients, 2);
if (iNumClients == 0)
{
return Plugin_Handled;
}
else if (iNumClients > 1)
{
return Plugin_Handled;
}
else if (!CanUserTarget(client, iClients[0]))
{
return Plugin_Handled;
}
decl String:szName[64];
GetClientName(iClients[0], szName, 64);
SetMoney(iClients[0], iAmount);
}
return Plugin_Handled;
}
public SetMoney(client, amount)
{
if (g_iAccount != -1)
SetEntData(client, g_iAccount, amount);
}
public GetMoney(client)
{
if (g_iAccount != -1)
return GetEntData(client, g_iAccount);
return 0;
}
public RoundStartEvent(Handle:event,const String:name[],bool:dontBroadcast)
{
ServerCommand("sm_cash all 16000");
}
Eror is:
PHP Code:
L 11/01/2008 - 15:58:50: [SM] Native "IsClientInGame" reported: Client index 0 is invalid
L 11/01/2008 - 15:58:50: [SM] Displaying call stack trace for plugin "16k_round.smx":
L 11/01/2008 - 15:58:50: [SM] [0] Line 38, /home/groups/sourcemod/upload_tmp/textCx5N0u.sp::PlayerTeamEvent()