AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   need help with sql (https://forums.alliedmods.net/showthread.php?t=47280)

oab 11-13-2006 22:50

need help with sql
 
im trying to make a VERY simple plugin that dumps the number of current players and the map into an sql database.... here is what i have and i get all kinds of errors..

Code:


#include <amxmodx>
#include <amxmisc>
#include <dbi>
 
new PLUGIN[]="Server Status"
new AUTHOR[]=".:OaB:."
new VERSION[]="1.00"
new host[64],user[64],pass[64],dbname[64]
get_cvar_string("amx_sql_host",host,63)
get_cvar_string("amx_sql_user",user,63)
get_cvar_string("amx_sql_pass",pass,63)
get_cvar_string("amx_sql_db",dbname,63)
new currentplayers
new maxplayers
new map
new Float:freq = 15

dbi_connect(host,user,pass,dbname)


public updateInfo()
{
    currentplayers = get_playersnum(1)
    maxplayers = get_maxplayers()
    map = get_mapname()
    dbi_query(sql,"UPDATE serverstatus SET currentplayers='%d', maxplayers='%d', map='%s'",currentplayers,maxplayers,map)
    return PLUGIN_CONTINUE
}


public plugin_init()
{
    register_plugin(PLUGIN, VERSION, AUTHOR)
    set_task(freq,"updateInfo",0,"",0,"b")
    return PLUGIN_CONTINUE
}

Quote:

Welcome to the AMX Mod X 1.76-300 Compiler.
Copyright (c) 1997-2006 ITB CompuPhase, AMX Mod X Team

/home/groups/amxmodx/tmp3/phpVZt4q1.sma(10) : error 021: symbol already defined: "get_cvar_string"
/home/groups/amxmodx/tmp3/phpVZt4q1.sma(19) : warning 213: tag mismatch
/home/groups/amxmodx/tmp3/phpVZt4q1.sma(19) : error 021: symbol already defined: "dbi_connect"
/home/groups/amxmodx/tmp3/phpVZt4q1.sma(26) : error 088: number of arguments does not match definition
/home/groups/amxmodx/tmp3/phpVZt4q1.sma(27) : error 017: undefined symbol "sql"
/home/groups/amxmodx/tmp3/phpVZt4q1.sma(27) : warning 215: expression has no effect
/home/groups/amxmodx/tmp3/phpVZt4q1.sma(27) : warning 215: expression has no effect
/home/groups/amxmodx/tmp3/phpVZt4q1.sma(27) : warning 215: expression has no effect
/home/groups/amxmodx/tmp3/phpVZt4q1.sma(27) : warning 215: expression has no effect
/home/groups/amxmodx/tmp3/phpVZt4q1.sma(27) : error 001: expected token: ";", but found ")"
/home/groups/amxmodx/tmp3/phpVZt4q1.sma(27) : error 029: invalid expression, assumed zero
/home/groups/amxmodx/tmp3/phpVZt4q1.sma(27) : fatal error 107: too many error messages on one line

Compilation aborted.
7 Errors.
help would be awesome. thanks

Rolnaaba 11-14-2006 09:41

Re: need help with sql
 
1 Attachment(s)
look at my sig for some SQL tutorials :D
anyway compiles:

oab 11-14-2006 14:33

Re: need help with sql
 
thanks a lot dude. appreciate it.

Rolnaaba 11-15-2006 07:33

Re: need help with sql
 
np


All times are GMT -4. The time now is 07:00.

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