Raised This Month: $ Target: $400
 0% 

[small]Help with 1st plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
DotPT
Member
Join Date: Feb 2009
Old 03-08-2009 , 16:27   [small]Help with 1st plugin
Reply With Quote #1

I feel like crap for posting such a simple error.

I started learning Pawn language a few hours ago and i have tried to do my best in a first plugin:
-0.1 version i sucessfully made it to print a chat message 4.0 seconds after a client when he connects to the server.
-Now for the next version i want to make a HUD Message. I got an error.


Here is the code:

PHP Code:
#include <amxmodx>
#include <amxmisc>
#define PLUGIN_NAME "Welcome Message"
#define PLUGIN_VERSION "0.5"
#define PLUGIN_AUTHOR "Dotcom"


public plugin_init()   // function to register the plugin
{
    
register_plugin (PLUGIN_NAMEPLUGIN_VERSIONPLUGIN_AUTHOR)        
}

public 
client_putinserver(id)  // fuction to register that the user has entered the server
{
    
set_task(5.0"print_msg"id
    
set_task(15.0"hud_msg"id)
}

public 
print_msg(id)  // function to print a message
{
    
client_print(idprint_chat"Welcome, this is my first plugin")

public 
hud_msg(id)
    
set_hudmessage(02550, -1.0, -1.0)
    
show_hudmessage(id"hey world!")

And the error:

Code:
Error: Symbol already defined: "show_hudmessage" on line 25
As this is more like a spam thread, i'll use it for any more help i need. Thanks!
DotPT is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 03-08-2009 , 16:33   Re: [small]Help with 1st plugin
Reply With Quote #2

Code:
#include <amxmodx> #include <amxmisc> #define PLUGIN_NAME "Welcome Message" #define PLUGIN_VERSION "0.5" #define PLUGIN_AUTHOR "Dotcom" public plugin_init()   // function to register the plugin {     register_plugin (PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR)         } public client_putinserver(id)  // fuction to register that the user has entered the server {     set_task(5.0, "print_msg", id)     set_task(15.0, "hud_msg", id) } public print_msg(id)  // function to print a message {     client_print(id, print_chat, "Welcome, this is my first plugin") } public hud_msg(id) {     set_hudmessage(0, 255, 0, -1.0, -1.0)     show_hudmessage(id, "hey world!") }
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
Old 03-08-2009, 16:34
Exolent[jNr]
This message has been deleted by Exolent[jNr]. Reason: Lag.
tuty
Veteran Member
Join Date: Jul 2008
Location: UK
Old 03-08-2009 , 16:36   Re: [small]Help with 1st plugin
Reply With Quote #3

i think this is not correct

set_hudmessage(0, 255, 0, -1.0, -1.0)
__________________
tuty is offline
Send a message via ICQ to tuty Send a message via AIM to tuty
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 03-08-2009 , 16:39   Re: [small]Help with 1st plugin
Reply With Quote #4

Actually, that is valid.

http://www.amxmodx.org/funcwiki.php?...sage&go=search

All the arguments are default to a value, which means you don't have to pass them.
Therefore, even this is valid:
Code:
set_hudmessage();
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
DotPT
Member
Join Date: Feb 2009
Old 03-08-2009 , 16:57   Re: [small]Help with 1st plugin
Reply With Quote #5

Oh, well it was just for a test. Thanks for the advice Exolent, worked perfect!
DotPT 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 08:54.


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