Only first letter, instead of the whole word HELP please [enum + mySQL + Variables]
#1

Thanks for checking my thread, I'm having an issue with this code:

Код:
                businessVariables[x][bProduct1]= systemItems[ProductID][iName];
                format(string, sizeof(string), "You have ordered %d %s 's on slot %d and set their price to $ %d", businessVariables[x][bProductAmount1], businessVariables[x][bProduct1], ProductSlot, businessVariables[x][bProductPrice1]);
                SendClientMessage(playerid, COLOR_GREY, string);
It will only change the first letter of the previous Product to the first letter of the new product.
Previous: Cigar
New: Beer
So what we get is: You have ordered 50 Bigar's on slot 1 and set their price to $ 5.

the code works fine like this:
Код:
                businessVariables[x][bProduct1]= systemItems[ProductID][iName];
                format(string, sizeof(string), "You have ordered %d %s 's on slot %d and set their price to $ %d", businessVariables[x][bProductAmount1], systemItems[ProductID][iName], ProductSlot, businessVariables[x][bProductPrice1]);
                SendClientMessage(playerid, COLOR_GREY, string);
I get: You have ordered 50 Beer's on slot 1 and set their price to $ 5.

But also in my mySQL database, businessProduct1 (bProduct1) shows as: Bigar
instead of Beer.

So I'm wondering what I'm doing wrong, hope someone can help me out!
Reply
#2

Use strcopy:
pawn Код:
#define strcopy(%0,%1) strcat((%0[0] = EOS, %0), %1)
Код:
                strcopy(businessVariables[x][bProduct1], systemItems[ProductID][iName]);
                format(string, sizeof(string), "You have ordered %d %s 's on slot %d and set their price to $ %d", businessVariables[x][bProductAmount1], businessVariables[x][bProduct1], ProductSlot, businessVariables[x][bProductPrice1]);
                SendClientMessage(playerid, COLOR_GREY, string);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)