Raised This Month: $51 Target: $400
 12% 

how create a lot of zombies?


Post New Thread Reply   
 
Thread Tools Display Modes
Timocop
AlliedModders Donor
Join Date: Mar 2013
Location: Germany
Old 09-21-2017 , 18:01   Re: how create a lot of zombies?
Reply With Quote #11

There are serval things you're doing wrong here:
1) You cant set spawn locations with z_spawn, there is no argument for it.
2) Why are you creating fake clients to execute a command? Get a random client instead.
3) You should use z_spawn_old instead, z_spawn seems broken in special cases (like z_spawn auto doesn't work at all).
4) In some maps or gamemodes (versus) VScripts may interfere with spawning use Director Unlocker to uncap the limits.

PHP Code:
#include <sourcemod>
#include <sdktools>

int g_lastSpawn;

public 
void OnPluginStart()
{
    
HookEvent("player_spawn"OnPlayerSpawn);
}

public 
void OnPlayerSpawn(Event event, const char[] namebool dontBroadcast)
{
    
int client GetClientOfUserId(event.GetInt("userid"));
    
    
g_lastSpawn client;
}

void SpawnInfected()
{
    
//Get random client to execute command.
    
int client;
    for (
int i 1<= MaxClientsi++) 
    {
        if (!
IsClientInGame(i))
            continue;
        
        
client i;
        break;
    }
    
    
//If no client was found, we should abort.
    
if (client 1)
        return;
    
    
//Spawn infected
    //Make 'name' static, keeps it in memory so it doesn't need to initalize everytime. Doesn't change anyways.
    
static char spawn[][32] = {"charger""spitter""jockey"};
    for (
int i 1<= 6i++)
    {
        
//Set the it to -1 so we can check if the spawn was successfull or not.
        
g_lastSpawn = -1;
        
//z_spawn spawns an infected, which executes player_spawn in the same frame and fills the g_lastSpawn variable with its index.
        //If you want to spawn them automatically use "z_spawn_old auto" instead. Without the teleport below.
        
CheatCommand(client"z_spawn_old"spawn[GetRandomInt(0sizeof(spawn) - 1)]);
        
int infected g_lastSpawn;
        
        if (
infected 0
        {
            
TeleportEntity(infectedposNULL_VECTORNULL_VECTOR);
        }
    }


Quote:
Originally Posted by Halt View Post
Perhaps you could try

PHP Code:
SetCommandFlags("z_minion_limit", (GetCommandFlags("z_minion_limit") - FCVAR_CHEAT)); 
Changes the command flags.
That makes no difference. And you using it incorrecly, use bitwise operators for flags.

Last edited by Timocop; 09-21-2017 at 18:03.
Timocop is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 19:43.


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