AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Starting learning pawn (https://forums.alliedmods.net/showthread.php?t=171638)

Tomusaki 11-08-2011 13:49

Starting learning pawn
 
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 :oops:

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")


Devil259 11-08-2011 13:50

Re: Starting learning pawn
 
Show your code.

Tomusaki 11-08-2011 13:53

Re: Starting learning pawn
 
Quote:

Originally Posted by Devil259 (Post 1592823)
Show your code.

Added, sry for that :oops:

m0skVi4a 11-08-2011 13:55

Re: Starting learning pawn
 
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

Devil259 11-08-2011 13:56

Re: Starting learning pawn
 
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

Tomusaki 11-08-2011 14:05

Re: Starting learning pawn
 
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")



m0skVi4a 11-08-2011 14:10

Re: Starting learning pawn
 
Quote:

Originally Posted by Tomusaki (Post 1592835)
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")

Devil259 11-08-2011 14:13

Re: Starting learning pawn
 
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") }

Tomusaki 11-08-2011 14:18

Re: Starting learning pawn
 
Ok, thanx again for both :)
Now this motd is working, but can you tell me where i can learn pawn syntax and all functions?

joshknifer 11-08-2011 14:21

Re: Starting learning pawn
 
http://www.amxmodx.org/funcwiki.php


All times are GMT -4. The time now is 14:26.

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