SA-MP Forums Archive
data base help - 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: data base help (/showthread.php?tid=664957)



data base help - bosmania - 17.03.2019

i tried to script this part alone but it's my first time working with a database and i don't think i did it right,like this are giftbox locations and the status if its active or not,and this code is put under on gamemode init and when i restart the server and i use /getgift it places the checkpoint at a random location every time i restart the gamemode,not at the location i saved,and yes, the gift positions are saved in the database.

new qstr[256];
format(qstr,100,"SELECT * FROM giftbox WHERE `ID`='1'");
new Cache: giftinfo = mysql_query(SQL,qstr);
if(cache_get_row_count() > 0)
{
GiftInfo[1][gGiftPosX] = cache_get_field_content_float(0, "GiftPosX");
GiftInfo[1][gGiftPosY] = cache_get_field_content_float(0, "GiftPosX");
GiftInfo[1][gGiftPosZ] = cache_get_field_content_float(0, "GiftPosX");
GiftInfo[1][gActive] = cache_get_field_content_int(0, "Active");
}
cache_delete(giftinfo);