Raised This Month: $ Target: $400
 0% 

Need help with a restart plugin


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
faliment
New Member
Join Date: Dec 2009
Old 12-24-2009 , 11:32   Need help with a restart plugin
Reply With Quote #1

I've tried to make my own restartround + message plugin line in adminmod, but I have some problems with it.

First problem:

If I do "amx_restart 3 live hf", the plugins shows message like "ADMIN Adminname: amx_restart 3 3 live hf", but the expected message is like "ADMIN Adminname: amx_restart 3 live hf"

Second problem:

If I do "amx_restart live hf" without a number between command and message, the plugin show message like "ADMIN Adminname: amx_restart 0 life hf". I want to hide this message if there is no number specified.


Here's what i've done so far:

Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "author"


public plugin_init() 
{
    register_plugin(PLUGIN, VERSION, AUTHOR)
    register_concmd("amx_restart","admin_restart", ADMIN_CVAR,"<seconds> [optional message]");
}

public admin_restart(id,level,cid)
{
    if(!cmd_access(id,level,cid,1))
    {
        return PLUGIN_HANDLED
    }
    
    new name[32]
    new arg[32]
    new msg[64]
    
    read_argv(0,name,31)
    read_argv(1,arg,31)
    read_args(msg,63)
    remove_quotes(msg)
        
    if(equali(arg1,"") 
    || equali(arg1," "))
    {    
        console_print(id,"^"sv_restart^" is ^"%d^"",get_cvar_num("sv_restart"))
        return PLUGIN_HANDLED
    }
    
    set_cvar_num("sv_restart",str_to_num(arg))
    get_user_name(id,name,31)
    
    client_print(0,print_chat,"ADMIN %s: amx_restart %d %s",name,str_to_num(arg),msg)
    
    return PLUGIN_HANDLED
}

Last edited by faliment; 12-24-2009 at 11:38.
faliment is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 04:06.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode