public loadMBs() { print("loading moneybags initialized"); for(new i = 0; i < cache_get_row_count(mysql); ++i) { cache_get_field_content(i, "mbloc", MBInfo[i][mbloc], mysql,128); MBInfo[i][mbX] = cache_get_field_content_float(i, "mbX", mysql); MBInfo[i][mbY] = cache_get_field_content_float(i, "mbY", mysql); MBInfo[i][mbZ] = cache_get_field_content_float(i, "mbZ", mysql); totalMoneyBags++; } printf("%d moneybags loaded!", totalMoneyBags); mbTimer[1] = SetTimer("MoneyBag", 300000, true); return 1; }
new randombag = random(sizeof(totalMoneyBags)); printf("%d", randombag); MoneyBagPos[0] = MBInfo[randombag][mbX]; MoneyBagPos[1] = MBInfo[randombag][mbY]; MoneyBagPos[2] = MBInfo[randombag][mbZ]; MBInfo[randombag][mbactive] = 1;
public loadMBs()
{
print("loading moneybags initialized");
for(new i = 0; i < cache_get_row_count(mysql); ++i)
{
cache_get_field_content(0, "mbloc", MBInfo[i][mbloc], mysql,128);
MBInfo[i][mbX] = cache_get_field_content_float(1, "mbX", mysql);
MBInfo[i][mbY] = cache_get_field_content_float(2, "mbY", mysql);
MBInfo[i][mbZ] = cache_get_field_content_float(3, "mbZ", mysql);
totalMoneyBags++;
}
printf("%d moneybags loaded!", totalMoneyBags);
mbTimer[1] = SetTimer("MoneyBag", 300000, true);
return 1;
}
Now it doesn't create any moneybags. Do I have to change anything in the mb creation function?
Edit : Fixed it on my own, thanks anyways. |
new randombag = random(sizeof(totalMoneyBags));
new randombag = random(sizeof(MBInfo));
#define MAX_MBS 19
enum moneybagsystem
{
mbloc[30],
Float:mbX,
Float:mbY,
Float:mbZ,
mbactive
}
new MBInfo[MAX_MBS][moneybagsystem];