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

Sourcepawn and plugin making


Post New Thread Reply   
 
Thread Tools Display Modes
matchaboy
Senior Member
Join Date: Jun 2013
Location: Bananaland
Old 10-18-2013 , 05:18   Re: Sourcepawn and plugin making
Reply With Quote #11

Hey guys, i started to kinda understand some of the plugins and I think to create a convar its

new Handle : <convar name here without the arrow brackets> = INVALID_HANDLE

Is creating convar like this?

Edit 1: Also, to create a command, is is something like this?

Code:
  RegAdminCmd("sm_command", command_example, ADMFLAG_SLAY, "Description");
Is that how to create a command? What if I don't any flags, do i just leave that part blank?
__________________
Learning how to make plugins.

Last edited by matchaboy; 10-18-2013 at 05:31.
matchaboy is offline
floube
SourceMod Donor
Join Date: Jan 2013
Location: Austria
Old 10-18-2013 , 05:52   Re: Sourcepawn and plugin making
Reply With Quote #12

Users with the ADMFLAG_SLAY flag can execute this:
PHP Code:
RegAdminCmd("sm_command"Command_CallbackADMFLAG_SLAY"Description"); 
Use the wiki and the admins.inc for more flags.

Any user'd be able to use this:
PHP Code:
RegConsoleCmd("sm_command"Command_Callback"Description"); 
floube is offline
matchaboy
Senior Member
Join Date: Jun 2013
Location: Bananaland
Old 10-18-2013 , 06:07   Re: Sourcepawn and plugin making
Reply With Quote #13

ok, I got it now, I have moved on to the "public Action" thing.

i wrote this

Code:
 if(args < 1)
           {
                PrintToConsole(client, "message")
                PrintToChat("message")
Will it work? I'm trying to make a message once he typed the command, a message appears for only HIS chat and his own console.

Edit 1: Can i put more than one message?
__________________
Learning how to make plugins.

Last edited by matchaboy; 10-18-2013 at 06:08.
matchaboy is offline
floube
SourceMod Donor
Join Date: Jan 2013
Location: Austria
Old 10-18-2013 , 06:17   Re: Sourcepawn and plugin making
Reply With Quote #14

args just gives you how many parameters are after the actual command.

Example:
Someone types !command 3 move
Then args will be 2

If you only want to print something to the clients chat use that:

PHP Code:
public Action:Command_Callback(clientargs) {
    
PrintToChat(client"Hello!");
    
PrintToChat(client"How are you?");
    
    return 
Plugin_Handled;

floube is offline
matchaboy
Senior Member
Join Date: Jun 2013
Location: Bananaland
Old 10-18-2013 , 06:23   Re: Sourcepawn and plugin making
Reply With Quote #15

if a player types !command , then I want it to say to him <message1> and <message2> and through console too, will this work?

Code:
 public Action:command_example(client_args) 
           {
               PrintToChat(client, "Message1");
               PrintToChat(client, "Message2");
               PrintToConsole(client, "Message1);
               PrintToConsole(client, "Message2);
       
               return Plugin_Handled;
    }
Will it work?
__________________
Learning how to make plugins.
matchaboy is offline
floube
SourceMod Donor
Join Date: Jan 2013
Location: Austria
Old 10-18-2013 , 06:29   Re: Sourcepawn and plugin making
Reply With Quote #16

Yes, but PrintToConsole may not keep in order, as it is UDP.
floube is offline
matchaboy
Senior Member
Join Date: Jun 2013
Location: Bananaland
Old 10-18-2013 , 06:36   Re: Sourcepawn and plugin making
Reply With Quote #17

so this scenario is if a player just types !command

What if a player types !command <message> <player> (Which what is my current command is supposed to do) Do i put
Code:
 if(args > 1)
           {
           PrintToChat(client, "Message3");
           PrintToConsole(client, "Message4");
           return Plugin_Handled
 }
Will this work? Also, after all this, i have to do

GetCmdArg

How does this (GetCmdArg) work?
__________________
Learning how to make plugins.
matchaboy is offline
floube
SourceMod Donor
Join Date: Jan 2013
Location: Austria
Old 10-18-2013 , 06:40   Re: Sourcepawn and plugin making
Reply With Quote #18

That'd work.

You may look at the API.
floube is offline
matchaboy
Senior Member
Join Date: Jun 2013
Location: Bananaland
Old 10-18-2013 , 06:59   Re: Sourcepawn and plugin making
Reply With Quote #19

Quote:
Originally Posted by floube View Post
That'd work.

You may look at the API.
I don't really get that, is it necessary though?
__________________
Learning how to make plugins.
matchaboy is offline
floube
SourceMod Donor
Join Date: Jan 2013
Location: Austria
Old 10-18-2013 , 07:13   Re: Sourcepawn and plugin making
Reply With Quote #20

If you want to get the parameters the user gave (eg. <message>) than: Yes.
floube 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 02:33.


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