22.01.2012, 12:27
You're returning 2 types of data (1 is a string when you return "Result", the other one is a boolean when you return "false"). PAWN expects you to return the same data data type. A possible fix would be:
I hope that made sense, code is untested but should work fine.
pawn Code:
stock Load(DataType[], Stat[], For[]) {
new Result[128]; // Gets initialized to NULL
if(strcmp(For, "None", true) == 0) {
#pragma unused For
}
if(strcmp(DataType, "serverdata", true) == 0) {
new Query[128];
format(Query, 128, "SELECT * FROM serverdata LIMIT 1");
mysql_query(Query);
mysql_store_result();
while(mysql_fetch_row_format(Query, "|")) {
if(strcmp(Stat, "Name", true) == 0) {
mysql_fetch_field_row(Result, "Name");
}
if(strcmp(Stat, "Mode", true) == 0) {
mysql_fetch_field_row(Result, "Mode");
}
if(strcmp(Stat, "Map", true) == 0) {
mysql_fetch_field_row(Result, "Map");
}
}
mysql_free_result();
}
return Result; // Returns either the actual result or NULL
}