Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Gloves_SetClientGloves Native #34

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions addons/sourcemod/scripting/gloves/natives.sp
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,43 @@ public int Native_GetArmsModel(Handle plugin, int numParams)
int size = GetNativeCell(3);
SetNativeString(2, g_CustomArms[clientIndex][playerTeam], size);
}

public int Native_SetClientGloves(Handle plugin, int numparams)
{
int client = GetNativeCell(1);
char updateFields[128], teamName[4];

int team = GetNativeCell(4);

g_iGroup[client][team] = GetNativeCell(2);
g_iGloves[client][team] = GetNativeCell(3);
if(team == CS_TEAM_T)
{
teamName = "t";
}
else if(team == CS_TEAM_CT)
{
teamName = "ct";
}
Format(updateFields, sizeof(updateFields), "%s_group = %i, %s_glove = %i", teamName, g_iGroup[client][team], teamName, g_iGloves[client][team]);
UpdatePlayerData(client, updateFields);

if(team == GetClientTeam(client))
{
int activeWeapon = GetEntPropEnt(client, Prop_Send, "m_hActiveWeapon");
if(activeWeapon != -1)
{
SetEntPropEnt(client, Prop_Send, "m_hActiveWeapon", -1);
}
GivePlayerGloves(client);
if(activeWeapon != -1)
{
DataPack dpack;
CreateDataTimer(0.1, ResetGlovesTimer, dpack);
dpack.WriteCell(client);
dpack.WriteCell(activeWeapon);
}
}

return 0;
}
3 changes: 3 additions & 0 deletions addons/sourcemod/scripting/include/gloves.inc
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,6 @@ native void Gloves_SetArmsModel(int client, const char[] armsModel);

// returns the registered custom arms model. "" if not set
native void Gloves_GetArmsModel(int client, char[] armsModel, int size);

// sets gloves to client by group id, glove id and team id
native void Gloves_SetClientGloves(int client, int groupId, int glove, int team);