added SharedPlugin code and SetNTVOptional()

added public printing for zr_human, zr_infect and zr_zspawn_force command
fixed zombiereloaded changing player colors
updated sample cfg
updated makefile
This commit is contained in:
BotoX 2016-04-22 01:24:10 +02:00
parent a732205f8c
commit 2d1cdf7a36
12 changed files with 218 additions and 13 deletions

View File

@ -3,10 +3,11 @@
SOURCEDIR=src
SMINCLUDES=env/include
ZRINCLUDES=src/include
BUILDDIR=build
SPCOMP_LINUX=env/linux/bin/spcomp-1.7.0
SPCOMP_DARWIN=env/darwin/bin/spcomp-1.7.0
DOS2UNIX_LINUX=dos2unix -p
DOS2UNIX_LINUX=dos2unix
DOS2UNIX_DARWIN=env/darwin/bin/dos2unix -p
VERSIONDUMP=./updateversion.sh
@ -32,9 +33,10 @@ prepare: prepare_newlines prepare_builddir
prepare_newlines:
@echo "Removing windows newlines"
@find $(SOURCEDIR) -name \*.inc -exec $(DOS2UNIX) '{}' \;
@find $(SOURCEDIR) -name \*.sp -exec $(DOS2UNIX) '{}' \;
@find $(SMINCLUDES) -name \*.inc -exec $(DOS2UNIX) '{}' \;
@find $(SOURCEDIR) -name \*.inc -exec $(DOS2UNIX) "{}" \;
@find $(SOURCEDIR) -name \*.sp -exec $(DOS2UNIX) "{}" \;
@find $(SMINCLUDES) -name \*.inc -exec $(DOS2UNIX) "{}" \;
@find $(ZRINCLUDES) -name \*.inc -exec $(DOS2UNIX) "{}" \;
prepare_builddir:
@echo "Creating build directory"
@ -42,7 +44,7 @@ prepare_builddir:
%.smx: %.sp
$(VERSIONDUMP)
$(SPCOMP) -i$(SOURCEDIR) -i$(SMINCLUDES) -o$(BUILDDIR)/$@ $<
$(SPCOMP) -i$(SOURCEDIR) -i$(SMINCLUDES) -i$(ZRINCLUDES) -o$(BUILDDIR)/$@ $<
clean:
@echo "Removing build directory"

View File

@ -418,11 +418,21 @@
"es" "El jugador @green{1} @defaultha sido infectado con exito."
}
"Infect command infect successful public"
{
"es" "@lgreen{1}@default has infected @green{2}@default." // TODO: Translate
}
"Infect command infect mother successful"
{
"es" "El jugador @green{1} @defaultha sido infectado con exito como el zombi madre."
}
"Infect command infect mother successful public"
{
"es" "@lgreen{1}@default has infected @green{2}@default as the mother zombie." // TODO: Translate
}
"Infect command infect unsuccessful"
{
"es" "El jugador @green{1} @defaultya es un zombi."
@ -433,6 +443,11 @@
"es" "El jugador @green{1} @defaultha vuelto a ser humano con exito."
}
"Infect command human successful public"
{
"es" "@lgreen{1}@default has brought back @green{2}@default as a human." // TODO: Translate
}
"Infect command human unsuccessful"
{
"es" "El jugador @green{1} @defaultya es un humano."
@ -957,6 +972,11 @@
"es" "El jugador {1} ha sido resucitado correctamente."
}
"ZSpawn command force successful public"
{
"es" "@lgreen{1}@default has spawned @green{2}@default as a @lgreen{3}@default." // TODO: Translate
}
"ZSpawn command force unsuccessful"
{
"es" "El jugador {1} no pudo ser resucitado."

View File

@ -417,11 +417,21 @@
"no" "@green{1}@default ble vellykket infisert."
}
"Infect command infect successful public"
{
"no" "@lgreen{1}@default has infected @green{2}@default." // TODO: Translate
}
"Infect command infect mother successful"
{
"no" "@green{1}@default ble vellykket infisert som moderzombie."
}
"Infect command infect mother successful public"
{
"no" "@lgreen{1}@default has infected @green{2}@default as the mother zombie." // TODO: Translate
}
"Infect command infect unsuccessful"
{
"no" "@green{1}@default er allerede en zombie."
@ -432,6 +442,11 @@
"no" "@green{1}@default ble vellykket gjort om til et menneske."
}
"Infect command human successful public"
{
"no" "@lgreen{1}@default has brought back @green{2}@default as a human." // TODO: Translate
}
"Infect command human unsuccessful"
{
"no" "@green{1}@default er allerede et menneske."
@ -957,6 +972,11 @@
"no" "{1} ble vellykket gjenopplivet."
}
"ZSpawn command force successful public"
{
"no" "@lgreen{1}@default has spawned @green{2}@default as a @lgreen{3}@default." // TODO: Translate
}
"ZSpawn command force unsuccessful"
{
"no" "{1} kunne ikke bli gjenopplivet."

View File

@ -418,11 +418,21 @@
"ru" "Игрок @green{1}@default был успешно инфицирован."
}
"Infect command infect successful public"
{
"ru" "@lgreen{1}@default has infected @green{2}@default." // TODO: Translate
}
"Infect command infect mother successful"
{
"ru" "Игрок @green{1}@default был успешно инфицирован и стал первым зомби."
}
"Infect command infect mother successful public"
{
"ru" "@lgreen{1}@default has infected @green{2}@default as the mother zombie." // TODO: Translate
}
"Infect command infect unsuccessful"
{
"ru" "Игрок @green{1}@default уже является зомби."
@ -433,6 +443,11 @@
"ru" "Игрок @green{1}@default был успешно превращен обратно в человека."
}
"Infect command human successful public"
{
"ru" "@lgreen{1}@default has brought back @green{2}@default as a human." // TODO: Translate
}
"Infect command human unsuccessful"
{
"ru" "Игрок@green{1}@default уже является человеком."
@ -957,6 +972,11 @@
"ru" "Игрок {1} был успешно воскрешен."
}
"ZSpawn command force successful public"
{
"ru" "@lgreen{1}@default has spawned @green{2}@default as a @lgreen{3}@default." // TODO: Translate
}
"ZSpawn command force unsuccessful"
{
"ru" "Игрок {1} не может быть воскрешен."

View File

@ -436,12 +436,24 @@
"en" "Player @green{1} @defaulthas been successfully infected."
}
"Infect command infect successful public"
{
"#format" "{1:s},{2:s}"
"en" "@lgreen{1}@default has infected @green{2}@default."
}
"Infect command infect mother successful"
{
"#format" "{1:s}"
"en" "Player @green{1} @defaulthas been successfully infected as the mother zombie."
}
"Infect command infect mother successful public"
{
"#format" "{1:s},{2:s}"
"en" "@lgreen{1}@default has infected @green{2}@default as the mother zombie."
}
"Infect command infect unsuccessful"
{
"#format" "{1:s}"
@ -454,6 +466,12 @@
"en" "Player @green{1} @defaulthas been successfully brought back as a human."
}
"Infect command human successful public"
{
"#format" "{1:s},{2:s}"
"en" "@lgreen{1}@default has brought back @green{2}@default as a human."
}
"Infect command human unsuccessful"
{
"#format" "{1:s}"
@ -1015,6 +1033,12 @@
"en" "Player {1} was successfully spawned."
}
"ZSpawn command force successful public"
{
"#format" "{1:s},{2:s},{3:s}"
"en" "@lgreen{1}@default has spawned @green{2}@default as a @lgreen{3}@default."
}
"ZSpawn command force unsuccessful"
{
"#format" "{1:s}"

View File

@ -269,10 +269,18 @@ zr_weapons_zmarket_buyzone "1"
// Default: "1"
zr_weapons_zmarket_rebuy "1"
// Allow players to automatically rebuy their previous weapons. [Dependency: zr_weapons_zmarket&zr_weapons_zmarket_rebuy]
// Automatically equip default or loadout weapons. [Dependency: zr_weapons_zmarket&zr_weapons_zmarket_rebuy]
// Default: "1"
zr_weapons_zmarket_rebuy_auto "1"
// Default primary weapon. [Dependency: zr_weapons_zmarket&zr_weapons_zmarket_rebuy]
// Default: "P90"
zr_weapons_zmarket_rebuy_primary "P90"
// Default secondary weapon. [Dependency: zr_weapons_zmarket&zr_weapons_zmarket_rebuy]
// Default: "Elite"
zr_weapons_zmarket_rebuy_secondary "Elite"
// ----------------------------------------------------------------------------
// Hitgroups (core)

View File

@ -34,3 +34,34 @@
#include <zr/infect.zr>
#include <zr/respawn.zr>
#include <zr/class.zr>
public SharedPlugin:__pl_zombiereloaded =
{
name = "zombiereloaded",
file = "zombiereloaded.smx",
#if defined REQUIRE_PLUGIN
required = 1
#else
required = 0
#endif
};
#if !defined REQUIRE_PLUGIN
public __pl_zombiereloaded_SetNTVOptional()
{
MarkNativeAsOptional("ZR_IsValidClassIndex");
MarkNativeAsOptional("ZR_GetActiveClass");
MarkNativeAsOptional("ZR_SelectClientClass");
MarkNativeAsOptional("ZR_GetClassByName");
MarkNativeAsOptional("ZR_GetClassDisplayName");
MarkNativeAsOptional("ZR_IsClientZombie");
MarkNativeAsOptional("ZR_IsClientHuman");
MarkNativeAsOptional("ZR_InfectClient");
MarkNativeAsOptional("ZR_HumanClient");
MarkNativeAsOptional("ZR_RespawnClient");
MarkNativeAsOptional("ZR_SetKilledByWorld");
MarkNativeAsOptional("ZR_GetKilledByWorld");
}
#endif

View File

@ -38,12 +38,14 @@
/**
* Results when selecting a class for a player.
*/
#if !defined INCLUDED_BY_ZOMBIERELOADED
enum ClassSelectResult
{
ClassSelected_NoChange, /** No class change was necessary (class already selected). */
ClassSelected_Instant, /** Class was instantly changed. */
ClassSelected_NextSpawn /** Class will be used next spawn. */
}
#endif
/**
* Returns whether a class index is valid or not.

View File

@ -33,6 +33,9 @@
#include <sdktools>
#include <clientprefs>
#include <cstrike>
#define INCLUDED_BY_ZOMBIERELOADED
#include <zombiereloaded>
#undef INCLUDED_BY_ZOMBIERELOADED
#if defined USE_SDKHOOKS
#include <sdkhooks>
@ -145,6 +148,9 @@ public APLRes:AskPluginLoad2(Handle:myself, bool:late, String:error[], err_max)
// Load API.
APIInit();
// Register library
RegPluginLibrary("zombiereloaded");
// Let plugin load.
return APLRes_Success;
}

View File

@ -284,8 +284,7 @@ InfectOnClientSpawn(client)
CS_RespawnPlayer(client);
}
// Unglitch kevlar. (Reset hitbox to HITBOX_GENERIC)
SetEntData(client, 4444, 0, 4);
InfectUnglitchKevlar(client);
}
/**
@ -875,8 +874,7 @@ InfectZombieToHuman(client, bool:respawn = false, bool:protect = false)
SpawnProtectStart(client);
}
// Unglitch kevlar. (Reset hitbox to HITBOX_GENERIC)
SetEntData(client, 4444, 0, 4);
InfectUnglitchKevlar(client);
// Forward event to modules.
SEffectsOnClientHuman(client);
@ -1185,6 +1183,13 @@ stock InfectManualInfect(client, targets[], count, bool:respawnoverride = false,
}
decl String:targetname[MAX_NAME_LENGTH];
decl String:adminname[MAX_NAME_LENGTH];
// Get admin's name for later use.
if(client > 0)
GetClientName(client, adminname, sizeof(adminname));
else
strcopy(adminname, sizeof(adminname), "Console");
// x = Client index.
for (new x = 0; x < count; x++)
@ -1211,6 +1216,7 @@ stock InfectManualInfect(client, targets[], count, bool:respawnoverride = false,
// Turn client into a mother zombie.
InfectHumanToZombie(targets[x], _, true, respawnoverride, respawn);
LogAction(client, targets[x], "\"%L\" turned \"%L\" into a mother zombie", client, targets[x]);
TranslationPrintToChatAll(false, false, "Infect command infect mother successful public", adminname, targetname);
// If there was only 1 player targetted, then let admin know the outcome of the command.
if (count == 1)
@ -1224,6 +1230,7 @@ stock InfectManualInfect(client, targets[], count, bool:respawnoverride = false,
// Turn client into a zombie.
InfectHumanToZombie(targets[x], _, false, respawnoverride, respawn);
LogAction(client, targets[x], "\"%L\" turned \"%L\" into a zombie", client, targets[x]);
TranslationPrintToChatAll(false, false, "Infect command infect successful public", adminname, targetname);
// If there was only 1 player targetted, then let admin know the outcome of the command.
if (count == 1)
@ -1245,6 +1252,13 @@ stock InfectManualInfect(client, targets[], count, bool:respawnoverride = false,
stock InfectManualHuman(client, targets[], count, bool:respawn = false, bool:protect = false)
{
decl String:targetname[MAX_NAME_LENGTH];
decl String:adminname[MAX_NAME_LENGTH];
// Get admin's name for later use.
if(client > 0)
GetClientName(client, adminname, sizeof(adminname));
else
strcopy(adminname, sizeof(adminname), "Console");
// x = Client index.
for (new x = 0; x < count; x++)
@ -1258,6 +1272,7 @@ stock InfectManualHuman(client, targets[], count, bool:respawn = false, bool:pro
// Turn client into a zombie.
InfectZombieToHuman(targets[x], respawn, protect);
LogAction(client, targets[x], "\"%L\" turned \"%L\" into a human", client, targets[x]);
TranslationPrintToChatAll(false, false, "Infect command human successful public", adminname, targetname);
// If there was only 1 player targetted, then let admin know the outcome of the command.
if (count == 1)
@ -1486,3 +1501,14 @@ InfectMode:InfectGetModeOrFail()
return mode;
}
InfectUnglitchKevlar(client)
{
// Unglitch kevlar. (Reset hitbox to HITBOX_GENERIC)
// Example: You get hit in the head by a bullet as a zombie
// the round ends, you spawn as a human.
// You get damaged by a trigger, the game still thinks you
// are getting damaged in the head hitgroup, >mfw source engine.
// Thanks to leaked 2007 Source Engine Code.
SetEntData(client, 4444, 0, 4);
}

View File

@ -194,8 +194,12 @@ stock ToolsSetClientAlpha(client, alpha)
// Turn rendermode on, on the client.
SetEntityRenderMode(client, RENDER_TRANSALPHA);
// Get current client colors.
new color[4];
ToolsGetEntityColor(client, color);
// Set alpha value on the client.
SetEntityRenderColor(client, _, _, _, alpha);
SetEntityRenderColor(client, color[0], color[1], color[2], alpha);
// Forward event to modules.
WeaponAlphaOnClientAlphaChanged(client, alpha);
@ -230,3 +234,34 @@ stock ToolsGetEntityAlpha(entity)
return GetEntData(entity, offset + 3, 1);
}
/**
* Gets an entity's color and alpha.
*
* @param client The client index.
* @param color 4 dimensional array where [r,g,b,a] values are stored
*/
stock ToolsGetEntityColor(entity, color[4])
{
static bool:gotconfig = false;
static String:prop[32];
if (!gotconfig)
{
new Handle:gc = LoadGameConfigFile("core.games");
new bool:exists = GameConfGetKeyValue(gc, "m_clrRender", prop, sizeof(prop));
CloseHandle(gc);
if (!exists)
{
strcopy(prop, sizeof(prop), "m_clrRender");
}
gotconfig = true;
}
new offset = GetEntSendPropOffs(entity, prop);
for (new i = 0; i < 4; i++)
color[i] = GetEntData(entity, offset + i, 1);
}

View File

@ -412,12 +412,18 @@ public Action:ZSpawnForceCommand(client, argc)
return Plugin_Handled;
}
decl String:target[MAX_NAME_LENGTH], String:targetname[MAX_NAME_LENGTH];
decl String:target[MAX_NAME_LENGTH], String:targetname[MAX_NAME_LENGTH], String:adminname[MAX_NAME_LENGTH];
new targets[MAXPLAYERS], bool:tn_is_ml, result;
// Get targetname.
GetCmdArg(1, target, sizeof(target));
// Get admin's name for later use.
if(client > 0)
GetClientName(client, adminname, sizeof(adminname));
else
strcopy(adminname, sizeof(adminname), "Console");
// Find a target.
result = ProcessTargetString(target, client, targets, sizeof(targets), COMMAND_FILTER_DEAD, targetname, sizeof(targetname), tn_is_ml);
@ -441,7 +447,12 @@ public Action:ZSpawnForceCommand(client, argc)
{
// Give client the item.
new bool:success = ZSpawnClient(targets[x], true, zombie);
LogAction(client, targets[x], "\"%L\" forced a ZSpawn on \"%L\"%s", client, targets[x], zombie ? " and made them zombie" : "");
if(success)
{
LogAction(client, targets[x], "\"%L\" forced a ZSpawn on \"%L\"%s", client, targets[x], zombie ? " and made them zombie" : "");
TranslationPrintToChatAll(false, false, "ZSpawn command force successful public", adminname, targetname, zombie ? "zombie" : "human");
}
// Tell admin the outcome of the command if only 1 client was targetted.
if (result == 1)