View Single Post
Author Message
Psyk0tik
Veteran Member
Join Date: May 2012
Location: Homeless
Old 12-27-2017 , 10:48   [L4D] SDKCall crashes the server/game
Reply With Quote #1

Hey guys, here's the code I use with the SDKCall:

PHP Code:
public Action tAutoTimerBileSpeedrunners(Handle timerany data)
{
    
float flcount;
    
float flDistance[MAXPLAYERS 1];
    
float flOtherOrigin[3] = {0.00.00.0};
    
float flOverLimit[MAXPLAYERS 1];
    
float flOwnOrigin[3] = {0.00.00.0};
    for(
int iSurvivor 1iSurvivor <= MaxClientsiSurvivor++)
        if((
bIsValidClient(iSurvivor) && !cvBileCountBots.BoolValue) || (bIsSurvivor(iSurvivor) && cvBileCountBots.BoolValue))
            
flcount++;
    if(!
cvBileTankAlive.BoolValue)
        
vCountTanks();
    if(!
cvEnablePlugin.BoolValue || !cvBileEnable.BoolValue || !cvBileAutoMode.BoolValue || flcount && !cvBileCountBots.BoolValue || flcount && cvBileCountBots.BoolValue || cvBileDistanceLimit.IntValue == 0.0 || iTankAmount || !bIsSystemValid())
        return 
Plugin_Continue;
    for(
int iPlayer 1iPlayer <= MaxClientsiPlayer++)
    {
        if(
cvBileDistanceWarning.IntValue == 0.0)
            return 
Plugin_Continue;
        if(((
bIsValidClient(iPlayer) && !cvBileCountBots.BoolValue) || (bIsSurvivor(iPlayer) && cvBileCountBots.BoolValue)))
        {
            
GetClientAbsOrigin(iPlayerflOwnOrigin);
            for(
int iDestination 1iDestination <= MaxClientsiDestination++)
            {
                if(((
bIsValidClient(iDestination) && !cvBileCountBots.BoolValue) || (bIsSurvivor(iDestination) && cvBileCountBots.BoolValue)) && iDestination != iPlayer)
                {
                    
GetClientAbsOrigin(iDestinationflOtherOrigin);
                    
flDistance[iPlayer] += GetVectorDistance(flOwnOriginflOtherOrigin);
                    if(
GetVectorDistance(flOwnOriginflOtherOrigin) > cvBileDistanceLimit.IntValue)
                        
flOverLimit[iPlayer]++;
                }
            }
        }

        for(
int iAdmin 1iAdmin <= MaxClientsiAdmin++)
        {
            
flDistance[iPlayer] = FloatDiv(flDistance[iPlayer], (flcount 1));
            if(
flDistance[iPlayer] > cvBileDistanceLimit.IntValue && flOverLimit[iPlayer] > && (!cvBileAdminImmunity.BoolValue || (cvBileAdminImmunity.BoolValue && !bIsAdminAllowed(iPlayer))))
            {
                
vBilePlayer(iPlayeriAdmin);
                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 targetint client)
{
    if((
bIsSurvivor(target) && cvBileCountBots.BoolValue) || (bIsValidClient(target) && !cvBileCountBots.BoolValue) && (!cvBileAdminImmunity.BoolValue || (cvBileAdminImmunity.BoolValue && !bIsAdminAllowed(target))))
    {
        
SDKCall(hSDKBileSurvivortargetclienttrue);
        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.
__________________

Last edited by Psyk0tik; 12-27-2017 at 13:01.
Psyk0tik is offline