Hey guys, here's the code I use with the SDKCall:
PHP Code:
public Action tAutoTimerBileSpeedrunners(Handle timer, any data)
{
float flcount;
float flDistance[MAXPLAYERS + 1];
float flOtherOrigin[3] = {0.0, 0.0, 0.0};
float flOverLimit[MAXPLAYERS + 1];
float flOwnOrigin[3] = {0.0, 0.0, 0.0};
for(int iSurvivor = 1; iSurvivor <= MaxClients; iSurvivor++)
if((bIsValidClient(iSurvivor) && !cvBileCountBots.BoolValue) || (bIsSurvivor(iSurvivor) && cvBileCountBots.BoolValue))
flcount++;
if(!cvBileTankAlive.BoolValue)
vCountTanks();
if(!cvEnablePlugin.BoolValue || !cvBileEnable.BoolValue || !cvBileAutoMode.BoolValue || flcount < 2 && !cvBileCountBots.BoolValue || flcount < 1 && cvBileCountBots.BoolValue || cvBileDistanceLimit.IntValue == 0.0 || iTankAmount || !bIsSystemValid())
return Plugin_Continue;
for(int iPlayer = 1; iPlayer <= MaxClients; iPlayer++)
{
if(cvBileDistanceWarning.IntValue == 0.0)
return Plugin_Continue;
if(((bIsValidClient(iPlayer) && !cvBileCountBots.BoolValue) || (bIsSurvivor(iPlayer) && cvBileCountBots.BoolValue)))
{
GetClientAbsOrigin(iPlayer, flOwnOrigin);
for(int iDestination = 1; iDestination <= MaxClients; iDestination++)
{
if(((bIsValidClient(iDestination) && !cvBileCountBots.BoolValue) || (bIsSurvivor(iDestination) && cvBileCountBots.BoolValue)) && iDestination != iPlayer)
{
GetClientAbsOrigin(iDestination, flOtherOrigin);
flDistance[iPlayer] += GetVectorDistance(flOwnOrigin, flOtherOrigin);
if(GetVectorDistance(flOwnOrigin, flOtherOrigin) > cvBileDistanceLimit.IntValue)
flOverLimit[iPlayer]++;
}
}
}
for(int iAdmin = 1; iAdmin <= MaxClients; iAdmin++)
{
flDistance[iPlayer] = FloatDiv(flDistance[iPlayer], (flcount - 1));
if(flDistance[iPlayer] > cvBileDistanceLimit.IntValue && flOverLimit[iPlayer] > 1 && (!cvBileAdminImmunity.BoolValue || (cvBileAdminImmunity.BoolValue && !bIsAdminAllowed(iPlayer))))
{
vBilePlayer(iPlayer, iAdmin);
return Plugin_Continue;
}
else if(flDistance[iPlayer] > cvBileDistanceWarning.IntValue && bIsValidClient(iPlayer))
{
if(iTranslate)
PrintHintText(iPlayer, "[ASS] %t", "BileWarn");
else
PrintHintText(iPlayer, "[ASS] A Boomer ninja is watching you...");
}
}
}
return Plugin_Continue;
}
void vBilePlayer(int target, int client)
{
if((bIsSurvivor(target) && cvBileCountBots.BoolValue) || (bIsValidClient(target) && !cvBileCountBots.BoolValue) && (!cvBileAdminImmunity.BoolValue || (cvBileAdminImmunity.BoolValue && !bIsAdminAllowed(target))))
{
SDKCall(hSDKBileSurvivor, target, client, true);
if(iTranslate)
{
PrintToChat(target, "\x04[ASS]\x01 %t", "BileInform");
PrintToChatAll("\x04[ASS]\x01 %t", "BileAnnounce", target);
}
else
{
PrintToChat(target, "\x04[ASS]\x01 A\x05 Boomer ninja\x01 puked on\x03 you\x01!");
PrintToChatAll("\x04[ASS]\x01 A\x05 Boomer ninja\x01 puked on\x03 %N\x01!", target);
}
}
}
For some reason, it works just fine on L4D2, but on L4D the server/game crashes when the SDKCall function is called.
No errors nor messages in the logs either.
__________________