Only first letter, instead of the whole word HELP please [enum + mySQL + Variables] - 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: Only first letter, instead of the whole word HELP please [enum + mySQL + Variables] (
/showthread.php?tid=291405)
Only first letter, instead of the whole word HELP please [enum + mySQL + Variables] -
jesse237 - 19.10.2011
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!
Re: Only first letter, instead of the whole word HELP please [enum + mySQL + Variables] -
KoczkaHUN - 22.10.2011
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);