17.03.2019, 13:51
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);
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);