Here's the proper way to code what you were trying to do. But a major "what the hell are you trying to do" comes to mind while writing it
. If you could give us more information we'd help you get on the right track, mhm mhm.
PHP Code:
/*
Note: Trying to not print the second message, if the first message has been printed.
Useful Link: http://wiki.alliedmods.net/Category:SourceMod_Scripting
*/
//Need a handle to store the Cvar into
new Handle:g_hCvar = INVALID_HANDLE;
//Need to declare our Cvar somewhere, so we do it in OnPluginStart()
public OnPluginStart()
{
//Create our ConVar ~ http://docs.sourcemod.net/api/index.php?fastload=show&id=475&
g_hCvar = CreateConVar("sm_scriptname_cvaridentifier", "1", "If enabled, print without colors.inc, otherwise, print with it.", FCVAR_NONE, true, 0.0, true, 1.0);
}
//Client has been authorized as a valid player, not sure about admin yet, but it doesn't matter
public OnClientAuthorized(client, const String:auth[])
{
//If Action1 Fails, do Action2
if(!DoAction1(client))
DoAction2(client);
}
//Going to return a value
bool:DoAction1(client)
{
if(!GetConVarInt(g_hCvar))
return false;
//Print to chat. Don't use %s for an integer! http://wiki.alliedmods.net/Format_Class_Functions_(SourceMod_Scripting)
PrintToChatAll("\x04%N ~ \x03Default Message", client);
return true;
}
//Doesn't need to return a value
void:DoAction2(client)
{
//Print to chat. Don't use %s for an integer! http://wiki.alliedmods.net/Format_Class_Functions_(SourceMod_Scripting)
CPrintToChatAll("{green}%N ~ {lightgreen}Default Message", client);
}
__________________