fixed trigger OnStartTouch/OnEndTouch bug caused by TeleportEntity

fixed reloading zombiereloaded plugin
reset player velocity on respawn (high speed in spec -> zspawn)
This commit is contained in:
BotoX 2016-05-08 03:10:25 +02:00
parent 2d1cdf7a36
commit cea1b84965
5 changed files with 69 additions and 1 deletions

View File

@ -0,0 +1,14 @@
"Games"
{
"cstrike"
{
"Signatures"
{
"CBaseEntity_SetAbsVelocity"
{
"library" "server"
"linux" "@_ZN11CBaseEntity14SetAbsVelocityERK6Vector"
}
}
}
}

View File

@ -121,6 +121,8 @@
#include "zr/api/api"
new bool:g_bLate = false;
/**
* Record plugin info.
*/
@ -151,6 +153,8 @@ public APLRes:AskPluginLoad2(Handle:myself, bool:late, String:error[], err_max)
// Register library
RegPluginLibrary("zombiereloaded");
g_bLate = late;
// Let plugin load.
return APLRes_Success;
}
@ -257,6 +261,30 @@ public OnConfigsExecuted()
// Forward event to modules. (OnModulesLoaded)
ConfigOnModulesLoaded();
ClassOnModulesLoaded();
if(g_bLate)
{
for(new client = 1; client <= MaxClients; client++)
{
if(!IsClientConnected(client))
continue;
OnClientConnected(client);
if(IsClientInGame(client))
{
OnClientPutInServer(client);
if(IsClientAuthorized(client))
OnClientPostAdminCheck(client);
}
if(AreClientCookiesCached(client))
OnClientCookiesCached(client);
}
g_bLate = false;
}
}
/**

View File

@ -183,6 +183,10 @@ bool:RespawnSpawnClient(client, bool:zombie = false, bool:zombieIfSuicide = fals
// Spawn player.
CS_RespawnPlayer(client);
// Reset player velocity
float fResetVelocity[3] = {0.0, 0.0, 0.0};
TeleportEntity(client, NULL_VECTOR, NULL_VECTOR, fResetVelocity);
// Check if first zombie has spawned.
if (InfectHasZombieSpawned())
{

View File

@ -33,6 +33,7 @@ new g_iToolsLMV;
new g_iToolsHasNightVision;
new g_iToolsNightVisionOn;
new g_iToolsFOV;
new Handle:g_hToolsSetAbsVelocity = INVALID_HANDLE;
/**
* @endsection
@ -90,6 +91,24 @@ ToolsFindOffsets()
LogEvent(false, LogType_Fatal, LOG_CORE_EVENTS, LogModule_Tools, "Offsets", "Offset \"CBasePlayer::m_iFOV\" was not found.");
}
// void CBaseEntity::SetAbsVelocity( const Vector &vecAbsVelocity )
Handle hGameConf = LoadGameConfigFile("zombiereloaded");
if (hGameConf != INVALID_HANDLE)
{
StartPrepSDKCall(SDKCall_Player);
if (PrepSDKCall_SetFromConf(hGameConf, SDKConf_Signature, "CBaseEntity_SetAbsVelocity"))
{
PrepSDKCall_AddParameter(SDKType_Vector, SDKPass_ByRef);
g_hToolsSetAbsVelocity = EndPrepSDKCall();
}
else
LogEvent(false, LogType_Error, LOG_CORE_EVENTS, LogModule_Tools, "Offsets", "SDKCall \"CBaseEntity::SetAbsVelocity\" was not found.");
CloseHandle(hGameConf);
}
else
LogEvent(false, LogType_Error, LOG_CORE_EVENTS, LogModule_Tools, "Offsets", "Couldn't load zombiereloaded game config!");
// Forward event to modules.
WeaponsOnOffsetsFound();
AccountOnOffsetsFound();

View File

@ -64,7 +64,10 @@ stock ToolsClientVelocity(client, Float:vecVelocity[3], bool:apply = true, bool:
}
// Apply velocity on client.
TeleportEntity(client, NULL_VECTOR, NULL_VECTOR, vecVelocity);
if(g_hToolsSetAbsVelocity == INVALID_HANDLE) // Fallback to old one
TeleportEntity(client, NULL_VECTOR, NULL_VECTOR, vecVelocity);
else // Fixes trigger OnStartTouch/OnEndTouch bug
SDKCall(g_hToolsSetAbsVelocity, client, vecVelocity);
}
/**