AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Can some help sort out some Warnings in this plugin (https://forums.alliedmods.net/showthread.php?t=9890)

st341th 02-02-2005 17:11

Can some help sort out some Warnings in this plugin
 
Could someone plz take a look at this and help me figure out why i get these warnings when i compile it

Thanx

home/users/amxmodx/tmp/pPEjdBt1.sma(15) : warning 217: loose indentation
/home/users/amxmodx/tmp/pPEjdBt1.sma(27) : warning 217: loose indentation
/home/users/amxmodx/tmp/pPEjdBt1.sma(52 -- 54) : warning 213: tag mismatch
/home/users/amxmodx/tmp/pPEjdBt1.sma(81) : warning 213: tag mismatch
/home/users/amxmodx/tmp/pPEjdBt1.sma(82) : warning 213: tag mismatch
/home/users/amxmodx/tmp/pPEjdBt1.sma(99) : warning 213: tag mismatch
/home/users/amxmodx/tmp/pPEjdBt1.sma(100) : warning 213: tag mismatch
/home/users/amxmodx/tmp/pPEjdBt1.sma(117) : warning 213: tag mismatch
/home/users/amxmodx/tmp/pPEjdBt1.sma(118) : warning 213: tag mismatch
/home/users/amxmodx/tmp/pPEjdBt1.sma(140) : warning 213: tag mismatch

10 Warnings.
Done.



#include <amxmodx>
#include <dbi>

new mhost[64]
new muser[32]
new mpass[32]
new mdb[32]
new hlstats_url[512]
new hlstats_prefix[32]
new mysql = 0

public plugin_init() {

register_plugin("HLStats 1.6","1.0a","nobodY")
register_clcmd("say","check_say")
register_clcmd("say_team","check_say")
register_clcmd("skill","say_skill",-1,"skill")
register_clcmd("rank","say_skill",-1,"rank")
register_clcmd("top15","say_top15",-1,"top15")
register_cvar("amx_hlstats_host","mysqlhost")
register_cvar("amx_hlstats_user","mysqluser")
register_cvar("amx_hlstats_pass","geiles-passwort")
register_cvar("amx_hlstats_db","tolledatenban k")
register_cvar("amx_hlstats_url","http://geil.hlstats.org")
register_cvar("amx_hlstats_prefix","hlstats_" )

return PLUGIN_CONTINUE
}

public check_say(id){
new said[64]
read_args(said,63)

if (equali(said,"^"/skill^"") || equali(said,"^".skill^"") || equali(said,"^"skill^"") || equali(said,"^"!skill^"")|| equali(said,"^"/rank^"") || equali(said,"^".rank^"") || equali(said,"^"rank^"") || equali(said,"^"!rank^""))
say_skill(id,1)
else if (equali(said,"^"/top15^"") || equali(said,"^".top15^"") || equali(said,"^"top15^"") || equali(said,"^"!top15^""))
say_top15(id,1)

return PLUGIN_CONTINUE
}

public sql_init(){

get_cvar_string("amx_hlstats_host",mhost,63)
get_cvar_string("amx_hlstats_user",muser,31)
get_cvar_string("amx_hlstats_pass",mpass,31)
get_cvar_string("amx_hlstats_db",mdb,31)
get_cvar_string("amx_hlstats_url",hlstats_url ,31)
get_cvar_string("amx_hlstats_prefix",hlstats_ prefix,31)

new merror[64]
mysql = dbi_connect(mhost,muser,mpass,mdb,merror,63)

if(mysql < 1)
server_print("[AMX][HLSTATS] MySQL error: could not connect : '%s'",merror)
else
server_print("[AMX][HLSTATS] Successfully connected to the database.")

return PLUGIN_CONTINUE
}

public say_skill(id,saychat){

sql_init()

new merror[32]
new query[256]
new steamid[32]
new client_name[32]
new skill[16]
new rank[16]
new totalplayers[16]
new Result:ret


get_user_authid(id,steamid,31)
get_user_name(id,client_name,31)

format(query,255,"select a.skill from %sPlayers a,%sPlayerUniqueIds b where a.playerId=b.playerId and b.uniqueId='%s'",hlstats_prefix,hlstats_prefi x,steamid)

ret=dbi_query(mysql,query)
dbi_error(mysql,merror,31)
if (merror[0]){
server_print("[AMX] MYSQL error: %s",merror)
return PLUGIN_HANDLED
}else{
server_print("[AMX][HLSTATS] Found skill for %s",client_name)
}

if(dbi_nextrow(ret)>0)
{
dbi_field(ret,1,skill,9)
}

dbi_free_result(ret)

format(query,255,"select count(skill) from %sPlayers WHERE skill >= %s and hideranking=0",hlstats_prefix,skill)

ret=dbi_query(mysql,query)
dbi_error(mysql,merror,31)
if (merror[0]){
server_print("[AMX] MYSQL error: %s",merror)
return PLUGIN_HANDLED
}else{
server_print("[AMX][HLSTATS] Found rank for %s",client_name)
}

if(dbi_nextrow(ret)>0)
{
dbi_field(ret,1,rank,15)
}

dbi_free_result(ret)

format(query,255,"SELECT count(skill) FROM %sPlayers",hlstats_prefix)

ret=dbi_query(mysql,query)
dbi_error(mysql,merror,31)
if (merror[0]){
server_print("[AMX] MYSQL error: %s",merror)
return PLUGIN_HANDLED
}else{
server_print("[AMX][HLSTATS] Found total amount of players...")
server_print("rank %s, totalplayers %s, skill %s", rank, totalplayers, skill)

}

if(dbi_nextrow(ret)>0)
{
dbi_field(ret,1,totalplayers,15)
}

dbi_free_result(ret)

new name[64]
get_user_name(id,name,63)
client_print(id, print_chat, "** Your DDC Server rank is %s of %s with %s points! **", rank, totalplayers, skill)

if (mysql > 0){
dbi_close(mysql)
}

return PLUGIN_HANDLED
}

public say_top15(id,saychat){

new motd[512]
new url[512]

get_cvar_string("amx_hlstats_url",hlstats_url ,511)

format(url,511,"%s/top15.php",hlstats_url)
format(motd, 511, "%s", url)
show_motd(id, motd, "name")

return PLUGIN_HANDLED
}

knekter 02-02-2005 17:40

WOW
 
WOW!!! plz post your code inside the small tags!

Peli 02-02-2005 18:35

Use
Code:
 and
tags. We will read it better.

Peli 02-02-2005 18:35

Use [ small ] and [ /small ] tags. We will read it better.

manorastroman 02-02-2005 18:43

i did it for him since i got bored

Code:
#include <amxmodx> #include <dbi> new mhost[64] new muser[32] new mpass[32] new mdb[32] new hlstats_url[512] new hlstats_prefix[32] new mysql = 0 public plugin_init() { register_plugin("HLStats 1.6","1.0a","nobodY") register_clcmd("say","check_say") register_clcmd("say_team","check_say") register_clcmd("skill","say_skill",-1,"skill") register_clcmd("rank","say_skill",-1,"rank") register_clcmd("top15","say_top15",-1,"top15") register_cvar("amx_hlstats_host","mysqlhost") register_cvar("amx_hlstats_user","mysqluser") register_cvar("amx_hlstats_pass","geiles-passwort") register_cvar("amx_hlstats_db","tolledatenbank") register_cvar("amx_hlstats_url","http://geil.hlstats.org") register_cvar("amx_hlstats_prefix","hlstats_") return PLUGIN_CONTINUE } public check_say(id){ new said[64] read_args(said,63) if (equali(said,"^"/skill^"") || equali(said,"^".skill^"") || equali(said,"^"skill^"") || equali(said,"^"!skill^"")|| equali(said,"^"/rank^"") || equali(said,"^".rank^"") || equali(said,"^"rank^"") || equali(said,"^"!rank^"")) say_skill(id,1) else if (equali(said,"^"/top15^"") || equali(said,"^".top15^"") || equali(said,"^"top15^"") || equali(said,"^"!top15^"")) say_top15(id,1) return PLUGIN_CONTINUE } public sql_init(){ get_cvar_string("amx_hlstats_host",mhost,63) get_cvar_string("amx_hlstats_user",muser,31) get_cvar_string("amx_hlstats_pass",mpass,31) get_cvar_string("amx_hlstats_db",mdb,31) get_cvar_string("amx_hlstats_url",hlstats_url,31) get_cvar_string("amx_hlstats_prefix",hlstats_prefix,31) new merror[64] mysql = dbi_connect(mhost,muser,mpass,mdb,merror,63) if(mysql < 1) server_print("[AMX][HLSTATS] MySQL error: could not connect : '%s'",merror) else server_print("[AMX][HLSTATS] Successfully connected to the database.") return PLUGIN_CONTINUE } public say_skill(id,saychat){ sql_init() new merror[32] new query[256] new steamid[32] new client_name[32] new skill[16] new rank[16] new totalplayers[16] new Result:ret get_user_authid(id,steamid,31) get_user_name(id,client_name,31) format(query,255,"select a.skill from %sPlayers a,%sPlayerUniqueIds b where a.playerId=b.playerId and b.uniqueId='%s'",hlstats_prefix,hlstats_prefix,steamid) ret=dbi_query(mysql,query) dbi_error(mysql,merror,31) if (merror[0]){ server_print("[AMX] MYSQL error: %s",merror) return PLUGIN_HANDLED }else{ server_print("[AMX][HLSTATS] Found skill for %s",client_name) } if(dbi_nextrow(ret)>0) { dbi_field(ret,1,skill,9) } dbi_free_result(ret) format(query,255,"select count(skill) from %sPlayers WHERE skill >= %s and hideranking=0",hlstats_prefix,skill) ret=dbi_query(mysql,query) dbi_error(mysql,merror,31) if (merror[0]){ server_print("[AMX] MYSQL error: %s",merror) return PLUGIN_HANDLED }else{ server_print("[AMX][HLSTATS] Found rank for %s",client_name) } if(dbi_nextrow(ret)>0) { dbi_field(ret,1,rank,15) } dbi_free_result(ret) format(query,255,"SELECT count(skill) FROM %sPlayers",hlstats_prefix) ret=dbi_query(mysql,query) dbi_error(mysql,merror,31) if (merror[0]){ server_print("[AMX] MYSQL error: %s",merror) return PLUGIN_HANDLED }else{ server_print("[AMX][HLSTATS] Found total amount of players...") server_print("rank %s, totalplayers %s, skill %s", rank, totalplayers, skill) } if(dbi_nextrow(ret)>0) { dbi_field(ret,1,totalplayers,15) } dbi_free_result(ret) new name[64] get_user_name(id,name,63) client_print(id, print_chat, "** Your DDC Server rank is %s of %s with %s points! **", rank, totalplayers, skill) if (mysql > 0){ dbi_close(mysql) } return PLUGIN_HANDLED } public say_top15(id,saychat){ new motd[512] new url[512] get_cvar_string("amx_hlstats_url",hlstats_url,511) format(url,511,"%s/top15.php",hlstats_url) format(motd, 511, "%s", url) show_motd(id, motd, "name") return PLUGIN_HANDLED }

st341th 02-03-2005 00:48

Still get 8 warnings while compiling :( but starting to help

/home/users/amxmodx/tmp/4gN6OgMh.sma(52 -- 54) : warning 213: tag mismatch
/home/users/amxmodx/tmp/4gN6OgMh.sma(81) : warning 213: tag mismatch
/home/users/amxmodx/tmp/4gN6OgMh.sma(82) : warning 213: tag mismatch
/home/users/amxmodx/tmp/4gN6OgMh.sma(99) : warning 213: tag mismatch
/home/users/amxmodx/tmp/4gN6OgMh.sma(100) : warning 213: tag mismatch
/home/users/amxmodx/tmp/4gN6OgMh.sma(117) : warning 213: tag mismatch
/home/users/amxmodx/tmp/4gN6OgMh.sma(118) : warning 213: tag mismatch
/home/users/amxmodx/tmp/4gN6OgMh.sma(140) : warning 213: tag mismatch

8 Warnings.
Done.

XxAvalanchexX 02-03-2005 01:35

Quote:

Originally Posted by st341th
but starting to help

How can you say that? No one did anything, but copy and paste your code inside of little script tags.

dbi_connect returns a Sql: result, so you have to define mysql as "new Sql:mysql = 0".

st341th 02-03-2005 02:58

I can say that because instead of 10 warnings there is now 8
i cant see if anyone did anything to it
thats how i can say its starting to help

Dude im a TOTAL noobie... thats just trying to get help with a problem...

st341th 02-03-2005 05:28

Quote:

Originally Posted by XxAvalanchexX
dbi_connect returns a Sql: result, so you have to define mysql as "new Sql:mysql = 0".

I dont understand what these means that is why im asking for help

st341th 02-03-2005 08:07

Plz help ?


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

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