SA-MP Forums Archive
db_get_field_int Questions. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: db_get_field_int Questions. (/showthread.php?tid=655042)



db_get_field_int Questions. - lautaro97 - 11.06.2018

Hi, I've a question... I would like to know if there's another way to replace db_get_field_int and db_get_field_assoc_int in SA-MP versions lower than 0.3.7.

I made those codes and they work correctly, but as I said... їthere's another way to replace them?

Code:
SQLfield_int(DBResult:dbresult, col = 0)
{
	static columna[10];
	db_get_field(dbresult, col, columna, sizeof(columna));
	new const valor_int = strval(columna);
	return valor_int;
}

SQLfield_assoc_int(DBResult:dbresult, const col[])
{
	static columna[10];
	db_get_field_assoc(dbresult, col, columna, sizeof(columna));
	new const valor_int = strval(columna);
	return valor_int;
}
If there's not another way, at least I want to know if those codes are optimized.

Thank you for your time


Re: db_get_field_int Questions. - xMoBi - 11.06.2018

PHP Code:
db_get_field_assoc_int(DBResultresultfield 0)
{
    new 
_field[20], _field_int;
    
db_get_field(resultfield_fieldsizeof _field);
    
_field_int strval(_field);
    return 
_field_int;

Don't use this together.
PHP Code:
new const 
Use
PHP Code:
new 
.


Re: db_get_field_int Questions. - lautaro97 - 11.06.2018

їAnd what about the static variable?, I Thought I could use it since I'm using it only in this code and the integer is now in a new variable.


Re: db_get_field_int Questions. - Logic_ - 11.06.2018

You can use static variables though.


Re: db_get_field_int Questions. - lautaro97 - 11.06.2018

Ok, thank you guys for answer my questions.