11.01.2019, 22:51
Post the giftbox enum, there should be a ID included. If so you can do it:
Or else making sure it works:
But I'm sure you've done the giftbox defines wrong, this one looks weird
Please search before posting and read this https://sampwiki.blast.hk/wiki/MySQL/R33 and this https://www.guru99.com/delete-and-update.html
pawn Код:
mysql_format(SQL,zzString,sizeof(zzString),"UPDATE `giftboxd` SET `GiftBoxMoney`= '%s' WHERE `ID`= %i", GiftBoxInfo[playerid][pGiftBoxMoney], GiftBoxInfo[playerid][ID]);
mysql_tquery(SQL,zzString);
pawn Код:
mysql_format(SQL,zzString,sizeof(zzString),"UPDATE `giftboxd` SET `GiftBoxMoney`= '%s' WHERE `ID`= %i", GiftBoxInfo[playerid][pGiftBoxMoney], GiftBoxInfo[playerid][ID]);
mysql_tquery(SQL,zzString, "OnUpdateGiftBox", "i", GiftboxInfo[playerid][ID]);
forward OnUpdateGiftBox(giftboxid);
public OnUpdateGiftBox(giftboxid)
{
if(cache_affected_rows() > 0)
{
printf("Saved giftbox id %d", giftboxid);
}
else
{
printf("An error has occured while saving the giftbox");
}
return 1;
}
pawn Код:
if(IsPlayerInRangeOfPoint(playerid, 5.0, GiftBoxInfo[playerid][pGiftBoxPosX], GiftBoxInfo[playerid][pGiftBoxPosY], GiftBoxInfo[playerid][pGiftBoxPosZ]))
pawn Код:
for(new i = 0; i < MAX_PLAYERS; i++) //you could've done a MAX_GIFTBOX
{
if(IsPlayerInRangeOfPoint(playerid, 5.0, GiftBoxInfo[i][pGiftBoxPosX], GiftBoxInfo[i][pGiftBoxPosY], GiftBoxInfo[i][pGiftBoxPosZ]))
{
//rest of your code
}
}