Skip to content

Commit

Permalink
X.038 & X.039
Browse files Browse the repository at this point in the history
  • Loading branch information
qubka committed Jul 29, 2020
1 parent 047e90b commit 7c55343
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 38 deletions.
16 changes: 8 additions & 8 deletions gamedata/plugin.zombieplague.txt
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,8 @@
"CCSPlayer::SetProgressBarTime" // Str: "Hostage.CutFreeWithoutDefuser"
{
"library" "server"
"windows" "\x55\x8B\xEC\x51\x53\x8B\xD9\x56\x57\x8B\x7D\x08\x39\xBB\xE8\x27\x00\x00"
"linux" "\x55\x89\xE5\x83\xEC\x48\x89\x5D\xF4\x8B\x5D\x08\x89\x75\xF8\x8B\x75\x0C\x89\x7D\xFC\x39\xB3\x00\x28\x00\x00"
"windows" "\x55\x8B\xEC\x51\x53\x8B\xD9\x56\x57\x8B\x7D\x08\x39\xBB\x08\x28\x00\x00"
"linux" "\x55\x89\xE5\x83\xEC\x48\x89\x5D\xF4\x8B\x5D\x08\x89\x75\xF8\x8B\x75\x0C\x89\x7D\xFC\x39\xB3\x20\x28\x00\x00"
}
"CItemGeneration::SpawnItem" // Str: "Can't init %s\n"
{
Expand All @@ -200,14 +200,14 @@
"FX_FireBullets" // Str: "FX_FireBullets"
{
"library" "server"
"windows" "\x55\x8B\xEC\x83\xE4\xF8\x81\xEC\x40\x02\x00\x00"
"linux" "\x55\x89\xE5\x57\x56\x53\x81\xEC\x9C\x02\x00\x00\x8B\x5D\x10"
"windows" "\x55\x8B\xEC\x83\xE4\xF8\x81\xEC\xE0\x01\x00\x00"
"linux" "\x55\x89\xE5\x57\x56\x53\x81\xEC\xBC\x02\x00\x00\x8B\x5D\x10"
}
"FX_Disarm" // Str: "Gloves.Swish"
{
"library" "server"
"linux" "\x55\x89\xE5\x57\x56\x53\x81\xEC\x3C\x07\x00\x00\x0F\xB6\x45\x0C"
"windows" "\x55\x8B\xEC\x83\xE4\xF8\x81\xEC\x00\x06\x00\x00"
"linux" "\x55\x89\xE5\x57\x56\x53\x81\xEC\x7C\x07\x00\x00"
"windows" "\x55\x8B\xEC\x83\xE4\xF8\x81\xEC\x20\x06\x00\x00"
}

/*___________________________________________________________________________________________*/
Expand All @@ -221,7 +221,7 @@
{
"library" "server"
"windows" "\x55\x8B\xEC\x51\x56\x57\x8B\xF9\x33\xF6\x8B\x47\x58"
"linux" "\x55\x89\xE5\x57\x56\x53\x83\xEC\x2C\x8B\x7D\x08\x8B\x47\x58\x85\xC0"
"linux" "\x55\xBA\x2A\x2A\x2A\x2A\xB9\x30\x00\x00\x00\x89\xE5\x31\xC0"
}
"CParticleSystemDefinition::ParseChildren" // Str: "DmeParticleSystemDefinition" and "children" and "preventNameBasedLookup"
{
Expand Down Expand Up @@ -253,7 +253,7 @@
"ServerClassInit<DT_BasePlayer::ignored>" // Str: "DT_BasePlayer"
{
"library" "server"
"windows" "\x55\x8B\xEC\x83\xE4\xF8\x51\xA1\x2A\x2A\x2A\x2A\x53\x56\x57\xA8\x01\x0F\x85\x2A\x2A\x2A\x2A\x83\xC8\x01\xB9\x2A\x2A\x2A\x2A\xA3\x2A\x2A\x2A\x2A\xE8\x2A\x2A\x2A\x2A\xB9\x2A\x2A\x2A\x2A\xC7\x05\x2A\x2A\x2A\x2A\x00\x00\x00\x00\xC7\x05\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\xC7\x05\x2A\x2A\x2A\x2A\x00\x00\x00\x00\xC7\x05\x2A\x2A\x2A\x2A\x20\x00\x00\x00\xC7\x05\x2A\x2A\x2A\x2A\x00\x00\x00\x00\xC7\x05\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\xC6\x05\x2A\x2A\x2A\x2A\x80\xE8\x2A\x2A\x2A\x2A\xB9\x2A\x2A\x2A\x2A\xC7\x05\x2A\x2A\x2A\x2A\x06\x00\x00\x00\xC7\x05\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\xC7\x05\x2A\x2A\x2A\x2A\x00\x00\x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2A\xB9\x2A\x2A\x2A\x2A\xC7\x05\x2A\x2A\x2A\x2A\x06\x00\x00\x00\xC7\x05\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\xC7\x05\x2A\x2A\x2A\x2A\x54\x0C\x00\x00"
"linux" "\x55\x89\xE5\x53\x81\xEC\xA4\x00\x00\x00\x80\x3D\x2A\x2A\x2A\x2A\x00\x75\x2A\xC7\x04\x24\x2A\x2A\x2A\x2A\xE8\x2A\x2A\x2A\x2A\x85\xC0\x75\x2A\xC7\x44\x24\x0C\x2A\x2A\x2A\x2A\xC7\x44\x24\x08\x2B\x00\x00\x00"
}
"ServerClassInit<DT_BaseCombatWeapon::ignored>" // Str: "DT_BaseCombatWeapon"
Expand Down
6 changes: 3 additions & 3 deletions zp/core/zombieplague.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ stock Address fnCreateMemoryForSDKCall(/*void*/)
int pAddress = view_as<int>(pServerBase) + fnGetModuleSize(pServerBase) - 1;

// Find the free memory
for(;;)
for (;;)
{
int iByte = LoadFromAddress(view_as<Address>(pAddress), NumberType_Int8);
if (iByte != 0x00)
Expand Down Expand Up @@ -522,7 +522,7 @@ stock void memcpy(Address pDest, char[] sSource, int iSize)
memcpy4b(pDest, view_as<any>(sSource), i);

// Copy the rest of staff
for(i *= 4, pDest += view_as<Address>(i); i < iSize; i++)
for (i *= 4, pDest += view_as<Address>(i); i < iSize; i++)
{
StoreToAddress(pDest++, sSource[i], NumberType_Int8);
}
Expand All @@ -538,7 +538,7 @@ stock void memcpy(Address pDest, char[] sSource, int iSize)
stock void memcpy4b(Address pDest, any[] sSource, int iSize)
{
// Copy 4 bytes at once
for(int i = 0; i < iSize; i++)
for (int i = 0; i < iSize; i++)
{
StoreToAddress(pDest, sSource[i], NumberType_Int32);
pDest += view_as<Address>(4);
Expand Down
4 changes: 2 additions & 2 deletions zp/manager/playerclasses/account.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ public Action AccountDonateOnCommandCatched(int client, int iArguments)
int target = FindTarget(client, sArgument, true, false);

// Validate target
if (target < 0)
if (target < 0 || client == target)
{
// Note: FindTarget automatically write error messages
return Plugin_Handled;
Expand All @@ -375,7 +375,7 @@ public Action AccountDonateOnCommandCatched(int client, int iArguments)

// Validate amount
int iMoney = StringToInt(sArgument); int iBet = gCvarList.ACCOUNT_BET.IntValue;
if (iMoney < gClientData[client].Money || iMoney < iBet)
if (iMoney <= 0 || iMoney > gClientData[client].Money || iMoney < iBet)
{
// Write error info
TranslationReplyToCommand(client, "account give invalid amount", iMoney);
Expand Down
46 changes: 25 additions & 21 deletions zp/manager/playerclasses/tools.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ void ToolsOnInit(/*void*/)
* @author This algorithm made by 'Peace-Maker'.
* @link https://forums.alliedmods.net/showthread.php?t=255298&page=15
**/
for(int i = 0; i < iWalkRestoreBytes; i++)
for (int i = 0; i < iWalkRestoreBytes; i++)
{
// Save the current instructions, so we can restore them on unload
iWalkRestore[i] = LoadFromAddress(pMaxSpeed[0], NumberType_Int8);
Expand All @@ -436,27 +436,31 @@ void ToolsOnInit(/*void*/)

/*__________________________________________________________________________________________________*/

// Load other offsets
fnInitGameConfAddress(gServerData.Config, pDisarmStart, "FX_Disarm_Start");
fnInitGameConfAddress(gServerData.Config, pDisarmEnd, "FX_Disarm_End");

// Validate extracted data
if (LoadFromAddress(pDisarmStart, NumberType_Int8) != 0x80 || LoadFromAddress(pDisarmEnd, NumberType_Int8) != 0x8B)
// Validate Linux
if (gServerData.Platform != OS_Windows)
{
// Log failure
LogEvent(false, LogType_Fatal, LOG_GAME_EVENTS, LogModule_Tools, "GameData Validation", "Failed to load SDK addresses from \"FX_Disarm_*\". Update addresses in \"%s\"", PLUGIN_CONFIG);
return;
}

/// Store current patch offset
iDisarmRestore = LoadFromAddress(pDisarmStart + view_as<Address>(1), NumberType_Int32);
// Load other offsets
fnInitGameConfAddress(gServerData.Config, pDisarmStart, "FX_Disarm_Start");
fnInitGameConfAddress(gServerData.Config, pDisarmEnd, "FX_Disarm_End");

// Gets the jmp instruction
int jmp = view_as<int>(pDisarmEnd - pDisarmStart) - 5;

// Write new jmp instruction
StoreToAddress(pDisarmStart, 0xE9, NumberType_Int8);
StoreToAddress(pDisarmStart + view_as<Address>(1), jmp, NumberType_Int32);
// Validate extracted data
if (LoadFromAddress(pDisarmStart, NumberType_Int8) != 0x80 || LoadFromAddress(pDisarmEnd, NumberType_Int8) != 0x8B)
{
// Log failure
LogEvent(false, LogType_Fatal, LOG_GAME_EVENTS, LogModule_Tools, "GameData Validation", "Failed to load SDK addresses from \"FX_Disarm_*\". Update addresses in \"%s\"", PLUGIN_CONFIG);
return;
}

/// Store current patch offset
iDisarmRestore = LoadFromAddress(pDisarmStart + view_as<Address>(1), NumberType_Int32);

// Gets the jmp instruction
int jmp = view_as<int>(pDisarmEnd - pDisarmStart) - 5;

// Write new jmp instruction
StoreToAddress(pDisarmStart, 0xE9, NumberType_Int8);
StoreToAddress(pDisarmStart + view_as<Address>(1), jmp, NumberType_Int32);
}
}

/**
Expand All @@ -480,7 +484,7 @@ void ToolsOnUnload(/*void*/)
/// Restore the original walk instructions, if we patched them

// i = currect instruction
for(int i = 0; i < iWalkRestoreBytes; i++)
for (int i = 0; i < iWalkRestoreBytes; i++)
{
StoreToAddress(pMaxSpeed[1] + view_as<Address>(i), iWalkRestore[i], NumberType_Int8);
}
Expand Down
4 changes: 2 additions & 2 deletions zp/versioninfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@
* @section Modification information.
**/
#define PLUGIN_NAME "Zombie Plague"
#define PLUGIN_VERSION "X.037"
#define PLUGIN_VERSION "X.039"
#define PLUGIN_TAG "zp"
#define PLUGIN_CONFIG "plugin.zombieplague"
#define PLUGIN_AUTHOR "qubka (Nikita Ushakov), Greyscale, Richard Helgeby"
#define PLUGIN_COPYRIGHT "Copyright (C) 2015-2020 Nikita Ushakov (Ireland, Dublin)"
#define PLUGIN_BRANCH "master"
#define PLUGIN_LINK "https://forums.alliedmods.net/showthread.php?t=290657"
#define PLUGIN_LICENSE "GNU GPL, Version 3"
#define PLUGIN_DATE "26-March-2020T16:50:00-GMT+00:00"
#define PLUGIN_DATE "29-July-2020T03:29:00-GMT+00:00"
/**
* @endsection
**/
Expand Down
2 changes: 1 addition & 1 deletion zp_extraitem_antidot.sp
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,6 @@ public void ZP_OnClientBuyExtraItem(int client, int itemID)
if (itemID == gItem)
{
// Change class to human
ZP_ChangeClient(client, _, "human");
ZP_ChangeClient(client, -1, "human");
}
}
2 changes: 1 addition & 1 deletion zp_weapon_lasermines.sp
Original file line number Diff line number Diff line change
Expand Up @@ -817,7 +817,7 @@ public Action MineUpdateHook(Handle hTimer, int refID)
int victim = hList.Get(i);

// Validate victim
if(IsPlayerExist(victim) && ZP_IsPlayerZombie(victim))
if (IsPlayerExist(victim) && ZP_IsPlayerZombie(victim))
{
// Apply damage
ZP_TakeDamage(victim, -1, entity, WEAPON_MINE_DAMAGE, DMG_BULLET);
Expand Down

0 comments on commit 7c55343

Please sign in to comment.