Raised This Month: $51 Target: $400
 12% 

Command


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ErF
Junior Member
Join Date: Mar 2009
Old 03-21-2009 , 04:13   Command
Reply With Quote #1

I have a problem because I tried to write command '/ test'. My code:
Code:
/* Plugin Template generated by Pawn Studio */

#include <sourcemod>

public OnPluginStart()
{
    RegConsoleCmd("say",CommandSay)
}

public Action:CommandSay(client,args)
{
    new String:cmd[256]
    new index = 0
    GetCmdArgString(cmd,sizeof(cmd))
    if(cmd[0] == '"')
    {
        index = 1
        new slowo = strlen(cmd)
        if(cmd[slowo-1] == '"')
        {
            cmd[slowo-1] = '\0'
        }
    }
    if(StrEqual(cmd[index],"/test"))
    {
        PrintToConsole(client,"Testowa komenda.. hehe :)");
        return Plugin_Handled
    }
    return Plugin_Continue;
}
How to enter '/ test' it's not happening.
ErF is offline
exvel
SourceMod Donor
Join Date: Jun 2006
Location: Russia
Old 03-21-2009 , 05:15   Re: Command
Reply With Quote #2

There is a very simple way to do the same thing. Any console command you have registered can be called from the chat by typing "/my_command" or "!my_command". Just look here:
Code:
public OnPluginStart()
{
   RegConsoleCmd("test", MyFunction, "Description for the command");
}

public Action:MyFunction(client, args)
{
    PrintToConsole(client, "Testowa komenda.. hehe");
    return Plugin_Handled
}
Now you can use "/test" or "!test" in chat to see "Testowa komenda.. hehe" or just open a console and enter "test".
__________________
For admins: My plugins

For developers: Colors library

Last edited by exvel; 03-21-2009 at 05:20.
exvel is offline
Send a message via ICQ to exvel
Lebson506th
Veteran Member
Join Date: Jul 2008
Old 03-21-2009 , 08:07   Re: Command
Reply With Quote #3

It also works if the command is "sm_test"
__________________
My Plugins
Spray Tracer by Nican, maintained by me
Simple TK Manager
DoD:S Admin Weapons

Links
Resistance and Liberation (A HL2 Multiplayer Modification)
Lebson506th is offline
ErF
Junior Member
Join Date: Mar 2009
Old 03-21-2009 , 11:05   Re: Command
Reply With Quote #4

If you type: !test, /test or in console "test" - Nothing Happens.
ErF is offline
Reply



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 06:18.


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