SA-MP Forums Archive
[mysql] does not read variables o.o - 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: [mysql] does not read variables o.o (/showthread.php?tid=636590)



[mysql] does not read variables o.o - Lirbo - 30.06.2017

PHP код:
mysql_format(sqlquerysizeof query"SELECT * FROM `user_weapon_pack1` WHERE `id` = %d"DB[playerid][ID]);
    
result mysql_query(sqlquery);
    
cache_get_field_content(0"pack_name"DB[playerid][Pack1Name]);
    
cache_get_field_content(0"hand"DB[playerid][Pack1Hand]);
    
cache_get_field_content(0"melee"DB[playerid][Pack1Melee]);
    
cache_get_field_content(0"unique"DB[playerid][Pack1Unique]);
    
cache_get_field_content(0"grenade"DB[playerid][Pack1Grenade]);
    
cache_get_field_content(0"secondary"DB[playerid][Pack1Secondary]);
    
cache_get_field_content(0"shotgun"DB[playerid][Pack1Shotgun]);
    
cache_get_field_content(0"sub-machine"DB[playerid][Pack1SubMachine]);
    
cache_get_field_content(0"primary"DB[playerid][Pack1Primary]);
    
cache_get_field_content(0"sniper"DB[playerid][Pack1Sniper]);
    
cache_get_field_content(0"missile"DB[playerid][Pack1Missile]);
    
cache_get_field_content(0"spray"DB[playerid][Pack1Spray]);
    
cache_delete(result); 
all of those [DB][playerid][Whatever] are still blank for some reason


Re: [mysql] does not read variables o.o - HoussemGaming - 30.06.2017

use
Код:
mysql_tquery(sql, query, "Loading", "i", playerid)
and after forward the Loading and put that cache function in it


Re: [mysql] does not read variables o.o - Freedom. - 30.06.2017

Try like that:
Код:
mysql_format(sql, query, sizeof(query), "SELECT * FROM `user_weapon_pack1` WHERE `id` = %d", DB[playerid][ID]);
mysql_tquery(sql, query, "LoadWeapons", "d", playerid);

forward LoadWeapons(playerid);
public LoadWeapons(playerid)
{
	cache_get_field_content(0, "pack_name", DB[playerid][Pack1Name]);
	cache_get_field_content(0, "hand", DB[playerid][Pack1Hand]);
	cache_get_field_content(0, "melee", DB[playerid][Pack1Melee]);
	cache_get_field_content(0, "unique", DB[playerid][Pack1Unique]);
	cache_get_field_content(0, "grenade", DB[playerid][Pack1Grenade]);
	cache_get_field_content(0, "secondary", DB[playerid][Pack1Secondary]);
	cache_get_field_content(0, "shotgun", DB[playerid][Pack1Shotgun]);
	cache_get_field_content(0, "sub-machine", DB[playerid][Pack1SubMachine]);
	cache_get_field_content(0, "primary", DB[playerid][Pack1Primary]);
	cache_get_field_content(0, "sniper", DB[playerid][Pack1Sniper]);
	cache_get_field_content(0, "missile", DB[playerid][Pack1Missile]);
	cache_get_field_content(0, "spray", DB[playerid][Pack1Spray]);
	return 1;
}



Re: [mysql] does not read variables o.o - GoldenLion - 30.06.2017

https://sampwiki.blast.hk/wiki/MySQL/R33..._field_content
Read the red box.