Quote:
Originally Posted by Mikado
And one last thing, please can you help me to make zombie madness as an extra item & extra item buy survivor/nemesis round ?
Thank you .
|
this one is for old version but you can try it
PHP Code:
#include <sourcemod>
#include <sdktools>
#include <sdkhooks>
#include <zombieplague>
#define EXTRA_ITEM_NAME "Zombie Madness" // If string has @, phrase will be taken from translation file. For example: "@AK47" require translation block, "AK47" not require
#define EXTRA_ITEM_COST 22 // Ammopacks cost
#define EXTRA_ITEM_LEVEL 0 // The level of the player, which allow to buy item. ['0' = off]
#define EXTRA_ITEM_ONLINE 0 // The number of players, which allowed to buy item. ['0' = off]
#define EXTRA_ITEM_LIMIT 0 // The number of purchases, which allowed per round for player. ['0' = off]
int iItem;
bool gMadnessUsed[MAXPLAYERS+1];
ConVar gMadnessTime;
public OnPluginStart()
{
iItem = ZP_RegisterExtraItem(EXTRA_ITEM_NAME, EXTRA_ITEM_COST, ZP_TEAM_ZOMBIE, EXTRA_ITEM_LEVEL, EXTRA_ITEM_ONLINE, EXTRA_ITEM_LIMIT);
gMadnessTime = CreateConVar("zp_madness_time", "2.0", "Time of having madness.");
AutoExecConfig(true, "zombieplague_madness");
}
public void OnMapStart(/*void*/)
{
// Sounds
FakePrecacheSound("zbm3/extra_item_zombie_madness.mp3");
}
public void ZP_OnClientInfected(int clientIndex, int infectorIndex)
{
gMadnessUsed[clientIndex] = false;
}
public void ZP_OnClientHeroed(int clientIndex)
{
gMadnessUsed[clientIndex] = false;
}
public Action ZP_OnExtraBuyCommand(int clientIndex, int extraitemIndex)
{
// Verify that the client is connected and alive
if(!IsPlayerExist(clientIndex))
{
return Plugin_Handled;
}
if(extraitemIndex == iItem)
{
gMadnessUsed[clientIndex] = true;
SetEntityRenderMode(clientIndex, RENDER_TRANSCOLOR);
SetEntityRenderColor(clientIndex, 236, 0, 140, 255);
EmitSoundToAll("*/zbm3/extra_item_zombie_madness.mp3", clientIndex, SNDCHAN_VOICE, SNDLEVEL_SCREAMING);
CreateTimer(GetConVarFloat(gMadnessTime), EventRemoveMadness, clientIndex, TIMER_FLAG_NO_MAPCHANGE);
}
// Allow buying
return Plugin_Continue;
}
public Action EventRemoveMadness(Handle hTimer, any clientIndex)
{
// Verify that the client is exist
if(!IsPlayerExist(clientIndex))
{
return Plugin_Stop;
}
// If player have it, reset ammo
if(gMadnessUsed[clientIndex])
{
gMadnessUsed[clientIndex] = false;
SetEntityRenderMode(clientIndex, RENDER_TRANSCOLOR);
SetEntityRenderColor(clientIndex, 255, 255, 255, 255);
}
// Destroy timer
return Plugin_Stop;
}
public Action DamageTraceAttack(int iVictim, int &iAttacker, int &Inflictor, float &damage, int &pDamageBits, int &iAmmoType, int iHitBox, int iHitGroup)
{
// If player used tank skill
if (ZP_IsPlayerZombie(iVictim) && gMadnessUsed[iVictim])
{
return Plugin_Handled;
}
// Allow trace
return Plugin_Continue;
}
public void OnClientPostAdminCheck(int clientIndex)
{
SDKHook(clientIndex, SDKHook_TraceAttack, DamageTraceAttack);
}