Cader
04-10-2008, 16:11
Hi. I am editing a "Name registration (mysql)" script. I want to put [UNREG] tag to players who are not registered. And I make some changes in this part of code:
user_noclan(id){
new regUser[32], regPass[10], rquery[128]
format(rquery,128,"SELECT nick,pass FROM %s WHERE nick = '%s'",mysqlUsersTbl,uname)
mysql_query(mysql,rquery)
if ( mysql_nextrow(mysql) > 0 ) {
mysql_getfield(mysql,1,regUser,32)
mysql_getfield(mysql,2,regPass,10)
if (equali(uname,regUser)) { // found registered nick
if (tolower(passwd[0]) == 0) { // ... without password
client_cmd(id,msgs[0],pfield)
client_cmd(id,msgs[1])
return PLUGIN_HANDLED
}
if (!equal(passwd,regPass)) { // ... but password not match
client_cmd(id,msgs[2])
client_cmd(id,msgs[3],pfield)
client_cmd(id,msgs[4])
return PLUGIN_HANDLED
}
if ((equal(passwd,regPass)) && (!equal(uname,regUser))) { // caps not match
client_cmd(id,msgs[5])
client_cmd(id,msgs[6], regUser)
client_cmd(id,msgs[7],regUser)
return PLUGIN_HANDLED
}
if ((equal(passwd,regPass)) && (equal(uname,regUser))) { // all is OK
client_cmd(id,msgs[8])
client_cmd(id,"echo [AMXX] Enjoy the game %s ...",uname)
registered[id] = true
return PLUGIN_CONTINUE
}
}
}
if (!allowall) {
client_cmd(id,notallowed[0])
client_cmd(id,notallowed[1])
client_cmd(id,notallowed[2])
client_cmd(id,notallowed[3])
return PLUGIN_HANDLED
}
if (containi(uname,"[UNREG]") == -1){
client_cmd(id,"echo [AMXX] You play with non-registered nick.")
client_cmd(id,"name [UNREG]%s", uname);
return PLUGIN_CONTINUE
}
return PLUGIN_CONTINUE
}
It works but doesnt completely. For the first connection (with a unregistered nick) , the plugins puts [UNREG] tag in front of my name. But when I type "disconnect" and then change my name anything else like "name SecondTest" and then "retry" ; the plugin can not change my name. (It tries but in game it still seems as "SecondTest")
Any ideas?
user_noclan(id){
new regUser[32], regPass[10], rquery[128]
format(rquery,128,"SELECT nick,pass FROM %s WHERE nick = '%s'",mysqlUsersTbl,uname)
mysql_query(mysql,rquery)
if ( mysql_nextrow(mysql) > 0 ) {
mysql_getfield(mysql,1,regUser,32)
mysql_getfield(mysql,2,regPass,10)
if (equali(uname,regUser)) { // found registered nick
if (tolower(passwd[0]) == 0) { // ... without password
client_cmd(id,msgs[0],pfield)
client_cmd(id,msgs[1])
return PLUGIN_HANDLED
}
if (!equal(passwd,regPass)) { // ... but password not match
client_cmd(id,msgs[2])
client_cmd(id,msgs[3],pfield)
client_cmd(id,msgs[4])
return PLUGIN_HANDLED
}
if ((equal(passwd,regPass)) && (!equal(uname,regUser))) { // caps not match
client_cmd(id,msgs[5])
client_cmd(id,msgs[6], regUser)
client_cmd(id,msgs[7],regUser)
return PLUGIN_HANDLED
}
if ((equal(passwd,regPass)) && (equal(uname,regUser))) { // all is OK
client_cmd(id,msgs[8])
client_cmd(id,"echo [AMXX] Enjoy the game %s ...",uname)
registered[id] = true
return PLUGIN_CONTINUE
}
}
}
if (!allowall) {
client_cmd(id,notallowed[0])
client_cmd(id,notallowed[1])
client_cmd(id,notallowed[2])
client_cmd(id,notallowed[3])
return PLUGIN_HANDLED
}
if (containi(uname,"[UNREG]") == -1){
client_cmd(id,"echo [AMXX] You play with non-registered nick.")
client_cmd(id,"name [UNREG]%s", uname);
return PLUGIN_CONTINUE
}
return PLUGIN_CONTINUE
}
It works but doesnt completely. For the first connection (with a unregistered nick) , the plugins puts [UNREG] tag in front of my name. But when I type "disconnect" and then change my name anything else like "name SecondTest" and then "retry" ; the plugin can not change my name. (It tries but in game it still seems as "SecondTest")
Any ideas?