AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Solved Run time error 10: (native "SQL_ReadResult") [Getting #Rank from database] (https://forums.alliedmods.net/showthread.php?t=299119)

heroicpower7613 07-03-2017 14:52

Run time error 10: (native "SQL_ReadResult") [Getting #Rank from database]
 
related topic here but its very unclear if there's a fix or not
https://forums.alliedmods.net/showth...t=68161&page=2

there's another plugin that shows rank with this plugin's native

errors:
Spoiler


code (i made a comment where the error line is):
Spoiler

Black Rose 07-03-2017 17:13

Re: Run time error 10: (native "SQL_ReadResult") [Getting #Rank from database]
 
The errors you have is one error. The first line is the most important one.

Check if you have any result before trying to read it using SQL_NumResults().

heroicpower7613 07-03-2017 22:29

Re: Run time error 10: (native "SQL_ReadResult") [Getting #Rank from database]
 
like this?
Code:
public Sql_Rank(FailState,Handle:Query,Error[],Errcode,Data[],DataSize) {     if(FailState == TQUERY_CONNECT_FAILED)         log_amx("Could not load - Error connecting to database. [%d] %s", Errcode, Error)     else if(FailState == TQUERY_QUERY_FAILED)         log_amx("Load Query failed. [%d] %s", Errcode, Error)             new id; id = Data[0];         if( !is_user_connected( id ) )     {         Rank[id] = 0;         return PLUGIN_HANDLED;     }         if( SQL_NumResults( Query ) > 1 )         Rank[id] = SQL_ReadResult(Query, 0);         return PLUGIN_HANDLED; }

i'll see if the error stops ty

Black Rose 07-04-2017 06:02

Re: Run time error 10: (native "SQL_ReadResult") [Getting #Rank from database]
 
Now you require 2 or more results to read it. Perhaps > 0 or => 1 to include 1 result as well.

heroicpower7613 07-04-2017 07:47

Re: Run time error 10: (native "SQL_ReadResult") [Getting #Rank from database]
 
yes haha I was just derping I did notice it.
btw shouldn't just this work too?
Code:
if( SQL_NumResults( Query ) )         Rank[id] = SQL_ReadResult(Query, 0);

Black Rose 07-04-2017 15:20

Re: Run time error 10: (native "SQL_ReadResult") [Getting #Rank from database]
 
Unless that native doesn't return negative numbers on errors, yes.

heroicpower7613 07-05-2017 07:15

Re: Run time error 10: (native "SQL_ReadResult") [Getting #Rank from database]
 
ok it's been few days and as far as I can tell this is fixed.
the error definitely should've occurred by now so thanks


All times are GMT -4. The time now is 22:49.

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