AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   First plugin attempt - Error 010 (https://forums.alliedmods.net/showthread.php?t=85347)

tomato_love 02-08-2009 22:17

First plugin attempt - Error 010
 
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!

YamiKaitou 02-08-2009 22:28

Re: First plugin attempt - Error 010
 
You have a } before the if statement. Remove it and place one at the end of the file

tomato_love 02-08-2009 22:37

Re: First plugin attempt - Error 010
 
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??

IneedHelp 02-08-2009 22:53

Re: First plugin attempt - Error 010
 
You have to hook the command 'say'

register_clcmd("say", "yo_say")

tomato_love 02-08-2009 23:12

Re: First plugin attempt - Error 010
 
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?

Bugsy 02-08-2009 23:58

Re: First plugin attempt - Error 010
 
Quote:

Originally Posted by tomato_love (Post 758529)
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 


tomato_love 02-09-2009 00:05

Re: First plugin attempt - Error 010
 
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'

Bugsy 02-09-2009 00:09

Re: First plugin attempt - Error 010
 
Quote:

Originally Posted by tomato_love (Post 758539)
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 )

tomato_love 02-09-2009 00:19

Re: First plugin attempt - Error 010
 
http://picasaweb.google.com/lh/photo...eat=directlink

It prints twice ^^

Bugsy 02-09-2009 00:41

Re: First plugin attempt - Error 010
 
Paste your entire plugin and I will see whats wrong.


All times are GMT -4. The time now is 17:01.

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