aexi0n
11-03-2014, 17:47
I've recently been developing my own bhop plugin, and recently I've came to the part where I'd like the users to have their own HUD. After research, I did the usual 'PrintHintText' method, and everything works really well. EXCEPT, I've began to second guess my code:
#include <sourcemod>
#include <sdktools>
#include <sdkhooks>
#include <cstrike>
#pragma semicolon 1
public Plugin:myinfo =
{
name = "Paradise BunnyHop Timer",
author = "Aexi0n",
description = "Official Bhop Timer for Paradise Servers",
version = "0.1",
url = ""
}
public OnClientPutInServer(client)
{
CreateTimer(0.5, HUD, client, TIMER_REPEAT);
}
public Action:HUD(Handle:timer, any:client)
{
if(IsClientConnected(client) && IsClientInGame(client))
{
PrintHintText(client, "[Lv. %d] %N XP: 0/100\n Time: 0:00:00 \n Speed: ", Level[client], client);
}
}
(Just ignore the % variables, this isn't the entire script.)
After further review, I think I may be creating a timer for every client, and if I'm right I don't think that is a good thing to do. Could somebody review my code, and see if this is a safe, and reliable way to create the HUD? If it is indeed a bad way to do it, I'd also appreciate any insight as to what changes need to be made for it to work safely. Thank you!
#include <sourcemod>
#include <sdktools>
#include <sdkhooks>
#include <cstrike>
#pragma semicolon 1
public Plugin:myinfo =
{
name = "Paradise BunnyHop Timer",
author = "Aexi0n",
description = "Official Bhop Timer for Paradise Servers",
version = "0.1",
url = ""
}
public OnClientPutInServer(client)
{
CreateTimer(0.5, HUD, client, TIMER_REPEAT);
}
public Action:HUD(Handle:timer, any:client)
{
if(IsClientConnected(client) && IsClientInGame(client))
{
PrintHintText(client, "[Lv. %d] %N XP: 0/100\n Time: 0:00:00 \n Speed: ", Level[client], client);
}
}
(Just ignore the % variables, this isn't the entire script.)
After further review, I think I may be creating a timer for every client, and if I'm right I don't think that is a good thing to do. Could somebody review my code, and see if this is a safe, and reliable way to create the HUD? If it is indeed a bad way to do it, I'd also appreciate any insight as to what changes need to be made for it to work safely. Thank you!