Raised This Month: $ Target: $400
 0% 

First plugin attempt - Error 010


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
tomato_love
Junior Member
Join Date: Feb 2009
Old 02-08-2009 , 22:17   First plugin attempt - Error 010
Reply With Quote #1

Well heres my first attempt at writing a plugin, and i think i got everything right except when i goto compile it i get 2 error 010's

Code:
/* Plugin generated by tomato_love*/

#include <amxmodx>

#define PLUGIN "Yo_Say"
#define VERSION "0.1"
#define AUTHOR "tomato_love"


//set the access level of these commands...
#define ACCESS ADMIN_ALL //0=everyone

public plugin_init()
{
    register_plugin("Yo_Say","0.1","tomato_love");
}
public yo_say(id)
{
    new said[192];
    new name[32];
    get_user_info(id, "name", name, 31)
    read_args(said, 191);
    remove_quotes(said);
}
  if( (contain(said, "yo") != -1) && !(contain(said, " yo") != -1) ) {
    client_print(0, print_chat, "*", name, said);
    return PLUGIN_HANDELED;
}
Code:
Your plugin failed to compile! Read the errors below:
Welcome to the AMX Mod X 1.8.1-300 Compiler.
Copyright (c) 1997-2006 ITB CompuPhase, AMX Mod X Team

/home/groups/amxmodx/tmp3/textR3u5SE.sma(25) : error 010: invalid function or declaration
/home/groups/amxmodx/tmp3/textR3u5SE.sma(27) : error 010: invalid function or declaration

2 Errors. Could not locate output file /home/groups/amxmodx/public_html/websc3/textR3u5SE.amx (compile failed)
Any help would be greatly appreciated
Thanks in advance!
tomato_love is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 02-08-2009 , 22:28   Re: First plugin attempt - Error 010
Reply With Quote #2

You have a } before the if statement. Remove it and place one at the end of the file
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
tomato_love
Junior Member
Join Date: Feb 2009
Old 02-08-2009 , 22:37   Re: First plugin attempt - Error 010
Reply With Quote #3

thank you very much for your quick and helpful response. compiled it and tested, but unfortunately it does not work at all lol

do i have to define say and team_say somewhere??
tomato_love is offline
IneedHelp
Veteran Member
Join Date: Mar 2007
Location: Argentina
Old 02-08-2009 , 22:53   Re: First plugin attempt - Error 010
Reply With Quote #4

You have to hook the command 'say'

register_clcmd("say", "yo_say")
__________________
IneedHelp is offline
tomato_love
Junior Member
Join Date: Feb 2009
Old 02-08-2009 , 23:12   Re: First plugin attempt - Error 010
Reply With Quote #5

Thank you very much! I think that did it! But still not quite right - when i type something and add the 'yo' my name shows up like its supposed to, but no text. Also when not using the "yo" no name or text appears at all. Should i unhook the say? or should the PLUGIN_HANDLED be something different?

or should:
Code:
    if( (contain(said, "yo") != -1) && !(contain(said, " yo") != -1) ) {
    client_print(0, print_chat, name, said);
maybe instead of using said, there is something else that will print the message?

Last edited by tomato_love; 02-08-2009 at 23:14.
tomato_love is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 02-08-2009 , 23:58   Re: First plugin attempt - Error 010
Reply With Quote #6

Quote:
Originally Posted by tomato_love View Post
Thank you very much! I think that did it! But still not quite right - when i type something and add the 'yo' my name shows up like its supposed to, but no text. Also when not using the "yo" no name or text appears at all. Should i unhook the say? or should the PLUGIN_HANDLED be something different?

or should:
Code:
    if( (contain(said, "yo") != -1) && !(contain(said, " yo") != -1) ) {
    client_print(0, print_chat, name, said);
maybe instead of using said, there is something else that will print the message?
When using strings in a format fashion, use the below within your string to represent the string variable then place the actual variables in the respective order.
%s - string
%d - interger
%f - float

ie.
new iNumber = 10
new szTest[] = "hello"
new Float:fNum = 0.50

To print these in a string.
client_print( 0 , print_chat , "%s please give me %d dollars. i will give you %f cents." , szTest , iNumber , fNum )

The above will result in "hello please give me 10 dollars. i will give you 0.50 cents."

PHP Code:
if( (contain(said"yo") != -1) && !(contain(said" yo") != -1) ) {
    
client_print(0print_chat"%s said %s" name said 
__________________

Last edited by Bugsy; 02-09-2009 at 00:04.
Bugsy is offline
tomato_love
Junior Member
Join Date: Feb 2009
Old 02-09-2009 , 00:05   Re: First plugin attempt - Error 010
Reply With Quote #7

You guys are great! +karma all around. Works great, lastly i have a duplication issue now, it appears to all and then still shows up as a normal message. How would i go about eliminating that?

Also i would like eliminate the 'yo' all together once the text is processed.

For instance, i wanted an all say: "yo NICE SHOT YOU JERK!!"
the output would be: "tomato_love : NICE SHOT YOU JERK!!" w/o the 'yo'

Last edited by tomato_love; 02-09-2009 at 00:12.
tomato_love is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 02-09-2009 , 00:09   Re: First plugin attempt - Error 010
Reply With Quote #8

Quote:
Originally Posted by tomato_love View Post
You guys are great! +karma all around. Works great, lastly i have a duplication issue now, it appears to all and then still shows up as a normal message. How would i go about eliminating that?
What do you mean by a normal message? How do you want it to appear?

The first parameter specifies who the message is printed to. In your code, 0 is passed which results in all players. To make it only print to a specific player, you must specify the player id.

client_print( 0, print_chat, "%s said %s" , name , said )
__________________
Bugsy is offline
Old 02-09-2009, 00:17
tomato_love
This message has been deleted by tomato_love.
tomato_love
Junior Member
Join Date: Feb 2009
Old 02-09-2009 , 00:19   Re: First plugin attempt - Error 010
Reply With Quote #9



It prints twice ^^
tomato_love is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 02-09-2009 , 00:41   Re: First plugin attempt - Error 010
Reply With Quote #10

Paste your entire plugin and I will see whats wrong.
__________________
Bugsy 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 17:01.


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