Hi all,
for some strange reason which I can't figure out why, my clients are never in game according to this function, IsClientInGame(index) also just removing it from the script causes errors with the other functions, which I expected to happen anyway.
Can anyone explain to me why my clients are never in game even when they have been running around for 20 minutes, am I using the wrong user index or something??
PHP Code:
#include <sourcemod>
#include <sdktools>
#include <events>
#pragma semicolon 1
#define PLUGIN_VERSION "1.0"
public Plugin:myinfo =
{
name = "Jihad",
author = "david balogh",
description = "Plays a Jihad sound on a suicide kill",
version = PLUGIN_VERSION,
url = "http://www.ma15plus.com/"
};
public OnPluginStart()
{
HookEvent("player_death", Event_PlayerDeath, EventHookMode_Pre);
}
public OnMapStart()
{
PrecacheSound("sound/jihad.mp3", true);
AddFileToDownloadsTable("sound/jihad.mp3");
}
public Event_PlayerDeath(Handle:event, const String:name[], bool:dontBroadcast)
{
PrintToChatAll("Death Event triggered");
new String:victimname[64];
new String:attackername[64];
new victimId = GetEventInt(event, "userid");
new attackerId = GetEventInt(event, "attacker");
new players = GetMaxClients();
PrintToChatAll("AttackerId: %d victimId: %d", attackerId, victimId);
if(attackerId != victimId)
{
PrintToChatAll("Is Client In Game: %d :: %d", IsClientInGame(attackerId), IsClientInGame(victimId));
if(IsClientInGame(attackerId) && IsClientInGame(victimId))
{
PrintToChatAll("Is Attacker Alive: %d Is Victim Alive: %d", IsPlayerAlive(attackerId), IsPlayerAlive(victimId));
if(!IsPlayerAlive(attackerId) && !IsPlayerAlive(victimId))
{
for (new Loop = 1; Loop < players; Loop++)
{
if(IsClientInGame(Loop))
{
ClientCommand(Loop, "play jihad.mp3");
}
}
GetClientName(victimId, victimname, sizeof(victimname));
GetClientName(attackerId, attackername, sizeof(attackername));
PrintToChatAll("%s Went Jihad!!!!!!!!!!!!!!!!!!! on %s", attackername, victimname);
}
}
}
PrintToChatAll("End of death event");
return;
}
This is my first script in this language, so I'm not sure how it all works yet.
Also does anyone have any IDE suggestions for this language?? notepad is a pain to use!!
Thanks for your help
David
EDIT: the mod is HL2DM