AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   warning 217: loose indentation (https://forums.alliedmods.net/showthread.php?t=55922)

rCa 06-02-2007 05:35

warning 217: loose indentation
 
What this error means ? and how to fix it ?

Alka 06-02-2007 05:44

Re: warning 217: loose indentation
 
code?

rCa 06-02-2007 06:03

Re: warning 217: loose indentation
 
Code:

#define PLUGINNAME "gg"
#define VERSION  "gg"
#define AUTHOR  "gg"
 
#include <amxmodx>
#include <dbi>
#include <amxmisc>
#include <engine>
 
#define CVAR_WHOST  "wwwreg_host"
#define CVAR_WUSER  "wwwreg_user"
#define CVAR_WPASS  "wwwreg_pass"
#define CVAR_WDB  "wwwreg_db"
// Global vars below
new g_regged[33]
// Global vars above
public plugin_modules() {
 require_module("engine")
 require_module("dbi")
}
public client_authorized(id) {
 if (is_user_bot(id))
  return PLUGIN_CONTINUE
 const LEN = 32
 new authid[LEN + 1], name[32]
 get_user_authid(id, authid, LEN)
 get_user_name(id, name, 31)
 g_regged[id] = checkreg(id,name)
 if (g_regged[id])
  server_print("[%s] %s (%s) is registered.", PLUGINNAME, name, authid)
 else {
  server_cmd("kick %s Prasome uzsiregistruokite www.gzn.lt", name)
  server_print("[%s] %s (%s) is not registered.", PLUGINNAME, name, authid)
 }
 return PLUGIN_CONTINUE
}
bool:checkreg(id,name[]) {
 new Sql:sql
 if (!connect(sql))
  return false
 const LONGER = 128
 new query[LONGER + 1]
 format(query, LONGER, "SELECT `pass` FROM server_users WHERE `nick` = ^"%s^" LIMIT 1", name)
 new Result:result = dbi_query(sql, query)
 if (result <= RESULT_FAILED) {
  new error[256]
  dbi_error(sql, error, 255)
  log_amx("Error while quering SQL server for %s, can't check registration: %s", name, error)
  dbi_close(sql)
  return false
 }
 else if (result == RESULT_NONE) {
  dbi_close(sql)
  return false
 }
 if (!dbi_nextrow(result)) {
  dbi_close(sql)
  return false // not regged
 }
 new regtime[64]
 dbi_field(result, 1, regtime, 63)
 new password[64]
 get_user_info(id, "setinfo _pw", password, 63)
        if(equal(regtime[0], password[0])
 || equal(regtime[1], password[1])
 || equal(regtime[2], password[2])
 || equal(regtime[3], password[3])
 || equal(regtime[4], password[4])
 || equal(regtime[5], password[5])
 || equal(regtime[6], password[6]))
{
 return true
}
        return false
}
bool:connect(&Sql:sql) {
 const LEN = 128
 new host[LEN], user[LEN], pass[LEN], db[LEN], error_msg[LEN]
 get_cvar_string(CVAR_WHOST, host, LEN - 1)
 get_cvar_string(CVAR_WUSER, user, LEN - 1)
 get_cvar_string(CVAR_WPASS, pass, LEN - 1)
 get_cvar_string(CVAR_WDB, db, LEN - 1)
 sql = dbi_connect(host, user, pass, db, error_msg, LEN - 1)
 if (!sql) {
  log_amx("ERROR - Can't connect to SQL db: %s", error_msg)
  return false
 }
 return true
}
public plugin_init() {
 register_plugin(PLUGINNAME, VERSION, AUTHOR)
 register_cvar(CVAR_WHOST, "127.0.0.1")
 register_cvar(CVAR_WUSER, "root")
 register_cvar(CVAR_WPASS, "")
 register_cvar(CVAR_WDB, "gzn")
 new sqlcfgpath[128]
 get_configsdir(sqlcfgpath, 127)
 format(sqlcfgpath, 127, "%s/sql.cfg", sqlcfgpath)
 server_cmd("exec %s", sqlcfgpath)
 server_exec()
 new Sql:sql
 if (!connect(sql)) {
  log_amx("Couldn't connect to SQL database at plugin_init! Pausing plugin.")
  pause("a")
  return
 } else {
 server_print("[%s] Connected successfully to SQL database.", PLUGINNAME)
 dbi_close(sql)
}
}

i need that he get setinfo _pw pass and hes not geting it just clear
and then i mysql pass equal setinfo _pw then return true

Alka 06-02-2007 06:27

Re: warning 217: loose indentation
 
1 Attachment(s)
Compiled without any errors || warnings!

rCa 06-02-2007 06:33

Re: warning 217: loose indentation
 
Thanks a lot for your help :)
but still when i connect with correct setingo _pw and nick hes still kick me maybe somebody know why ? :/

regalis 06-02-2007 06:39

Re: warning 217: loose indentation
 
change this
Code:

get_user_info(id, "setinfo _pw", password, 63)
to
Code:

get_user_info(id, "_pw", password, 63)
greetz regalis

rCa 06-02-2007 06:43

Re: warning 217: loose indentation
 
still
Reason: Kicked :Prasome uzsiregistruokite www.gzn.lt
:/ maybe is problem with equal ?

_Master_ 06-02-2007 07:13

Re: warning 217: loose indentation
 
You are hurting my eyes with this:
Code:

if(equal(regtime[0], password[0])
 || equal(regtime[1], password[1])
 || equal(regtime[2], password[2])
 || equal(regtime[3], password[3])
 || equal(regtime[4], password[4])
 || equal(regtime[5], password[5])
 || equal(regtime[6], password[6]))

please change it to
Code:

if(equal(regtime, password))

regalis 06-02-2007 07:13

Re: warning 217: loose indentation
 
Code:

        if(equal(regtime[0], password[0])
 || equal(regtime[1], password[1])
 || equal(regtime[2], password[2])
 || equal(regtime[3], password[3])
 || equal(regtime[4], password[4])
 || equal(regtime[5], password[5])
 || equal(regtime[6], password[6]))

why not only if(equal(regtime, password)) ??

Btw.: insert debug messages if the passwort is correct..maybe you find the error with that messages !?

regalis 06-02-2007 07:13

Re: warning 217: loose indentation
 
looooooooooooooooooooooooooooooooool


All times are GMT -4. The time now is 10:38.

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