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:
parent
2d1cdf7a36
commit
cea1b84965
14
cstrike/addons/sourcemod/gamedata/zombiereloaded.txt
Normal file
14
cstrike/addons/sourcemod/gamedata/zombiereloaded.txt
Normal file
@ -0,0 +1,14 @@
|
||||
"Games"
|
||||
{
|
||||
"cstrike"
|
||||
{
|
||||
"Signatures"
|
||||
{
|
||||
"CBaseEntity_SetAbsVelocity"
|
||||
{
|
||||
"library" "server"
|
||||
"linux" "@_ZN11CBaseEntity14SetAbsVelocityERK6Vector"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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())
|
||||
{
|
||||
|
@ -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();
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user