Why my gun not load[Mysql] - 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: Why my gun not load[Mysql] (
/showthread.php?tid=569596)
Why my gun not load[Mysql] -
SequenceCuz - 01.04.2015
see
PHP код:
public OnPlayerSpawn(playerid)
{
new fields, rows, string[128];
cache_get_data(rows, fields, gSQLHandle);
GivePlayerWeapon(playerid, cache_get_field_content_int(0, "Gunonhand", gSQLHandle), cache_get_field_content_int(0, "Ammoonhand", gSQLHandle));
format(query, sizeof(query), "UPDATE `user_accounts` SET `Gunonhand`=0,\
`Ammoonhand`=0 WHERE `UserID` = %i", PlayerInfo[playerid][pUserID]);
mysql_function_query(gSQLHandle, query, false, "SaveUserAccount", "ii", playerid, 3);
The valve is already store in the database as i' had checked but here it seem a problem
Where am i wrong
Re: Why my gun not load[Mysql] -
Infamous - 01.04.2015
You should try placing the info from the database into temporary vars when the player connects and then give the player the weapon info from the vars instead of calling on MySQL every time they spawn.
Re: Why my gun not load[Mysql] -
Vince - 01.04.2015
Quote:
Originally Posted by Infamous
You should try placing the info from the database into temporary vars when the player connects and then give the player the weapon info from the vars instead of calling on MySQL every time they spawn.
|
That's not a big deal. This forum runs MySQL. Every time a user requests a page it sends about 15 queries. There are over 700 active users right now. You do the math.
Re : Why my gun not load[Mysql] -
Golimad - 01.04.2015
This forums database is good enough, probably not his. I'd say, Mysql is good, but sometimes you have to use files includes. Weapons Data could be in files, use Y_ini or whatever you feel comfortable using. If your database isn't really good to hold many connections at a time, OnPlayerSpawn queries isn't great.