AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   Solved [L4D] SDKCall crashes the server/game (https://forums.alliedmods.net/showthread.php?t=303919)

Psyk0tik 12-27-2017 10:48

[L4D] SDKCall crashes the server/game
 
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.

Spirit_12 12-27-2017 12:43

Re: [L4D] SDKCall crashes the server/game
 
SDK Calls are game specific. You can't expect two libraries to have the same signatures for the functions. It is possible in some cases, but it is rare.

Here are the CTerrorPlayer::OnVomitedUpon signatures for L4D1 that you requested.


Linux

PHP Code:

_ZN13CTerrorPlayer13OnVomitedUponEPS_bb 

Windows

PHP Code:

\x83\xEC\x14\x53\x55\x56\x57\x8B\xF1\xE8\x2A\x2A\x2A\x2A 


Psyk0tik 12-27-2017 13:01

Re: [L4D] SDKCall crashes the server/game
 
Thanks Spirit! That Windows signature is different from the one I was using and now I'm no longer crashing. :D


All times are GMT -4. The time now is 20:38.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.