AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   my first plugin... need some help (https://forums.alliedmods.net/showthread.php?t=9675)

Sp4rt4n 01-26-2005 22:08

my first plugin... need some help
 
im trying to do a tutorial plugin that i found on a site...
keep in mind, this is my first one ever...
can someone help me?

Code:
#include <amxmodx> #include <amxmisc> #define ADMIN_TEXT ADMIN_USER public plugin_int() {     register_plugin ("Text Messaging!","1.1","UnKn0wNkIlLeR")     register_concmd("amx_test","amx_test", ADMIN_TEXT, "amx_text")     register_cvar("sv_text","1") } public amx_text(id) {     new string[200], string[3]     read_argv(1,string,2);     read_argv(2,string,199);     if(!get_cvar_num("sv_text"))     return PLUGIN_HANDLED;         switch(str_to_num(string))     {         case 0: client_print(0,print_chat,"[AMX] %s", string2)         case 1: client_print(0,print_center,"[AMX] %s", string2)         case 2: client_print(0,print_console,"[AMX] %s", string2)         case 3: client_print(0,print_notify,"[AMX] %s", string2)     }       return PLUGIN_HANDLED; }

and heres the errors:

/home/users/amxmodx/tmp/okct1j20.sma(15) : error 021: symbol already defined: "string"
/home/users/amxmodx/tmp/okct1j20.sma(22) : error 017: undefined symbol "string2"
/home/users/amxmodx/tmp/okct1j20.sma(22 -- 23) : warning 202: number of arguments does not match definition
/home/users/amxmodx/tmp/okct1j20.sma(22 -- 23) : error 001: expected token: ",", but found "case"
/home/users/amxmodx/tmp/okct1j20.sma(23) : error 017: undefined symbol "string2"
/home/users/amxmodx/tmp/okct1j20.sma(23) : fatal error 107: too many error messages on one line

Sp4rt4n 01-26-2005 22:14

oh, would it help if instead of:

Code:
new string[200], string[3]

i put:

Code:
new string[200], string2[3]

??

PS: Sorry for double posting

Twilight Suzuka 01-26-2005 22:40

Code:

#include <amxmodx>
#include <amxmisc>

#define ADMIN_TEXT ADMIN_USER

public plugin_int()
{
        register_plugin ("Text Messaging!","1.1","UnKn0wNkIlLeR")
        register_concmd("amx_test","amx_test", ADMIN_TEXT, "amx_text")
        register_cvar("sv_text","1")
}

public amx_text(id)
{
        new string2[200], string[32]
        read_argv(1,string,31);
        read_argv(2,string2,199);
        if(!get_cvar_num("sv_text")) return PLUGIN_HANDLED;

        switch(str_to_num(string))
        {
                case 0: client_print(0,print_chat,"[AMX] %s", string2)
                case 1: client_print(0,print_center,"[AMX] %s", string2)
                case 2: client_print(0,print_console,"[AMX] %s", string2)
                case 3: client_print(0,print_notify,"[AMX] %s", string2)
        } 
        return PLUGIN_HANDLED;
}

When you make a string2, define a freaken string2.

Sp4rt4n 01-26-2005 22:49

:( sorry, i just started learning this stuff tonight...

Peli 01-27-2005 16:44

Lol don't be too hard on him Suzuka , it's a pretty nice try for a first plugin.


All times are GMT -4. The time now is 19:18.

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