Instead of PrintToChat(client, "Welcome Premium Gamer Namehere");
You can use
PrintToChatAll("Welcome, Premium Gamer %N", client);
You can even make them colored by using \x0# in front of the piece you want colored.
PrintToChatAll("Welcome, \x04Premium Gamer \x05%N\x01", client);
\x01 is default color, \x04 is Green, \x03 is a team color, \x05 is olive.
%N makes a name, but never put %N with a server command, only with printing to chat. Otherwise clients can change their name to "lol; _restart", then the server will try to read their name and make it a command, and... bad things happen.
Basically, use one of the two bolded lines in place of the underlined line.
EDIT: That enable cvar line seems to be strange or complicated, nor will it work right if you turn it off in the middle of somebody joining or something.
Try this:
PHP Code:
#include <sourcemod>
public Plugin:myinfo = {
name = "Welcome Premium",
author = "",
description = "",
version = "1.0",
url = "www.sourcemod.com"
}
public OnPluginStart()
{
CreateConVar("sm_wp_enabled", "1", "\"1\" = \"Welcome Premium\" plugin is active, \"0\" = \"Welcome Premium\" plugin is disabled", FCVAR_PLUGIN | FCVAR_NOTIFY | FCVAR_REPLICATED);
}
public OnClientPutInServer(client)
{
if (GetConVarBool(FindConVar("sm_wp_enabled")) && (GetUserFlagBits(client) & ADMFLAG_CUSTOM1))
CreateTimer(30.0, PremiumJoinAnnounce, any:client);
}
public Action:PremiumJoinAnnounce(Handle:timer, any:client)
{
PrintToChatAll("Welcome, \x04Premium Gamer \x05%N\x01", client);
}
It will also only announce to others 30 seconds after the player joins the game (finishes loading and is at the MOTD), so that he can see it too
__________________