Wesker Posted March 21, 2017 Content Count: 1534 Joined: 07/27/09 Status: Offline Share Posted March 21, 2017 (edited) I made a showname plugin using the new game_text feature recently added to sourcemod (requires the latest stable build) How does it work? Hold E / Use key or Shift / Walk key and whoever is in your crosshairs the name will be displayed in game_text. @Punky is also working on a fancy version that should come soon. Download: showplayername.smx #pragma semicolon 1 #pragma newdecls required #include #include //#include #define PLUGIN_NAME "Show Player Name" #define PLUGIN_VERSION "1.0" Handle g_HSync; float g_fCmdTime[MAXPLAYERS + 1]; public Plugin myinfo = { name = PLUGIN_NAME, author = "Wesker", description = "Show name in game text", version = PLUGIN_VERSION, url = "http://steam-gamers.net/" }; public void OnPluginStart() { CreateConVar("sm_showplayername", PLUGIN_VERSION, "Show nickname", FCVAR_SPONLY | FCVAR_DONTRECORD | FCVAR_NOTIFY); g_HSync = CreateHudSynchronizer(); } public void OnMapEnd() { if (g_HSync != INVALID_HANDLE) { CloseHandle(g_HSync); g_HSync = INVALID_HANDLE; } } public Action OnPlayerRunCmd(int client, int &buttons, int &impulse, float vel[3], float angles[3], int &weapon) { if (!IsPlayerAlive(client)) { //Client is in spec return Plugin_Continue; } if ((buttons & IN_USE) || (buttons & IN_WALK)) { //Holding Use or Walk key if (g_fCmdTime[client] //Delay next call for optimization g_fCmdTime[client] = GetGameTime() + 0.3; //Wait int target = GetClientAimTarget(client, true); if (IsValidClient(target)) { ShowTargetName(client, target); } } } return Plugin_Continue; } public void OnClientPostAdminCheck(int client) { g_fCmdTime[client] = 0.0; } stock bool IsValidClient(int client) { if ((client MaxClients)) { return false; } if (!IsClientInGame(client)) { return false; } if (!IsPlayerAlive(client)) { return false; } return true; } stock void ShowTargetName(int client, int target) { SetHudTextParams(-1.0, 0.6, 3.0, 255, 255, 255, 255, 0, 0.25, 0.1, 0.1); ClearSyncHud(client, g_HSync); ShowSyncHudText(client, g_HSync, "%N", target); } Edited March 21, 2017 by Wesker Link to comment
Black Rain Posted March 21, 2017 Content Count: 6759 Joined: 06/23/13 Status: Offline Share Posted March 21, 2017 Uhh II'm adding Punky's version because I like it a lot and I don't see the point of having two different plugins that both have the same purpose Link to comment
Wesker Posted March 21, 2017 Content Count: 1534 Joined: 07/27/09 Status: Offline Share Posted March 21, 2017 Uhh I'm adding Punky's version because I like it a lot and I don't see the point of having two different plugins that both have the same purpose I was under the impression that it was a WIP, is it already uploaded? Link to comment
Black Rain Posted March 21, 2017 Content Count: 6759 Joined: 06/23/13 Status: Offline Share Posted March 21, 2017 I was under the impression that it was a WIP, is it already uploaded? Still WIP but when I saw the screenshots I said immediately said yes to adding his version. I'm not sure how much more needs to be done but it's dope @Punky confirm ETA pls Link to comment
Punky Posted March 21, 2017 Content Count: 1592 Joined: 03/16/12 Status: Offline Share Posted March 21, 2017 Still WIP but when I saw the screenshots I said immediately said yes to adding his version. I'm not sure how much more needs to be done but it's dope @Punky confirm ETA pls the v1 should be ready by tomorrow if everything goes well. 6 Link to comment
Labarr Posted March 25, 2017 Content Count: 3052 Joined: 08/30/09 Status: Offline Share Posted March 25, 2017 Still WIP but when I saw the screenshots I said immediately said yes to adding his version. I'm not sure how much more needs to be done but it's dope @Punky confirm ETA pls the v1 should be ready by tomorrow if everything goes well. Will need to shutdown the server to do the sourcemod update. I plan on doing this tomorrow morning before work, so around 5am when the server should be empty 2 Link to comment
Labarr Posted March 30, 2017 Content Count: 3052 Joined: 08/30/09 Status: Offline Share Posted March 30, 2017 All servers have been updated. @Black Rain 2 Link to comment
Leon Mordecai Posted March 30, 2017 Content Count: 5055 Joined: 07/19/15 Status: Offline Share Posted March 30, 2017 (edited) Plugin is on the server right now for le testing, right click/use or bind sm_showname to a key to display the player's name in HUD. Thanks Punky doggo 1 Edited March 30, 2017 by Leon Mordecai Link to comment
Recommended Posts
Reply to Thread
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now