/* Function: db_load Parameters: DB:database - The database handle. extraid - Used for passing an extra ID (example: playerid) function[] - Name of the function pass the data to. query[] - Query to execute. ... - Additional arguments. Returns: The number of rows returned from the query. */ native db_load(DB:database, extraid, const function[], const query[], {Float, DB, _}:...);
forward OnSQLiteLoad(extraid, row, const field[], const name[]);
/* Callback: OnSQLiteLoad Parameters: extraid - Extra ID, passed earlier in db_load. row - Index of the row. Starts from zero! field[] - Name of the field. value[] - Self explanatory. Returns: No significant value. */
db_load(gDatabase, playerid, "OnLoadPlayerData", "SELECT * FROM users WHERE username = '%s'", name);
forward OnLoadPlayerData(playerid, row, const field[], const name[]); public OnLoadPlayerData(playerid, row, const field[], const name[]) { db_get_int("money", gPlayerMoney[playerid]); db_get_float("health", gPlayerHealth[playerid]); db_get_string("accent", gPlayerAccent[playerid], 24); }
new rows = db_load(gDatabase, -1, "OnLoadHouses", "SELECT * FROM houses"); printf("%d houses loaded!", rows);
forward OnLoadHouses(extraid, row, const field[], const name[]); public OnLoadHouses(extraid, row, const field[], const name[]) { /* * extraid is not needed here. * Instead, we will use "row", which contains the index of the row. */ db_get_int("id", gHouseData[row][hID]); db_get_string("owner", gHouseData[row][hOwner], MAX_PLAYER_NAME); db_get_int("price", gHouseData[row][hPrice]); db_get_float("x", gHouseData[row][hX]); db_get_float("y", gHouseData[row][hY]); db_get_float("z", gHouseData[row][hZ]); }
C:\Users\Marius\Desktop\sa\GameMode\gamemodes\Okla homa.pwn(351) : error 017: undefined symbol "value" C:\Users\Marius\Desktop\sa\GameMode\gamemodes\Okla homa.pwn(354) : error 017: undefined symbol "value" C:\Users\Marius\Desktop\sa\GameMode\gamemodes\Okla homa.pwn(359) : error 017: undefined symbol "value" C:\Users\Marius\Desktop\sa\GameMode\gamemodes\Okla homa.pwn(361) : error 017: undefined symbol "value" C:\Users\Marius\Desktop\sa\GameMode\gamemodes\Okla homa.pwn(362) : error 017: undefined symbol "value" C:\Users\Marius\Desktop\sa\GameMode\gamemodes\Okla homa.pwn(363) : error 017: undefined symbol "value" C:\Users\Marius\Desktop\sa\GameMode\gamemodes\Okla homa.pwn(364) : error 017: undefined symbol "value" |