Raised This Month: $ Target: $400
 0% 

Starting learning pawn


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Tomusaki
Junior Member
Join Date: Nov 2011
Old 11-08-2011 , 13:49   Starting learning pawn
Reply With Quote #1

Hello all!,
I'm a new guy in here and in "pawn" scripting, so after ~1h. checking other plugins source code i desided to do my first motd plugin, i did not tested it, so i think you can help me to learn pawn faster by telling me what i'm doing wrong, and how to do that.
Thank you!

P.S. Sorry for my bad English

EDIT: I forgot to add source code :O

Code:
#include <amxmodx.inc>
#define PLUGIN "first motd"
#define VERSION "0.1"
#define AUTHOR "Me"
public plugin_init()
{
  register_plugin(PLUGIN, VERSION, AUTHOR)
  register_clcmd("say /motd", "say motd")
}
public show_motd(id, "motd.txt", "My first motd")

Last edited by Tomusaki; 11-08-2011 at 13:52.
Tomusaki is offline
Devil259
Veteran Member
Join Date: Dec 2009
Location: France (59)
Old 11-08-2011 , 13:50   Re: Starting learning pawn
Reply With Quote #2

Show your code.
Devil259 is offline
Tomusaki
Junior Member
Join Date: Nov 2011
Old 11-08-2011 , 13:53   Re: Starting learning pawn
Reply With Quote #3

Quote:
Originally Posted by Devil259 View Post
Show your code.
Added, sry for that
Tomusaki is offline
m0skVi4a
Senior Member
Join Date: May 2011
Location: Rousse, Bulgaria
Old 11-08-2011 , 13:55   Re: Starting learning pawn
Reply With Quote #4

PHP Code:
#include <amxmodx.inc>
#define PLUGIN "first motd"
#define VERSION "0.1"
#define AUTHOR "Me"
public plugin_init()
{
  
register_plugin(PLUGINVERSIONAUTHOR)
  
register_clcmd("say /motd""show_motd")
}
public 
show_motd
{
  
show_motd(id"motd.txt""My first motd")

You do not create the function to open the motd
m0skVi4a is offline
Send a message via Skype™ to m0skVi4a
Devil259
Veteran Member
Join Date: Dec 2009
Location: France (59)
Old 11-08-2011 , 13:56   Re: Starting learning pawn
Reply With Quote #5

Remove ".inc" in your #include.

Add the native show_motd( ) in the function public say_motd (add a "_") like :

Code:
public say_motd( id ) {      show_motd( /* ... */ ) }

EDIT : Indent your code

Last edited by Devil259; 11-08-2011 at 13:57.
Devil259 is offline
Tomusaki
Junior Member
Join Date: Nov 2011
Old 11-08-2011 , 14:05   Re: Starting learning pawn
Reply With Quote #6

Wow, thanx for advice!
Now my code looks much better

PHP Code:
#include <amxmodx>
#define PLUGIN "My first motd"
#define VERSION "0.1"
#define AUTHOR "Me"
public plugin_init()
{
 
register_plugin(PLUGINVERSIONAUTHOR)
 
register_clcmd("/motd")
}
public 
say_motd(id)
{
 
show_motd("motd.txt""my first motd")

Tomusaki is offline
m0skVi4a
Senior Member
Join Date: May 2011
Location: Rousse, Bulgaria
Old 11-08-2011 , 14:10   Re: Starting learning pawn
Reply With Quote #7

Quote:
Originally Posted by Tomusaki View Post
Wow, thanx for advice!
Now my code looks much better

PHP Code:
#include <amxmodx>
#define PLUGIN "My first motd"
#define VERSION "0.1"
#define AUTHOR "Me"
public plugin_init()
{
 
register_plugin(PLUGINVERSIONAUTHOR)
 
register_clcmd("/motd")
}
public 
say_motd(id)
{
 
show_motd("motd.txt""my first motd")

NONO
It must be register_clcmd("/motd", "say_motd")

Last edited by m0skVi4a; 11-08-2011 at 14:10.
m0skVi4a is offline
Send a message via Skype™ to m0skVi4a
Devil259
Veteran Member
Join Date: Dec 2009
Location: France (59)
Old 11-08-2011 , 14:13   Re: Starting learning pawn
Reply With Quote #8

Code:
#include <amxmodx> #define PLUGIN "My first motd" #define VERSION "0.1" #define AUTHOR "Me" public plugin_init() {      register_plugin( PLUGIN , VERSION , AUTHOR )      register_clcmd( "say /motd" , "function_motd" ) } public function_motd( id ) {      show_motd("motd.txt", "my first motd") }

Last edited by Devil259; 11-08-2011 at 14:14.
Devil259 is offline
Tomusaki
Junior Member
Join Date: Nov 2011
Old 11-08-2011 , 14:18   Re: Starting learning pawn
Reply With Quote #9

Ok, thanx again for both
Now this motd is working, but can you tell me where i can learn pawn syntax and all functions?
Tomusaki is offline
joshknifer
Veteran Member
Join Date: Jun 2011
Location: Denver, CO
Old 11-08-2011 , 14:21   Re: Starting learning pawn
Reply With Quote #10

http://www.amxmodx.org/funcwiki.php
__________________
joshknifer is offline
Send a message via Skype™ to joshknifer
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 14:26.


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