Adding all our changes under our main jupiter branch.

This commit is contained in:
mbalex
2008-10-04 23:02:25 +02:00
parent 01f65c9ee5
commit e615802bb9
13 changed files with 345 additions and 26 deletions

View File

@ -26,7 +26,10 @@ enum ZR_ClassOptions
Float:data_napalm_time,
bool:data_nofalldamage,
data_kill_bonus,
data_infect_health
data_infect_health,
data_alpha_spawn,
data_alpha_damaged,
data_alpha_damage
}
#define MAXCLASSES 20
@ -104,6 +107,9 @@ LoadClassData()
arrayClasses[classCount][data_nofalldamage] = bool:KvGetNum(kvClasses, "nofalldamage"), GetConVarBool(gCvars[CVAR_ZOMBIE_NOFALLDAMAGE]);
arrayClasses[classCount][data_kill_bonus] = KvGetNum(kvClasses, "kill_bonus"), GetConVarInt(gCvars[CVAR_ZOMBIE_KILL_BONUS]);
arrayClasses[classCount][data_infect_health] = KvGetNum(kvClasses, "infect_health"), GetConVarInt(gCvars[CVAR_ZOMBIE_INFECT_HEALTH]);
arrayClasses[classCount][data_alpha_spawn] = KvGetNum(kvClasses, "alpha_spawn");
arrayClasses[classCount][data_alpha_damaged] = KvGetNum(kvClasses, "alpha_damaged");
arrayClasses[classCount][data_alpha_damage] = KvGetNum(kvClasses, "alpha_damage");
classCount++;
} while (KvGotoNextKey(kvClasses));
@ -178,7 +184,7 @@ Float:GetClassKnockback(classindex)
new bool:classes = GetConVarBool(gCvars[CVAR_CLASSES]);
if (classes)
{
return arrayClasses[classindex][data_knockback];
return arrayClasses[classindex][data_knockback] * GetConVarFloat(gCvars[CVAR_ZOMBIE_KNOCKBACK]);
}
return GetConVarFloat(gCvars[CVAR_ZOMBIE_KNOCKBACK]);
@ -292,4 +298,35 @@ GetClassInfectHealth(classindex)
}
return GetConVarInt(gCvars[CVAR_ZOMBIE_INFECT_HEALTH]);
}
}
GetClassAlphaSpawn(classindex)
{
new bool:classes = GetConVarBool(gCvars[CVAR_CLASSES]);
if (classes) {
return arrayClasses[classindex][data_alpha_spawn];
}
return 255;
}
GetClassAlphaDamaged(classindex)
{
new bool:classes = GetConVarBool(gCvars[CVAR_CLASSES]);
if (classes) {
return arrayClasses[classindex][data_alpha_damaged];
}
return 255;
}
GetClassAlphaDamage(classindex)
{
new bool:classes = GetConVarBool(gCvars[CVAR_CLASSES]);
if (classes) {
return arrayClasses[classindex][data_alpha_damage];
}
return 0;
}

View File

@ -24,8 +24,11 @@ new gHooks[MAXPLAYERS+1][ZRHooks];
InitDmgControl()
{
/* It's case sensitive! */
RegConsoleCmd("kill", Attempt_Suicide);
RegConsoleCmd("KILL", Attempt_Suicide);
RegConsoleCmd("jointeam", Attempt_Suicide);
RegConsoleCmd("JOINTEAM", Attempt_Suicide);
RegConsoleCmd("spectate", Attempt_Suicide);
}
@ -45,7 +48,7 @@ public TraceAttack(client, inflictor, attacker, damage, hitbox, hitgroup)
{
new bool:enabled = GetConVarBool(gCvars[CVAR_ENABLE]);
if (!attacker || !IsClientInGame(attacker) || !enabled)
if (!attacker || !IsClientConnected(attacker) || !IsClientInGame(attacker) || !enabled)
{
return Hacks_Continue;
}

View File

@ -214,6 +214,8 @@ public Action:PlayerSpawn(Handle:event, const String:name[], bool:dontBroadcast)
if (!StrEqual(respawnteam, "zombie", false))
{
SetPlayerAlpha(index, 0);
SetPlayerSpeed(index, 600.0);
pProtect[index] = true;
ZR_PrintToChat(index, "Spawn protection begin", protect);
@ -224,10 +226,18 @@ public Action:PlayerSpawn(Handle:event, const String:name[], bool:dontBroadcast)
CloseHandle(tHandles[index][TPROTECT]);
}
tHandles[index][TPROTECT] = CreateTimer(float(protect), EndProtect, index, TIMER_FLAG_NO_MAPCHANGE);
protCount[index] = protect;
PrintHintText(index, "%d", protCount[index]);
protCount[index]--;
tHandles[index][TPROTECT] = CreateTimer(1.0, EndProtect, index, TIMER_FLAG_NO_MAPCHANGE|TIMER_REPEAT);
}
}
}
else
{
SetPlayerAlpha(index, 255);
}
new bool:randomclass = GetConVarBool(gCvars[CVAR_CLASSES_RANDOM]);
@ -278,7 +288,7 @@ public Action:PlayerHurt(Handle:event, const String:name[], bool:dontBroadcast)
{
if (IsPlayerHuman(index) && IsPlayerZombie(attacker))
{
if (StrEqual(weapon, "knife"))
if (!pProtect[index] && StrEqual(weapon, "knife"))
{
Zombify(index, attacker);
}
@ -346,6 +356,8 @@ public Action:PlayerHurt(Handle:event, const String:name[], bool:dontBroadcast)
tHandles[index][TREGEN] = CreateTimer(interval, Regenerate, index, TIMER_REPEAT);
}
}
UpdateAlphaDamaged(index);
}
FindExplodingGrenade(Float:heLoc[3])

View File

@ -17,6 +17,8 @@ new offsCollision;
new offsMoney;
new offsFOV;
new offsBuyZone;
new offsColor;
new offsRender;
new Handle:hGameConf = INVALID_HANDLE;
new Handle:hRemoveAllItems = INVALID_HANDLE;
@ -89,6 +91,16 @@ FindOffsets()
{
SetFailState("Couldn't find \"m_bInBuyZone\"!");
}
offsColor = FindSendPropInfo("CAI_BaseNPC", "m_clrRender");
if(offsColor == -1) {
SetFailState("Couldn't find \"m_clrRender\"!");
}
offsRender = FindSendPropInfo("CBaseAnimating", "m_nRenderMode");
if(offsRender == -1) {
SetFailState("Couldn't find \"m_nRenderMode\"!");
}
}
SetupGameData()
@ -187,4 +199,11 @@ SetPlayerModel(client, const String:model[])
{
PrecacheModel(model);
SetEntityModel(client, model);
}
}
SetPlayerAlpha(client, alpha)
{
SetEntData(client, offsColor + 3, alpha, 1, true);
SetEntData(client, offsRender, 3, 1, true);
}

View File

@ -28,43 +28,36 @@ public Action:SayCommand(client, argc)
if (StrEqual(args, "!zmenu", false))
{
MainMenu(client);
return Plugin_Handled;
}
else if (StrEqual(args, "!zclass", false))
{
ZClass(client);
return Plugin_Handled;
}
else if (StrEqual(args, "!zmarket", false))
{
ZMarket(client);
return Plugin_Handled;
}
else if (StrEqual(args, "!zspawn", false))
{
ZSpawn(client);
return Plugin_Handled;
}
else if (StrEqual(args, "!ztele", false))
{
ZTele(client);
return Plugin_Handled;
}
else if (StrEqual(args, "!zstuck", false))
{
ZStuck(client);
return Plugin_Handled;
}
else if (StrEqual(args, "!zhp", false))
{
ZHP(client);
return Plugin_Handled;
}
return Plugin_Continue;

View File

@ -178,6 +178,8 @@ Zombify_Mother(client)
ApplyZombieModel(client);
ApplyZombieAlpha(client);
InfectionEffects(client);
ZR_PrintToChat(client, "You are a zombie");
@ -255,6 +257,8 @@ Zombify(client, attacker)
ApplyZombieModel(client);
ApplyZombieAlpha(client);
if (bZVision[client])
{
StartZVision(client);
@ -404,6 +408,12 @@ ApplyZombieFOV(client)
SetPlayerFOV(client, fov);
}
ApplyZombieAlpha(client)
{
new alpha = GetClassAlphaSpawn(pClass[client]);
SetPlayerAlpha(client, alpha);
}
KnockBack(client, const Float:clientloc[3], const Float:attackerloc[3], Float:power, dmg, bool:boost)
{
if (!IsPlayerZombie(client))
@ -443,7 +453,7 @@ JumpBoost(client, Float:distance, Float:height)
PlayerLeft(client)
{
if (!IsClientInGame(client))
if (!IsClientConnected(client) || !IsClientInGame(client))
{
return;
}
@ -788,6 +798,18 @@ UpdateHPDisplay(client)
ZR_HudHint(client, "Display HP", health);
}
UpdateAlphaDamaged(client)
{
new current_health = GetClientHealth(client);
new max_health = GetClassHealth(pClass[client]);
new max_damage = GetClassAlphaDamage(pClass[client]);
if (max_health - current_health > max_damage)
{
new alpha_damaged = GetClassAlphaDamaged(pClass[client]);
SetPlayerAlpha(client, alpha_damaged);
}
}
public Action:ZHPTimer(Handle:timer, any:index)
{
if (!IsClientInGame(index))
@ -807,18 +829,29 @@ public Action:EndProtect(Handle:timer, any:index)
if (!IsClientInGame(index))
{
tHandles[index][TPROTECT] = INVALID_HANDLE;
return;
return Plugin_Stop;
}
pProtect[index] = false;
if (protCount[index] > 0) {
PrintHintText(index, "%d", protCount[index]);
protCount[index]--;
return Plugin_Continue;
} else {
pProtect[index] = false;
if (IsPlayerHuman(index))
{
ZR_PrintCenterText(index, "Spawn protection end");
if (IsPlayerHuman(index))
{
ZR_PrintCenterText(index, "Spawn protection end");
}
SetPlayerAlpha(index, 255);
SetPlayerSpeed(index, 300.0);
tHandles[index][TPROTECT] = INVALID_HANDLE;
return Plugin_Stop;
}
tHandles[index][TPROTECT] = INVALID_HANDLE;
}
RespawnPlayer(client)
@ -884,4 +917,4 @@ ZTeam:GetPlayerZTeam(client)
}
return Human;
}
}

View File

@ -50,6 +50,7 @@ new pClass[MAXPLAYERS+1];
new pNextClass[MAXPLAYERS+1];
new teleCount[MAXPLAYERS+1];
new protCount[MAXPLAYERS+1];
new Float:spawnLoc[MAXPLAYERS+1][3];
new Handle:tRound = INVALID_HANDLE;