View Single Post
alasfourom
Senior Member
Join Date: Feb 2022
Location: Saudi Arabia
Old 10-07-2022 , 10:00   Re: [L4D2]Spawn Infected couldn't find position 5 times.
Reply With Quote #2

Is this what you are trying to achieve?

"z_spawn_old charger auto" already spawn special infected in random position

I'm really not sure what do you want to do , also there are multiple plugins that can spawn special infected

PHP Code:
#include <sourcemod>

#pragma semicolon 1
#pragma newdecls required

public void OnPluginStart()
{
    
RegAdminCmd("sm_add_infected"Command_SpawnInfectedADMFLAG_UNBAN"To Spawn Random Infected");
}

public 
Action Command_SpawnInfected(int clientint args)
{
    
SpawnRandomInfected(client);
    
PrintToChatAll("\x04[Random Spawner] \x01Player \x03%N \x01has spawned random infected"client);
    return 
Plugin_Handled;
}

void SpawnRandomInfected(int client)
{
    
int spawn GetRandomInt(16);
    switch (
spawn)
    {
        case 
1CheatCommand(client"z_spawn_old""charger auto");
        case 
2CheatCommand(client"z_spawn_old""hunter auto");
        case 
3CheatCommand(client"z_spawn_old""smoker auto");
        case 
4CheatCommand(client"z_spawn_old""spitter auto");
        case 
5CheatCommand(client"z_spawn_old""boomer auto");
        case 
6CheatCommand(client"z_spawn_old""jockey auto");
    }
}

void CheatCommand(int client, const char[] command, const char[] item)
{
    
int CmdFlags GetCommandFlags(command);
    
SetCommandFlags(commandCmdFlags & ~FCVAR_CHEAT);
    
FakeClientCommand(client"%s %s"commanditem);
    
SetCommandFlags(commandCmdFlags);

__________________

Last edited by alasfourom; 10-07-2022 at 10:16.
alasfourom is offline