SDKTools: Add explode parameter to ForcePlayerSuicide native (#1782)
* Expose CommitSuicide params * A single space * Validate param count * Set force param to true by default
This commit is contained in:
parent
c29e185d2a
commit
278998f7d0
@ -516,19 +516,23 @@ static cell_t ForcePlayerSuicide(IPluginContext *pContext, const cell_t *params)
|
||||
return pContext->ThrowNativeError("\"CommitSuicide\" wrapper failed to initialize");
|
||||
}
|
||||
}
|
||||
bool bForce = false;
|
||||
if (!strcmp(g_pSM->GetGameFolderName(), "zps"))
|
||||
{
|
||||
// ZPS requires force to be set as true otherwise the action itself is delayed.
|
||||
// Which affects Slay and Timebomb.
|
||||
bForce = true;
|
||||
}
|
||||
|
||||
START_CALL();
|
||||
DECODE_VALVE_PARAM(1, thisinfo, 0);
|
||||
*(bool *)(vptr + pCall->vparams[0].offset) = false;
|
||||
*(bool *)(vptr + pCall->vparams[1].offset) = bForce;
|
||||
|
||||
if (params[0] >= 2)
|
||||
{
|
||||
DECODE_VALVE_PARAM(2, vparams, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
*(bool *)(vptr + pCall->vparams[0].offset) = false;
|
||||
}
|
||||
|
||||
*(bool *)(vptr + pCall->vparams[1].offset) = true;
|
||||
|
||||
FINISH_CALL_SIMPLE(NULL);
|
||||
|
||||
return 1;
|
||||
}
|
||||
#else
|
||||
|
@ -102,9 +102,10 @@ native void TeleportEntity(int entity, const float origin[3] = NULL_VECTOR, cons
|
||||
* Forces a player to commit suicide.
|
||||
*
|
||||
* @param client Client index.
|
||||
* @param explode If true, explode the player.
|
||||
* @error Invalid client or client not in game, or lack of mod support.
|
||||
*/
|
||||
native void ForcePlayerSuicide(int client);
|
||||
native void ForcePlayerSuicide(int client, bool explode = false);
|
||||
|
||||
/**
|
||||
* Slaps a player in a random direction.
|
||||
|
Loading…
Reference in New Issue
Block a user