Thread: FuncommandsX
View Single Post
DarthNinja
SourceMod Plugin Approver
Join Date: Mar 2009
Location: PreThinkHook()
Old 07-13-2011 , 03:20   Re: FuncommandsX
Reply With Quote #383

One of my admins wrote this function, I think it would make a nice addition.
He doesn't have an account on here so I'm posting this on his behalf.

Credits to Mitch for code / testing:
PHP Code:
RegAdminCmd("sm_addhappy"Command_AddhappyADMFLAG_BAN"Adds a happy phrase to happy_phrases.ini");

public 
Action:Command_Addhappy(clientargs)
{
    if(
args 1)
    {
        
ReplyToCommand(client"[SM] Usage: sm_addhappy <phrase>");
        return 
Plugin_Handled;
    }

    new 
String:szhappyphrase[64];
    
GetCmdArgString(szhappyphrasesizeof(szhappyphrase));

    new 
String:szFile[256];
    
BuildPath(Path_SMszFilesizeof(szFile), "configs/happy_phrases.ini");
    new 
Handle:hFile OpenFile(szFile"at");
    
WriteFileLine(hFile"%s"szhappyphrase);
    
CloseHandle(hFile);

     
g_phraseCount BuildPhrases();

    return 
Plugin_Handled;

__________________

Last edited by DarthNinja; 01-14-2012 at 16:57.
DarthNinja is offline