SA-MP Forums Archive
I need a bit of help here! [easy I guess] - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: I need a bit of help here! [easy I guess] (/showthread.php?tid=200216)



I need a bit of help here! [easy I guess] - Baboon - 17.12.2010

how can I put a piece of text as a string?

I've got this, but I get an error....

Quote:

weaponp = M4A1;

also I have a:

Quote:

new weaponp;

at the top...

and I have:
Код:
new primary[128];
new secondairy[128];
new extra[128];
format(primary, sizeof(primary), "%s", weaponp);
TextDrawSetString(shop4,primary);
shop4 = TextDrawCreate(259.000000, 360.000000, "AK74");
TextDrawBackgroundColor(shop4, 255);
TextDrawFont(shop4, 1);
TextDrawLetterSize(shop4, 0.500000, 1.000000);
TextDrawColor(shop4, -1);
TextDrawSetOutline(shop4, 0);
TextDrawSetProportional(shop4, 1);
TextDrawSetShadow(shop4, 1);
how can I give the string a piece of text?


Re: I need a bit of help here! [easy I guess] - Biesmen - 17.12.2010

pawn Код:
new string[51];

format(string, sizeof(string), "M4A1");



Re: I need a bit of help here! [easy I guess] - Baboon - 17.12.2010

may I ask why you used 51 and where do I have to put this format? thanks.


Re: I need a bit of help here! [easy I guess] - Biesmen - 17.12.2010

51 is the length, the shorter, the less waste of memory.

Use this code:

pawn Код:
new primary[128];
new secondairy[128];
new extra[128];
format(primary, sizeof(primary), "M4A1"); // Modified this line.
TextDrawSetString(shop4,primary);
shop4 = TextDrawCreate(259.000000, 360.000000, "AK74");
TextDrawBackgroundColor(shop4, 255);
TextDrawFont(shop4, 1);
TextDrawLetterSize(shop4, 0.500000, 1.000000);
TextDrawColor(shop4, -1);
TextDrawSetOutline(shop4, 0);
TextDrawSetProportional(shop4, 1);
TextDrawSetShadow(shop4, 1);