Discard something loaded - 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: Discard something loaded (
/showthread.php?tid=281810)
Discard something loaded -
Scenario - 07.09.2011
I am using sscanf to load information from a MySQL database. I am loading something I don't need to save into a variable, it is more for the database. Is there a way to discard of the data, without saving it into a useless variable?
Re: Discard something loaded -
PrawkC - 07.09.2011
Heres my load player
pawn Код:
stock LoadPlayer(playerid)
{
new tmp[200];
format(tmp, sizeof(tmp), "SELECT * FROM players WHERE username = '%s'", p_data[playerid][name]);
mysql_query(tmp);
mysql_store_result();
if(mysql_num_rows() == 0) return printf("Failed to load data for %s he isn't registered!", p_data[playerid][name]);
while(mysql_fetch_row_format(tmp,"|"))
{
sscanf(tmp, "p<|>i{s[24]s[24]s[24]}i",
p_data[playerid][SQLID],
p_data[playerid][admin]);
}
return printf("Player %s loaded, values admin = %d | kills = %d", p_data[playerid][name] ,p_data[playerid][admin]);
}
using { } around the fields you dont want to be used (in the sscanf line)
Re: Discard something loaded -
Scenario - 07.09.2011
Quote:
Originally Posted by PrawkC
Heres my load player
pawn Код:
stock LoadPlayer(playerid) { new tmp[200]; format(tmp, sizeof(tmp), "SELECT * FROM players WHERE username = '%s'", p_data[playerid][name]); mysql_query(tmp); mysql_store_result(); if(mysql_num_rows() == 0) return printf("Failed to load data for %s he isn't registered!", p_data[playerid][name]); while(mysql_fetch_row_format(tmp,"|")) { sscanf(tmp, "p<|>i{s[24]s[24]s[24]}i", p_data[playerid][SQLID], p_data[playerid][admin]); } return printf("Player %s loaded, values admin = %d | kills = %d", p_data[playerid][name] ,p_data[playerid][admin]); }
using { } around the fields you dont want to be used (in the sscanf line)
|
Oh awesome, thanks!