Added teleport parameter to Shavit_ResumeTimer

This commit is contained in:
shavit 2019-04-14 22:36:33 +03:00
parent 3150225755
commit bac741e7f8
2 changed files with 17 additions and 3 deletions

View File

@ -962,9 +962,10 @@ native void Shavit_PauseTimer(int client);
* Resumes a player's timer. * Resumes a player's timer.
* *
* @param client Client index. * @param client Client index.
* @param teleport Should the player be teleported to their location prior to saving?
* @noreturn * @noreturn
*/ */
native void Shavit_ResumeTimer(int client); native void Shavit_ResumeTimer(int client, bool teleport = false);
/** /**
* Deletes the specified replay file. * Deletes the specified replay file.

View File

@ -1396,12 +1396,25 @@ public int Native_FinishMap(Handle handler, int numParams)
public int Native_PauseTimer(Handle handler, int numParams) public int Native_PauseTimer(Handle handler, int numParams)
{ {
PauseTimer(GetNativeCell(1)); int client = GetNativeCell(1);
GetClientAbsOrigin(client, gF_PauseOrigin[client]);
GetClientEyeAngles(client, gF_PauseAngles[client]);
GetEntPropVector(client, Prop_Data, "m_vecAbsVelocity", gF_PauseVelocity[client]);
PauseTimer(client);
} }
public int Native_ResumeTimer(Handle handler, int numParams) public int Native_ResumeTimer(Handle handler, int numParams)
{ {
ResumeTimer(GetNativeCell(1)); int client = GetNativeCell(1);
ResumeTimer(client);
if(numParams >= 2 && view_as<bool>(GetNativeCell(2))) // teleport?
{
TeleportEntity(client, gF_PauseOrigin[client], gF_PauseAngles[client], gF_PauseVelocity[client]);
}
} }
public int Native_StopChatSound(Handle handler, int numParams) public int Native_StopChatSound(Handle handler, int numParams)