AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   Solved [L4D2] Spawn ghost infected players - Issue (https://forums.alliedmods.net/showthread.php?t=339487)

alasfourom 09-13-2022 01:45

[L4D2] Spawn ghost infected players - Issue
 
Hello guys,

I have been trying to spawn dead infected into the spawnable ghost form, but with no luck

tried to manipulate with these EntProps but still:

PHP Code:

//SetEntProp(client, Prop_Send, "m_isGhost", 1);
//SetEntProp(client, Prop_Send,  "m_lifeState", 1);
//SetEntProp(client, Prop_Send, "m_ghostSpawnState", 0); 

This is the script

PHP Code:

#include <sourcemod>
#include <sdkhooks>
#include <sdktools>

#pragma semicolon 1
#pragma newdecls required

public void OnPluginStart()
{
    
RegConsoleCmd("sm_boomer"Command_Boomer"Spawn as a boomer ghost");
}

public 
Action Command_Boomer(int clientint args)
{
    if (
GetClientTeam(client) == && !IsPlayerAlive(client))
    {
        
int CmdFlags GetCommandFlags("z_spawn_old");
        
SetCommandFlags("z_spawn_old"CmdFlags & ~FCVAR_CHEAT);
        
FakeClientCommand(client"z_spawn_old boomer auto");
    }
    else 
PrintToChat(client"only dead infected can use this command");



sorallll 09-13-2022 02:17

Re: [L4D2] Spawn ghost infected players - Issue
 
PHP Code:

Handle g_hSDK_CTerrorPlayer_SetPreSpawnClassg_hSDK_CCSPlayer_State_Transition;

char sPath[PLATFORM_MAX_PATH];
    
BuildPath(Path_SMsPathsizeof sPath"gamedata/%s.txt"GAMEDATA);
    if (!
FileExists(sPath))
        
SetFailState("\n==========\nMissing required file: \"%s\".\n=========="sPath);

    
GameData hGameData = new GameData(GAMEDATA);
    if (!
hGameData)
        
SetFailState("Failed to load \"%s.txt\" gamedata."GAMEDATA);

StartPrepSDKCall(SDKCall_Player);
    if (!
PrepSDKCall_SetFromConf(hGameDataSDKConf_Signature"CTerrorPlayer::SetPreSpawnClass"))
        
SetFailState("Failed to find signature: \"CTerrorPlayer::SetPreSpawnClass\"");
    
PrepSDKCall_AddParameter(SDKType_PlainOldDataSDKPass_Plain);
    
g_hSDK_CTerrorPlayer_SetPreSpawnClass EndPrepSDKCall();
    if (!
g_hSDK_CTerrorPlayer_SetPreSpawnClass)
        
SetFailState("Failed to create SDKCall: \"CTerrorPlayer::SetPreSpawnClass\"");

StartPrepSDKCall(SDKCall_Player);
    if (!
PrepSDKCall_SetFromConf(hGameDataSDKConf_Signature"CCSPlayer::State_Transition"))
        
SetFailState("Failed to find signature: \"CCSPlayer::State_Transition\"");
    
PrepSDKCall_AddParameter(SDKType_PlainOldDataSDKPass_Plain);
    
g_hSDK_CCSPlayer_State_Transition EndPrepSDKCall();
    if (!
g_hSDK_CCSPlayer_State_Transition)
        
SetFailState("Failed to create SDKCall: \"CCSPlayer::State_Transition\""); 

PHP Code:

// CTerrorPlayer::UpdateZombieFrustration(CTerrorPlayer *__hidden this)
SDKCall(g_hSDK_CTerrorPlayer_SetPreSpawnClassclient3);
SDKCall(g_hSDK_CCSPlayer_State_Transitionclient8); 

PHP Code:

/* CTerrorPlayer::SetPreSpawnClass(ZombieClassType) */
            
"CTerrorPlayer::SetPreSpawnClass"
            
{
                
"library"    "server"
                "linux"        "@_ZN13CTerrorPlayer16SetPreSpawnClassE15ZombieClassType"
                "windows"    "\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x8B\x2A\x39\xBE\xB8"
                
/* ? ? ? ? ? ? ? ? 8B ? 39 BE B8 */
            
}

/* CCSPlayer::State_Transition(CSPlayerState) */
            
"CCSPlayer::State_Transition"
            
{
                
"library"    "server"
                "linux"        "@_ZN9CCSPlayer16State_TransitionE13CSPlayerState"
                "windows"    "\x2A\x2A\x2A\x2A\x2A\x2A\x8B\x86\x2A\x2A\x2A\x2A\x57\x8B\x2A\x2A\x85\x2A\x74\x2A\x83"
                
/* ? ? ? ? ? ? 8B 86 ? ? ? ? 57 8B ? ? 85 ? 74 ? 83 */
            



alasfourom 09-13-2022 04:40

Re: [L4D2] Spawn ghost infected players - Issue
 
Thank you for your replay,

I ended up using left4dhooks

PHP Code:

#include <sourcemod>
#include <sdkhooks>
#include <sdktools>
#include <left4dhooks>

#pragma semicolon 1
#pragma newdecls required

public void OnPluginStart()
{
    
RegConsoleCmd("sm_boomer"Command_Boomer"Spawn as a boomer ghost");
}

public 
Action Command_Boomer(int clientint args)
{
    if (
GetClientTeam(client) == && !IsPlayerAlive(client))
    {
        
L4D_State_Transition(clientSTATE_GHOST);
        
L4D_SetClass(client2); //2 = Boomer
    
}
    else 
PrintToChat(client"only dead infected can use this command");




All times are GMT -4. The time now is 00:58.

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