AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Cant find error (https://forums.alliedmods.net/showthread.php?t=25353)

iCeeeh 03-12-2006 11:04

Cant find error
 
Don't get whats wrong... can someone help me with this ?

Code:

#include <amxmodx>
#include <dbi>

new ctscore = 0 // Round score for CTs
new tscore = 0 // Round score for Ts

public plugin_init()
{
  register_plugin("Cup","0.1","ICEEEH")
  register_cvar("sql_host","localhost")
  register_cvar("sql_user","root")
  register_cvar("sql_pass","mysqlpass")
  register_cvar("sql_db","CS")
}

public sql_init() {
    new host[64], username[32], password[32], dbname[32], error[32]
    get_cvar_string("sql_host",host,64)
    get_cvar_string("sql_user",username,32)
    get_cvar_string("sql_pass",password,32)
    get_cvar_string("sql_db",dbname,32)
    dbc = dbi_connect(host,username,password,dbname,error,31)
    if (dbc == SQL_FAILED)
    log_amx("[CUP] The mySQL connection failed.")
    else
    {
        dbi_query(dbc,"CREATE TABLE IF NOT EXISTS `chatstorage` ( `date` TIMESTAMP,`name` VARCHAR(32) NOT NULL,`authid` VARCHAR(32) NOT NULL,`ip` VARCHAR(32) NOT NULL,`chattype` VARCHAR(32) NOT NULL,`text` VARCHAR(254) NOT NULL)")
        dbi_query(dbc,"CREATE TABLE IF NOT EXISTS `cupmatch` ( `matchid` INT(11) NOT NULL,`date` TIMESTAMP,`clan1` VARCHAR(50) NOT NULL,`clan2` varchar(50) NOT NULL,`map` VARCHAR(50),`clan1score` VARCHAR(10) NOT NULL,`clan2score` VARCHAR(10) NOT NULL)")
    }
}

public team_score()
{
    new team[32]
    new mapname[64]
    read_data(1,team,32)

    if (equal(team,"CT"))
       
        clan1 = get_cvar_string("cup_team1",team1)
        clan2 = get_cvar_string("cup_team2",team2)
        map = get_mapname(mapname,63)
        ctscore = read_data(2)
        terscore = tscore
            result = dbi_query(dbc,"INSERT INTO cupmatch (matchid,date,clan1,clan2,map,clan1score,clan2score) VALUES ('',NOW(),'%s','%s','%s','%s','%s')",matchid,date,clan1,clan2,map,clan1score,clan2score)
            dbi_free_result(result)       

    else if (equal(team,"TERRORIST"))
 
        clan1 = get_cvar_string("cup_team1",team1)
        clan2 = get_cvar_string("cup_team2",team2)
        map = get_mapname(mapname,63)
        tscore = read_data(2)
        cterscore = ctscore
            result = dbi_query(dbc,"INSERT INTO cupmatch (matchid,date,clan1,clan2,map,clan1score,clan2score) VALUES ('',NOW(),'%s','%s','%s','%s','%s')",matchid,date,clan1,clan2,map,clan1score,clan2score)
            dbi_free_result(result)       

    return PLUGIN_CONTINUE


  public cmd_say_team(id) {
    if (dbc == SQL_FAILED) return PLUGIN_CONTINUE
    new chattype[32]
    chattype = "say_team"
    new text[256]
    read_args(text,255)
    remove_quotes(text)
    new authid[32], name[32], ip[32]
    get_user_authid(id,authid,31)
    get_user_name(id,name,31)
    get_user_ip(id,ip,31)
    result = dbi_query(dbc,"INSERT INTO chatstorage (date,name,authid,ip,chattype,text) VALUES (NOW(),'%s','%s','%s','%s','%s')",name,authid,ip,chattype,text)
    dbi_free_result(result)
    return PLUGIN_CONTINUE
}

  public cmd_say(id) {
    if (dbc == SQL_FAILED) return PLUGIN_CONTINUE
    new chattype[32]
    chattype = "cmd_say"
    new text[256]
    read_args(text,255)
    remove_quotes(text)
    new authid[32], name[32], ip[32]
    get_user_authid(id,authid,31)
    get_user_name(id,name,31)
    get_user_ip(id,ip,31)
    result = dbi_query(dbc,"INSERT INTO chatstorage (date,name,authid,ip,chattype,text) VALUES (NOW(),'%s','%s','%s','%s','%s')",name,authid,ip,chattype,text)
    dbi_free_result(result)
    return PLUGIN_CONTINUE
}

errors :

Code:

/home/users/amxmodx/tmp3/textdmcQYi.sma(22) : error 017: undefined symbol "dbc"
/home/users/amxmodx/tmp3/textdmcQYi.sma(23) : error 017: undefined symbol "dbc"
/home/users/amxmodx/tmp3/textdmcQYi.sma(27) : error 017: undefined symbol "dbc"
/home/users/amxmodx/tmp3/textdmcQYi.sma(27) : warning 215: expression has no effect
/home/users/amxmodx/tmp3/textdmcQYi.sma(27) : error 001: expected token: ";", but found ")"
/home/users/amxmodx/tmp3/textdmcQYi.sma(27) : error 029: invalid expression, assumed zero
/home/users/amxmodx/tmp3/textdmcQYi.sma(27) : fatal error 107: too many error messages on one line

Compilation aborted.
6 Errors.

Thanks in advance,

ICEEEH

Des12 03-12-2006 13:11

Code:
#include <amxmodx> #include <dbi> new Sql:dbc new ctscore = 0 // Round score for CTs new tscore = 0 // Round score for Ts public plugin_init() {    register_plugin("Cup","0.1","ICEEEH")    register_cvar("sql_host","localhost")    register_cvar("sql_user","root")    register_cvar("sql_pass","mysqlpass")    register_cvar("sql_db","CS") } public sql_init() {     new host[64], username[32], password[32], dbname[32], error[32]     get_cvar_string("sql_host",host,64)     get_cvar_string("sql_user",username,32)     get_cvar_string("sql_pass",password,32)     get_cvar_string("sql_db",dbname,32)     dbc = dbi_connect(host,username,password,dbname,error,31)     if (dbc == SQL_FAILED)     log_amx("[CUP] The mySQL connection failed.")     else     {    dbi_query(dbc,"CREATE TABLE IF NOT EXISTS `chatstorage` ( `date` TIMESTAMP,`name` VARCHAR(32) NOT NULL,`authid` VARCHAR(32) NOT NULL,`ip` VARCHAR(32) NOT NULL,`chattype` VARCHAR(32) NOT NULL,`text` VARCHAR(254) NOT NULL)")    dbi_query(dbc,"CREATE TABLE IF NOT EXISTS `cupmatch` ( `matchid` INT(11) NOT NULL,`date` TIMESTAMP,`clan1` VARCHAR(50) NOT NULL,`clan2` varchar(50) NOT NULL,`map` VARCHAR(50),`clan1score` VARCHAR(10) NOT NULL,`clan2score` VARCHAR(10) NOT NULL)")     } } public team_score() {      new team[32]      new mapname[64]      read_data(1,team,32)     if (equal(team,"CT"))        clan1 = get_cvar_string("cup_team1",team1)    clan2 = get_cvar_string("cup_team2",team2)    map = get_mapname(mapname,63)         ctscore = read_data(2)    terscore = tscore        result = dbi_query(dbc,"INSERT INTO cupmatch (matchid,date,clan1,clan2,map,clan1score,clan2score) VALUES ('',NOW(),'%s','%s','%s','%s','%s')",matchid,date,clan1,clan2,map,clan1score,clan2score)        dbi_free_result(result)       else if (equal(team,"TERRORIST"))           clan1 = get_cvar_string("cup_team1",team1)    clan2 = get_cvar_string("cup_team2",team2)    map = get_mapname(mapname,63)         tscore = read_data(2)    cterscore = ctscore        result = dbi_query(dbc,"INSERT INTO cupmatch (matchid,date,clan1,clan2,map,clan1score,clan2score) VALUES ('',NOW(),'%s','%s','%s','%s','%s')",matchid,date,clan1,clan2,map,clan1score,clan2score)        dbi_free_result(result)       return PLUGIN_CONTINUE }   public cmd_say_team(id) {     if (dbc == SQL_FAILED) return PLUGIN_CONTINUE     new chattype[32]     chattype = "say_team"     new text[256]     read_args(text,255)     remove_quotes(text)     new authid[32], name[32], ip[32]     get_user_authid(id,authid,31)     get_user_name(id,name,31)     get_user_ip(id,ip,31)     result = dbi_query(dbc,"INSERT INTO chatstorage (date,name,authid,ip,chattype,text) VALUES (NOW(),'%s','%s','%s','%s','%s')",name,authid,ip,chattype,text)     dbi_free_result(result)     return PLUGIN_CONTINUE }   public cmd_say(id) {     if (dbc == SQL_FAILED) return PLUGIN_CONTINUE     new chattype[32]     chattype = "cmd_say"     new text[256]     read_args(text,255)     remove_quotes(text)     new authid[32], name[32], ip[32]     get_user_authid(id,authid,31)     get_user_name(id,name,31)     get_user_ip(id,ip,31)     result = dbi_query(dbc,"INSERT INTO chatstorage (date,name,authid,ip,chattype,text) VALUES (NOW(),'%s','%s','%s','%s','%s')",name,authid,ip,chattype,text)     dbi_free_result(result)     return PLUGIN_CONTINUE }


All times are GMT -4. The time now is 20:23.

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