Skip to content
Permalink
Browse files

Merge pull request #452 from Mrkl21full/patch-4

[TTT] Update enum array and update a few plugins with it
  • Loading branch information
Bara committed Nov 28, 2019
2 parents 703c91f + 1a400aa commit 645b17f01fcf778f6069ff86154cf3befc012f4e
@@ -12,7 +12,7 @@ jobs:
strategy:
fail-fast: false
matrix:
sm_version: ["1.10"]
sm_version: ["1.10", "1.11"]


steps:
@@ -18,7 +18,7 @@ addons:

env:
- VERSION=1.10
# - VERSION=1.11
- VERSION=1.11

before_script:
- 'if [[ $TRAVIS_PULL_REQUEST != "false" || $TRAVIS_PULL_REQUEST == "false" && $TRAVIS_BRANCH != "master" ]]; then bash ci/test.sh $VERSION "dev"; fi'
@@ -19,19 +19,23 @@
#include <sdktools>
#include <cstrike>

enum Ragdolls
enum struct Ragdolls
{
Ent,
Victim,
Attacker,
VictimTeam,
AttackerTeam,
String:VictimName[MAX_NAME_LENGTH],
String:AttackerName[MAX_NAME_LENGTH],
bool:Scanned,
Float:GameTime,
String:Weaponused[32],
bool:Found
int Ent;
int Victim;
int Attacker;

int VictimTeam;
int AttackerTeam;

char VictimName[MAX_NAME_LENGTH];
char AttackerName[MAX_NAME_LENGTH];
char WeaponUsed[32];

bool Scanned;
bool Found;

float GameTime;
}

enum KarmaUpdate
@@ -175,7 +179,7 @@ forward Action TTT_OnClientDeathPre(int victim, int attacker);
* @param ragdoll The Array with Ragdoll informations (by reference).
* @param silentID True if body was silenced id and false if normal inspect
*/
forward void TTT_OnBodyFound(int client, int victim, int[] ragdoll, bool silentID);
forward void TTT_OnBodyFound(int client, int victim, Ragdolls ragdoll, bool silentID);

/**
* Called before we create rules menu.
@@ -201,7 +205,7 @@ forward Action TTT_OnDetectiveMenu(int client, bool &show);
* @param client The client who scanned the body.
* @param ragdoll The Array with Ragdoll informations (by reference).
*/
forward Action TTT_OnBodyCheck(int client, int[] ragdoll);
forward Action TTT_OnBodyCheck(int client, Ragdolls ragdoll);

/**
* Called on updated player models
@@ -255,10 +259,6 @@ forward bool TTT_OnCheckCommandAccess(int client, const char[] command, const ch
*/
forward void TTT_OnLatestVersion(const char[] version);





/**
* Checks if the round is active.
*/
@@ -284,7 +284,7 @@ native int TTT_GetClientKarma(int client, bool publicKarma = true);
* @param client The victims index.
* @param radgoll The array to save the ragoll infos.
*/
native bool TTT_GetClientRagdoll(int victim, int[] ragdoll);
native bool TTT_GetClientRagdoll(int victim, any[] ragdoll);

/**
* Retrieve the client index.
@@ -295,11 +295,12 @@ native bool TTT_GetClientRagdoll(int victim, int[] ragdoll);
native int TTT_GetClientByRagdollID(int ragdoll);

/**
* Push a ragdoll to the global Ragdoll array (will get cleaned on Round Start).
* Spawn ragdoll at client position and add it to global Ragdoll array (will get cleaned on Round Start).
*
* @param radgoll The array to save as Ragdoll.
* @param client The client index
* @return True if spawned, false else.
*/
native int TTT_SetRagdoll(int[] ragdoll);
native void TTT_AddRagdoll(any[] ragdoll);

/**
* Set a client's role.
@@ -500,7 +501,6 @@ native bool TTT_DisableRounds(bool status);
*/
native RoundStatus TTT_GetRoundStatus();


/**
* Called after a player was round slayed.
*
@@ -1175,6 +1175,7 @@ stock void PrintCenterText2(int client, const char[] title, const char[] message
{
char sBuffer[2048];
Format(sBuffer, sizeof(sBuffer), "</font> %s\n%s\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", title, message);

Protobuf hMessage = view_as<Protobuf>(StartMessageOne("TextMsg", client));
hMessage.SetInt("msg_dst", 4);
hMessage.AddString("params", "#SFUI_ContractKillStart");
@@ -31,7 +31,7 @@ void InitNatives()
CreateNative("TTT_SetFoundStatus", Native_SetFoundStatus);
CreateNative("TTT_GetClientRagdoll", Native_GetClientRagdoll);
CreateNative("TTT_GetClientByRagdollID", Native_GetClientByRagdollID);
CreateNative("TTT_SetRagdoll", Native_SetRagdoll);
CreateNative("TTT_AddRagdoll", Native_AddRagdoll);
CreateNative("TTT_GetClientRole", Native_GetClientRole);
CreateNative("TTT_SetClientRole", Native_SetClientRole);
CreateNative("TTT_GetClientKarma", Native_GetClientKarma);
@@ -104,14 +104,15 @@ public int Native_GetClientRagdoll(Handle plugin, int numParams)

if (TTT_IsClientValid(client))
{
int iBody[Ragdolls];
Ragdolls ragdoll;

for (int i = 0; i < g_aRagdoll.Length; i++)
{
g_aRagdoll.GetArray(i, iBody[0], sizeof(iBody));
if (iBody[Victim] == GetClientUserId(client))
g_aRagdoll.GetArray(i, ragdoll, sizeof(ragdoll));

if (ragdoll.Victim == GetClientUserId(client))
{
SetNativeArray(2, iBody[0], sizeof(iBody));
SetNativeArray(2, ragdoll, sizeof(ragdoll));
return true;
}
}
@@ -122,34 +123,33 @@ public int Native_GetClientRagdoll(Handle plugin, int numParams)

public int Native_GetClientByRagdollID(Handle plugin, int numParams)
{
int ragdoll = GetNativeCell(1);
int iRagdollID = GetNativeCell(1);

if (IsValidEntity(ragdoll))
if (IsValidEntity(iRagdollID))
{
int iBody[Ragdolls];
Ragdolls ragdoll;

for (int i = 0; i < g_aRagdoll.Length; i++)
{
g_aRagdoll.GetArray(i, iBody[0], sizeof(iBody));
if (iBody[Ent] == EntIndexToEntRef(ragdoll))
g_aRagdoll.GetArray(i, ragdoll, sizeof(ragdoll));

if (ragdoll.Ent == EntIndexToEntRef(iRagdollID))
{
return GetClientOfUserId(iBody[Victim]);
return GetClientOfUserId(ragdoll.Victim);
}
}
}

return -1;
}

public int Native_SetRagdoll(Handle plugin, int numParams)
public int Native_AddRagdoll(Handle plugin, int numParams)
{
int iBody[Ragdolls];

GetNativeArray(1, iBody[0], sizeof(iBody));
Ragdolls ragdoll;

g_aRagdoll.PushArray(iBody[0]);
GetNativeArray(1, ragdoll, sizeof(ragdoll));

return 0;
g_aRagdoll.PushArray(ragdoll);
}

public int Native_SetClientRole(Handle plugin, int numParams)
@@ -238,15 +238,15 @@ public int Native_WasBodyFound(Handle plugin, int numParams)
return false;
}

int iRagdoll[Ragdolls];
Ragdolls ragdoll;

for (int i = 0; i < iSize; i++)
{
g_aRagdoll.GetArray(i, iRagdoll[0]);
g_aRagdoll.GetArray(i, ragdoll, sizeof(ragdoll));

if (iRagdoll[Victim] == GetClientUserId(client))
if (ragdoll.Victim == GetClientUserId(client))
{
return iRagdoll[Found];
return ragdoll.Found;
}
}
}
@@ -267,15 +267,15 @@ public int Native_WasBodyScanned(Handle plugin, int numParams)
return false;
}

int iRagdoll[Ragdolls];
Ragdolls ragdoll;

for (int i = 0; i < iSize; i++)
{
g_aRagdoll.GetArray(i, iRagdoll[0]);
g_aRagdoll.GetArray(i, ragdoll, sizeof(ragdoll));

if (iRagdoll[Victim] == GetClientUserId(client))
if (ragdoll.Victim == GetClientUserId(client))
{
return iRagdoll[Scanned];
return ragdoll.Scanned;
}
}
}
@@ -547,15 +547,17 @@ public int Native_RespawnPlayer(Handle plugin, int numParams)
float fOrigin[3];
bool bFound = false;

int iBody[Ragdolls];
Ragdolls ragdoll;

for (int i = 0; i < g_aRagdoll.Length; i++)
{
g_aRagdoll.GetArray(i, iBody[0], sizeof(iBody));
if (iBody[Victim] == GetClientUserId(client))
g_aRagdoll.GetArray(i, ragdoll, sizeof(ragdoll));

if (ragdoll.Victim == GetClientUserId(client))
{
g_aRagdoll.Erase(i);

int iRagdoll = EntRefToEntIndex(iBody[Ent]);
int iRagdoll = EntRefToEntIndex(ragdoll.Ent);

if (iRagdoll > 0)
{

0 comments on commit 645b17f

Please sign in to comment.
You can’t perform that action at this time.