AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Snippets and Tutorials (https://forums.alliedmods.net/forumdisplay.php?f=112)
-   -   [INC] [L4D2] Infected Spawn API v1.6.1 (https://forums.alliedmods.net/showthread.php?t=114979)

V10 01-09-2010 06:54

[INC] [L4D2] Infected Spawn API v1.6.1
 
3 Attachment(s)
I implement API to correct spawn infected bosses with more options (owner,ghost, startorigin, etc)
If you found bugs in API(or misprints in the English text) please inform me.
Sample plugin included.

Truncated Header File:
PHP Code:

/* (c) Infected Spawn API by V10 aka maldersoft (http://sourcemod.V10.name).
* This API written for l4d2 plugin writers to correct spawn infected bosses with more options (owner,ghost, startorigin, etc).
* Also plugin implement easy utils functions (stocks).
* Put InfectedAPI.txt to addons\sourcemod\gamedata folder!
*/ 

/* ChangeLog: 
* 1.6.1
* - Fixed spawn command from z_spawn to z_spawn_old.
* 1.6
* - Added array g_iMaxInfectedCounts[]
* - Removed GetMaxInfectedCounts()
* - Added InitInfectedSpawnAPI() you must call this in Plugin_Start()
* - Removed all checks for alive and other checks. Now plugin must use it.
* - Some optimizations for speed up
* 1.5
* - Added function StringToClass
* - Improved small optimizations
* - Added check player claws entity id to prevent errors
* 1.4
* - updated InfectedAPI.txt: added offset RefEHandleOffset
* - simple changes in GenerateZombieId
* - fixed all MAXPLAYERS to MaxClients
* - disable use function InfectedForceGhostFinale
* - Added second try to spawn if first fail
* - updated InfectedAPI.txt: changed sign OnEnterGhostState (thanks to AtomicStryker)
* 1.3
* - Allow ghost mode for class TANK also (check removed)
* - Added config file gamedata\InfectedAPI.txt
* - Added bGhostFinale parameter to function SpawnInfectedBoss
* - Temporary removed InfectedAPI_mm (no needed now)
* - Added function InfectedForceGhost to correct spawn ghost and ghost in finale without any exstensions (l4dtoolz, etc)
* - Removed InitializeAsGhost (is not a reliable function)
* - Added function to correct generate random infected class 
* - Added function to correct change infected class (based on SDK)
* - Added new consts for classes,also fixed bug with TANK (ZC_WITCH=7, ZC_TANK=8, ZC_NOT_INFECTED=9)
* - Changed g_sBossNames
* - Changed array in GetInfectedCounts() to Array[ZC_NOT_INFECTED], also now return TANK count
* - Added function GetInfectedClass
* - Added debug log to file.
* 1.2
* - Added metamod plugin for spawn ghost in finale (cvar z_ghost_finale).
* - Added detect l4dtoolz for spawning ghost in finale.
* - Removed fGhostFinale (not needed).
* - Removed function InitializeInfectedAPI (not needed).
* - Added param Velocity to function SpawnInfectedBoss.
* - Added counter to prevent infinite loop on try spawn ghost.
* - Fixed some bugs.
* 1.1
* - Added function GetInfectedCounts.
* - Added function GetMaxInfectedCounts.
* 1.0
* - Initial release.

*/

#define InfectedApiVersion1_5 1
#define InfectedApiVersion1_6 1

#define TEAM_SURVIVOR 2
#define TEAM_INFECTED 3

#define STATE_GHOST 8

#define ZC_SMOKER 1
#define ZC_BOOMER 2
#define ZC_HUNTER 3
#define ZC_SPITTER 4
#define ZC_JOCKEY 5
#define ZC_CHARGER 6
#define ZC_WITCH 7
#define ZC_TANK 8
#define ZC_NOT_INFECTED 9     //survivor

new String:g_sBossNames[ZC_NOT_INFECTED+1][10]={"","smoker","boomer","hunter","spitter","jockey","charger","witch","tank","survivor"};
new 
g_iMaxInfectedCounts[ZC_TANK];

new 
bool:g_ISAPIInited=false;

new 
g_ISAPI_propinfo_isAlive = -1;
new 
g_ISAPI_propinfoghost = -1;
new 
g_ISAPI_propinfo_zombieClass = -1;
new 
g_ISAPI_propinfo_customAbility = -1;
new 
g_ISAPI_propinfo_lifeState = -1;
new 
g_ISAPI_propinfo_isCulling = -1;
new 
g_ISAPI_propinfo_vecVelocity0 = -1;

InitInfectedSpawnAPI();

/**
* Spawn the specified zombie boss
*
* @param client                Client index.
* @param Class                Class of boss (see constants ZC_ in top of this file)
* @param bGhost                True = spawned as ghost, False= spawned as alived..
* @param bGhostFinale        True = spawned as ghost in finale, False= spawned as alived.in finale
* @param bAuto                Use director auto position? True = use, False = spawn in eye direction (if param Origin not set)
* @param Origin             Set position new zombie
* @param Angles             Set angles new zombie
* @param Velocity            Set velocitys new zombie
* @return                    True if successfully spawn, false otherwise.
* @error            Invalid handle, or bounds error.
*                     Invalid infected class
*                     Client is alive
*                     Client is not in game
*                     Client is not infected team
*                     Can't get open config file (gamedata\InfectedAPI.txt) (FAILSTATE FOR PLUGIN)
*                     Can't get offsets (FAILSTATE FOR PLUGIN)
*/

stock SpawnInfectedBoss(client, Class, bool:bGhost=falsebool:bAuto=truebool:bGhostFinale=false ,const Float:Origin[3]=NULL_VECTOR,const Float:Angles[3]=NULL_VECTOR,const Float:Velocity[3]=NULL_VECTOR);

/**
* Force infected to full ghost state

* @param client            Client index.
* @param SavePos        True = save position, False = spawn in director pos
* @param inFinaleAlso    True = ghost in finale, False = return false in finale
* @return                True if successfully , false otherwise.
* @error                Invalid handle, or bounds error.
*                         Client is alive
*                         Client is already ghost
*                         Client is not in game
*                         Client is not infected team
*                         Can't get open config file (gamedata\InfectedAPI.txt) (FAILSTATE FOR PLUGIN)
*                          Can't get offsets (FAILSTATE FOR PLUGIN)
*
*  Notice: Function detect l4dtoolz and if sv_force_normal_respawn==1 to spawn ghost in finales, ignore inFinaleAlso
*/

stock bool:InfectedForceGhost(clientSavePos=falseinFinaleAlso=false);

/**
* Change infected zombie class

* @param client            Client index.
* @param newclass        New class for zombie
* @return                True if successfully , false otherwise.
* @error                Invalid handle, or bounds error.
*                         Client is alive
*                         Client is already ghost
*                         Client is not in game
*                         Client is not infected team
*                         Can't get open config file (gamedata\InfectedAPI.txt) (FAILSTATE FOR PLUGIN)
*                          Can't get offsets (FAILSTATE FOR PLUGIN)
*/

stock InfectedChangeClass(client,newclass);

/**
* Correctly generate new zombie class id for spawn, change, etc

* @param client            Client index.
* @param lastClass        Last used class (for exlude same class)
* @return                Corectry randomed new class id
*/

stock GenerateZombieId(lastClassbool:checkmax=true);


/**
* Get all infected boss counts

* @return            Array longs from ZC_SMOKER to ZC_TANK (Array[ZC_NOT_INFECTED])
* Notice:            This function not return wiches count
*/
stock GetInfectedCounts();

/**
* Get Player class 

* @param client    Client index.
* @return            player class

*/
stock GetInfectedClass(client);

stock SetPlayerIsAlive(clientbool:alive);
stock StringToClass(const String:zclass[]);
stock bool:IsPlayerGhost(client);
stock SetPlayerGhostStatus(clientbool:ghost);
stock SetPlayerLifeState(clientbool:ready);
stock CheatCommand(client, const String:command[], const String:arguments[]="");
stock bool:isWin32(); 

Downloads:
v1.6 ~ 400
v1.5 ~ 500
v1.3 ~ 230
v1.2 ~ 100

V10 01-09-2010 08:12

Re: [L4D2] Infected Spawn API
 
reserved

sxulocktor 01-13-2010 16:23

Re: [L4D2] Infected Spawn API
 
i dont understand... if i want to z_ghost_finale 1, and i have L4D2toolz, i dont need this plugin?

because when i set sm_cvar z_ghost_finale 1 the console says "no such cvar"

Sammy-ROCK! 01-13-2010 20:10

Re: [L4D2] Infected Spawn API
 
That convar is for servers with this extension running.

gamesfirst 01-13-2010 23:56

Re: [L4D2] Infected Spawn API
 
Quote:

Originally Posted by Sammy-ROCK! (Post 1054213)
That convar is for servers with this extension running.


but it says: "If you use l4d2toolz, no need to use my plugin for metamod."

should i use the sourcemod plugin instead? because it dont compiles.

ivailosp 01-14-2010 01:49

Re: [L4D2] Infected Spawn API
 
you dont need to use this only if you using l4dtoolz >= 1.0.0.9b

V10 01-14-2010 03:09

Re: [L4D2] Infected Spawn API
 
Quote:

Originally Posted by sxulocktor (Post 1054017)
i dont understand... if i want to z_ghost_finale 1, and i have L4D2toolz, i dont need this plugin?

because when i set sm_cvar z_ghost_finale 1 the console says "no such cvar"

Sorry, it's my error that I did not writen it in my first post
You should be use l4dtoolz posted here http://forums.alliedmods.net/showpos...&postcount=282 (or higher)
and cvar sv_force_normal_respawn

Downtown1 01-16-2010 05:47

Re: [L4D2] Infected Spawn API
 
Wrong

#define ZC_TANK 7

Right

#define ZC_TANK 8

V10 01-21-2010 02:45

Re: [L4D2] Infected Spawn API
 
Version updated, many features added. Added spawn ghosts in finale without any extension. Added function based on SDK to correct change zombie class. etc, see changelog. Infected_mm removed!

V10 01-21-2010 16:54

Re: [L4D2] Infected Spawn API
 
InfectedAPI.txt updated for linux, please check how working on it

AtomicStryker 01-21-2010 17:34

Re: [L4D2] Infected Spawn API
 
Why dont you fix up the Infected Bots Plugin? MI5 stopped working on it, and it seems like your kind of project ;)

V10 01-21-2010 18:31

Re: [L4D2] Infected Spawn API
 
Quote:

Originally Posted by AtomicStryker (Post 1062794)
Why dont you fix up the Infected Bots Plugin? MI5 stopped working on it, and it seems like your kind of project ;)

Probably no time.
But you can do it. =)

Downtown1 01-25-2010 03:04

Re: [L4D2] Infected Spawn API v1.3
 
Thanks for the OnEnterGhostState Windows signature, I used it in Left4Downtown 0.4.6 (it can also now remove auto spawns in finale) to save more than a few minutes!

Delroton 01-30-2010 10:19

Re: [L4D2] Infected Spawn API v1.3
 
Hi!
I'm new to mods and SM. But I have a question, is it possible to configure this into forcing hunter only spawns?

Thanks in advance

dirka_dirka 01-30-2010 11:38

Re: [L4D2] Infected Spawn API v1.3
 
if you only want hunters, just adjust the z_XXX_limit cvars so thats theres 0 boomers, smokers, etc and at least 4 hunters.

Delroton 01-30-2010 12:14

Re: [L4D2] Infected Spawn API v1.3
 
Quote:

Originally Posted by dirka_dirka (Post 1072947)
if you only want hunters, just adjust the z_XXX_limit cvars so thats theres 0 boomers, smokers, etc and at least 4 hunters.

That does not work! (If you've tested it personally and it did work for you please tell me, and I would know if its just my server.. )
Also tried setting the cvars to "-1". I guess 0 means infinite.

Marcus101RR 01-30-2010 19:29

Re: [L4D2] Infected Spawn API v1.3
 
Does this fix the amount of infected that can exist at one time?

V10 02-01-2010 21:51

Re: [L4D2] Infected Spawn API v1.3
 
Quote:

Originally Posted by Delroton (Post 1072849)
Hi!
I'm new to mods and SM. But I have a question, is it possible to configure this into forcing hunter only spawns?

Thanks in advance

See code of InfectedFixSpawn plugin http://forums.alliedmods.net/showthread.php?t=114954
for create plugin who changes class to hunter

AtomicStryker 02-21-2010 12:02

Re: [INC] L4D2 Infected Spawn API v1.3
 
PHP Code:

            /*  CTerrorPlayer::OnEnterGhostState(client)   */

            
"OnEnterGhostState"
            
{
                
"library"    "server"
                "windows"    "\x53\x55\x56\x8B\xF1\x8B\x86\xB0\x3A\x00\x00\x8B\x50\x0C\x8D\x8E" 
//found by V10
                
"linux"        "@_ZN13CTerrorPlayer17OnEnterGhostStateEv"

            


That sig is wrong, mate. In Bytes it is:

PHP Code:

53 55 56 8B F1 8B 86 B0 3A 00 00 8B 50 0C 8D 8E 

You have to leave wildcards at Bytes that may change - as they have in Valves last patch.

PHP Code:

53 55 56 8B F1 8B 86 ? ? ? ? 8B 50 8D 8E ? ? ? ? 57 

Take this here Sig:

PHP Code:

            /*  CTerrorPlayer::OnEnterGhostState(client)   */
            /* 53 55 56 8B F1 8B 86 ? ? ? ? 8B 50 ? 8D 8E ? ? ? ? 57 */

            
"OnEnterGhostState"
            
{
                
"library"    "server"
                "windows"    "\x53\x55\x56\x8B\xF1\x8B\x86\x2A\x2A\x2A\x2A\x8B\x50\x2A\x8D\x8E\x2A\x2A\x2A\x2A\x57"
                "linux"        "@_ZN13CTerrorPlayer17OnEnterGhostStateEv"
            



AtomicStryker 02-21-2010 12:42

Re: [INC] L4D2 Infected Spawn API v1.3
 
Addendum:

While that Sig is 100% correct, it appears Valve removed that function or it isnt loaded anymore. I suggest you update your API to only use default ghosting, even during finale.

Visual77 02-21-2010 13:25

Re: [INC] L4D2 Infected Spawn API v1.3
 
Those sigs has to be updated on http://forums.alliedmods.net/showthread.php?t=114954 aswell?

V10 02-25-2010 04:55

Re: [INC] L4D2 Infected Spawn API v1.3
 
Quote:

Originally Posted by AtomicStryker
While that Sig is 100% correct, it appears Valve removed that function or it isnt loaded anymore. I suggest you update your API to only use default ghosting, even during finale.

Now I no free time for it, after 01/03/10 I'll update api .
Temporary fix - remove from l4d2_InfectedSpawnApi.inc, from function InfectedForceGhost:
PHP Code:

    if (IsFinale() && !inFinaleAlso && !isGhostsFinale()) return false;
    
    if (
IsFinale() && !isGhostsFinale()) {
        new 
bool:result=InfectedForceGhostFinale(client);
        if (
result && SavePosTeleportEntity(clientAbsOriginEyeAnglesVelocity);    
        return 
result;
    } 

Quote:

Originally Posted by Visual77 (Post 1095718)
Those sigs has to be updated on http://forums.alliedmods.net/showthread.php?t=114954 aswell?

Sig "OnEnterGhostState" not used in Infected Fix plugin.

V10 04-20-2010 23:58

Re: [INC] [L4D2] Infected Spawn API v1.4
 
Version 1.4 released

V10 04-30-2010 03:13

Re: [INC] [L4D2] Infected Spawn API v1.5
 
Version 1.5 released, InfectedAPI.txt not updated, reuploaded only.

SilentBr 10-23-2010 04:41

Re: [INC] [L4D2] Infected Spawn API v1.5
 
1 Attachment(s)
NEW GAMEDATA BY V10

NOTE: I asked V10 if he could send the new version for us, and he agreed, he just wants help us. Thank you V10 for support our L4D2 servers.


RavenDan29 01-25-2011 21:30

Re: [INC] [L4D2] Infected Spawn API v1.5
 
Plugin file SampleInfectedAPI isnt compileing could you post the .smx please

asherkin 01-30-2011 10:45

Re: [INC] [L4D2] Infected Spawn API v1.5
 
Quote:

Originally Posted by RavenDan29 (Post 1399511)
Plugin file SampleInfectedAPI isnt compileing could you post the .smx please

Thats because it uses a custom include file.
You need to use the local compiler.

RavenDan29 07-24-2011 15:16

Re: [INC] [L4D2] Infected Spawn API v1.5
 
does this fix the weird inviseable charger bug?

carlos moschen 07-28-2011 10:53

Re: [INC] [L4D2] Infected Spawn API v1.5
 
@V10: if I put this plugin, the tanks are born with all maps??

Marcus101RR 09-30-2011 20:11

Re: [INC] [L4D2] Infected Spawn API v1.5
 
Does this allow/fix the two infected limit on L4D2 or will there still be only 2 infected at one time at any given time?

V10 12-25-2011 13:28

Re: [INC] [L4D2] Infected Spawn API v1.6
 
Updated, speed up optimizations.

mcpan313 12-25-2011 23:54

Re: [INC] [L4D2] Infected Spawn API v1.6
 
Quote:

Originally Posted by V10 (Post 1619485)
Updated, speed up optimizations.

thanks.:D

RavenDan29 12-27-2011 04:18

Re: [INC] [L4D2] Infected Spawn API v1.6
 
http://forums.alliedmods.net/images/attach/sp.gifGet Plugin or Get Source (SampleInfectedAPI.sp - 4 views - 1.4 KB) Plugin wont compile either by hitting get plugin or by downloading .sp then using sourcemod compiler please fix the link.

V10 12-27-2011 04:26

Re: [INC] [L4D2] Infected Spawn API v1.6
 
Quote:

Originally Posted by RavenDan29 (Post 1620344)
http://forums.alliedmods.net/images/attach/sp.gifGet Plugin or Get Source (SampleInfectedAPI.sp - 4 views - 1.4 KB) Plugin wont compile either by hitting get plugin or by downloading .sp then using sourcemod compiler please fix the link.

Its sample for developers
You can compile it locally only.

adrianman 12-27-2011 07:15

Re: [INC] [L4D2] Infected Spawn API v1.6
 
how can i make a tank spawn as selectable ghost for every tank_spawn event?

Glide Loading 12-27-2011 09:27

Re: [INC] [L4D2] Infected Spawn API v1.6
 
Searched about this almost everywhere but did not found an answer.
So here is the question: is any way to spawn the tank or witch "on the flow" (on ESCAPE_ROUTE nav-marker) ? I mean spawn on survivors path (like director doing it).

dcx2 07-06-2013 12:46

Re: [INC] [L4D2] Infected Spawn API v1.6
 
1 Attachment(s)
@V10, will you be fixing signatures?

Silvers found a few of them for a different plugin. https://forums.alliedmods.net/showpo...34&postcount=2

But we still need ZombieAbortControl and OnEnterGhostState

EDIT:

I found the signatures as well as the RefEHandle Offset. Here is updated gamedata.

V10 07-12-2013 01:16

Re: [INC] [L4D2] Infected Spawn API v1.6
 
Gamedata file has been updated for last L4D2 patch. Check it in first post.

V10 08-03-2013 17:10

Re: [INC] [L4D2] Infected Spawn API v1.6.1
 
Updated to 1.6.1:
- Fixed spawn command from z_spawn to z_spawn_old.

V10 08-04-2013 06:44

Re: [INC] [L4D2] Infected Spawn API v1.6.1
 
Reuploaded correct 1.6.1 version. Please redownload it.


All times are GMT -4. The time now is 18:25.

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