Permalink
Browse files

Add test command to get classname from the active weapon

  • Loading branch information...
Bara committed Dec 11, 2018
1 parent 97f5eb2 commit 32c54e0f8a4842f2e2437f9369e67e932f750204
Showing with 13 additions and 0 deletions.
  1. +13 −0 addons/sourcemod/scripting/tests/commands.sp
@@ -19,6 +19,7 @@ public void OnPluginStart()
RegConsoleCmd("sm_roundtime", Command_RoundTime);
RegConsoleCmd("sm_stone", Command_Stone);
RegConsoleCmd("sm_ghost", Command_Ghost);
RegConsoleCmd("sm_classname", Command_Classname);
}

public Action Command_CheckGOTV(int client, int args)
@@ -201,3 +202,15 @@ public Action Command_Ghost(int client, int args)
SetEntProp(client, Prop_Send, "m_bIsPlayerGhost", !GetEntProp(client, Prop_Send, "m_bIsPlayerGhost"));
PrintToChat(client, "Ghost: %d", GetEntProp(client, Prop_Send, "m_bIsPlayerGhost"));
}

public Action Command_Classname(int client, int args)
{
int iWeapon = GetEntPropEnt(client, Prop_Send, "m_hActiveWeapon");

if (IsValidEntity(iWeapon))
{
char sClass[32];
GetEntityClassname(iWeapon, sClass, sizeof(sClass));
PrintToChat(client, "Index: %d, Class: %s", iWeapon, sClass);
}
}

0 comments on commit 32c54e0

Please sign in to comment.