Updated to use new natives in cstrike extension instead of SDK calls. Requires SourceMod 1.4.0 or newer.

This commit is contained in:
Richard Helgeby 2012-01-28 19:12:33 +01:00
parent 3ad9d6108b
commit 4e68b52301
4 changed files with 6 additions and 78 deletions

View File

@ -51,22 +51,5 @@
"linux" "257"
}
}
"Signatures"
{
"TerminateRound"
{
"library" "server"
"windows" "\x83\xEC\x2A\x53\x8B\x5C\x2A\x2A\x55\x56\x57\x33\xF6\x8B\xE9\x33"
"linux" "@_ZN12CCSGameRules14TerminateRoundEfi"
}
"CSWeaponDrop"
{
"library" "server"
"windows" "\x55\x8B\xEC\x81\xEC\x2A\x2A\x2A\x2A\x89\x8D\x2A\x2A\x2A\x2A\xC6\x2A\x2A\x00\x8B\x8D\x2A\x2A\x2A\x2A\xE8"
"linux" "@_ZN9CCSPlayer12CSWeaponDropEP17CBaseCombatWeaponbb"
}
}
}
}

View File

@ -309,22 +309,22 @@ RoundEndTerminateRound(Float:delay, RoundEndOutcome:outcome = Restart)
// Round is restarting.
case Restart:
{
SDKCall(g_hToolsTerminateRound, delay, ROUNDEND_GAME_COMMENCING);
CS_TerminateRound(delay, CSRoundEnd_GameStart, false);
}
// Round was a draw.
case Draw:
{
SDKCall(g_hToolsTerminateRound, delay, ROUNDEND_ROUND_DRAW);
CS_TerminateRound(delay, CSRoundEnd_Draw, false);
}
// Zombies won.
case ZombiesWin:
{
SDKCall(g_hToolsTerminateRound, delay, ROUNDEND_TERRORISTS_WIN);
CS_TerminateRound(delay, CSRoundEnd_TerroristWin, false);
}
// Humans won.
case HumansWin:
{
SDKCall(g_hToolsTerminateRound, delay, ROUNDEND_CTS_WIN);
CS_TerminateRound(delay, CSRoundEnd_CTWin, false);
}
}
}

View File

@ -34,16 +34,6 @@ new g_iToolsHasNightVision;
new g_iToolsNightVisionOn;
new g_iToolsFOV;
/**
* @endsection
*/
/**
* Initialize global SDKTools handles.
*/
new Handle:g_hToolsGameConfig = INVALID_HANDLE;
new Handle:g_hToolsTerminateRound = INVALID_HANDLE;
new Handle:g_hToolsCSWeaponDrop = INVALID_HANDLE;
/**
* @endsection
*/
@ -58,9 +48,6 @@ ToolsInit()
{
// Find offsets.
ToolsFindOffsets();
// Setup SDKTools
ToolsSetupGameData();
}
/**
@ -109,45 +96,3 @@ ToolsFindOffsets()
VEffectsOnOffsetsFound();
NapalmOnOffsetsFound();
}
/**
* Sets up gamedata for the plugin.
*/
ToolsSetupGameData()
{
// Load game config file.
g_hToolsGameConfig = LoadGameConfigFile("plugin.zombiereloaded");
// If gamedata file can't be loaded, then stop the plugin.
if (g_hToolsGameConfig == INVALID_HANDLE)
{
LogEvent(false, LogType_Fatal, LOG_CORE_EVENTS, LogModule_Tools, "GameData", "Can't load game config file (plugin.zombiereloaded.txt) from the gamedata directory.");
}
// Prep the SDKCall for "TerminateRound."
StartPrepSDKCall(SDKCall_GameRules);
PrepSDKCall_SetFromConf(g_hToolsGameConfig, SDKConf_Signature, "TerminateRound");
PrepSDKCall_AddParameter(SDKType_Float, SDKPass_Plain);
PrepSDKCall_AddParameter(SDKType_PlainOldData, SDKPass_Plain);
g_hToolsTerminateRound = EndPrepSDKCall();
// If offset "TerminateRound" can't be found, then stop the plugin.
if(g_hToolsTerminateRound == INVALID_HANDLE)
{
LogEvent(false, LogType_Fatal, LOG_CORE_EVENTS, LogModule_Tools, "GameData", "Signature \"CGameRules::TerminateRound\" was not found.");
}
// Prep the SDKCall for "CSWeaponDrop."
StartPrepSDKCall(SDKCall_Player);
PrepSDKCall_SetFromConf(g_hToolsGameConfig, SDKConf_Signature, "CSWeaponDrop");
PrepSDKCall_AddParameter(SDKType_CBaseEntity, SDKPass_Pointer);
PrepSDKCall_AddParameter(SDKType_Bool, SDKPass_Plain);
PrepSDKCall_AddParameter(SDKType_Bool, SDKPass_Plain);
g_hToolsCSWeaponDrop = EndPrepSDKCall();
// If offset "CSWeaponDrop" can't be found, then stop the plugin.
if(g_hToolsCSWeaponDrop == INVALID_HANDLE)
{
LogEvent(false, LogType_Fatal, LOG_CORE_EVENTS, LogModule_Tools, "GameData", "Signature \"CBasePlayer::CSWeaponDrop\" was not found.");
}
}

View File

@ -792,7 +792,7 @@ stock WeaponsSlot:WeaponsGetDeployedWeaponSlot(client)
}
/**
* Forces player to drop weapon index.
* Forces player to drop weapon index. (Simplified wrapper)
*
* @param client The client index.
* @param weapon The weapon index to force client to drop.
@ -800,7 +800,7 @@ stock WeaponsSlot:WeaponsGetDeployedWeaponSlot(client)
stock WeaponsForceClientDrop(client, weapon)
{
// Force client to drop weapon.
SDKCall(g_hToolsCSWeaponDrop, client, weapon, true, false);
CS_DropWeapon(client, weapon, true, false);
}
/**