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

[INC] [L4D2] Infected Spawn API v1.6.1


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
V10
Senior Member
Join Date: Jan 2010
Location: Russia
Old 01-09-2010 , 06:54   [INC] [L4D2] Infected Spawn API v1.6.1
Reply With Quote #1

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
Attached Files
File Type: sp Get Plugin or Get Source (SampleInfectedAPI.sp - 1921 views - 1.4 KB)
File Type: txt InfectedAPI.txt (1.6 KB, 1407 views)
File Type: inc l4d2_InfectedSpawnApi.inc (16.3 KB, 1579 views)
__________________
Sry for my english.
I good speak on russian =)

Last edited by V10; 08-04-2013 at 06:44. Reason: new version
V10 is offline
V10
Senior Member
Join Date: Jan 2010
Location: Russia
Old 01-09-2010 , 08:12   Re: [L4D2] Infected Spawn API
Reply With Quote #2

reserved

Last edited by V10; 04-30-2010 at 03:20.
V10 is offline
sxulocktor
Member
Join Date: Jul 2009
Old 01-13-2010 , 16:23   Re: [L4D2] Infected Spawn API
Reply With Quote #3

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"
sxulocktor is offline
Sammy-ROCK!
Senior Member
Join Date: Jun 2008
Location: Near Mrs.Lag
Old 01-13-2010 , 20:10   Re: [L4D2] Infected Spawn API
Reply With Quote #4

That convar is for servers with this extension running.
Sammy-ROCK! is offline
gamesfirst
Junior Member
Join Date: Aug 2009
Old 01-13-2010 , 23:56   Re: [L4D2] Infected Spawn API
Reply With Quote #5

Quote:
Originally Posted by Sammy-ROCK! View Post
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.
gamesfirst is offline
ivailosp
Senior Member
Join Date: Feb 2009
Old 01-14-2010 , 01:49   Re: [L4D2] Infected Spawn API
Reply With Quote #6

you dont need to use this only if you using l4dtoolz >= 1.0.0.9b
ivailosp is offline
V10
Senior Member
Join Date: Jan 2010
Location: Russia
Old 01-14-2010 , 03:09   Re: [L4D2] Infected Spawn API
Reply With Quote #7

Quote:
Originally Posted by sxulocktor View Post
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
V10 is offline
Downtown1
Veteran Member
Join Date: Mar 2004
Old 01-16-2010 , 05:47   Re: [L4D2] Infected Spawn API
Reply With Quote #8

Wrong

#define ZC_TANK 7

Right

#define ZC_TANK 8
Downtown1 is offline
V10
Senior Member
Join Date: Jan 2010
Location: Russia
Old 01-21-2010 , 02:45   Re: [L4D2] Infected Spawn API
Reply With Quote #9

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!

Last edited by V10; 01-21-2010 at 03:55.
V10 is offline
V10
Senior Member
Join Date: Jan 2010
Location: Russia
Old 01-21-2010 , 16:54   Re: [L4D2] Infected Spawn API
Reply With Quote #10

InfectedAPI.txt updated for linux, please check how working on it
V10 is offline
Reply


Thread Tools
Display Modes

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 05:20.


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