strpack - problem
#1

Hello!

As the title says, I have a problem with strpack.

The thing is, I'm making an event system using dialogs.

...

So, I made a dialog to set the name for an event (inputtext), and it works like this:

pawn Код:
strpack(eName, inputtext);
And this is the code that shows the event name in a dialog:

pawn Код:
format(A, sizeof(A), "Event name: %s", eName);
ShowPlayerDialog(playerid, DIALOG_EVENT_NAME, DIALOG_STYLE_MSGBOX, "Event name", A, "Cancel", "");
PROBLEM:

Whenever I show the dialog "DIALOG_EVENT_NAME", the string doesn't show me the correct (name that was actually wrote), it shows me every fourth letter that is in the name.

For an example:

123(4)567(8) > 48

hop(e)goo(d) > ed

hid(e) > e

etc...

I don't see a problem...
Reply
#2

format doesn't support packed strings, you need use strunpack
https://sampwiki.blast.hk/wiki/Strunpack
Reply
#3

Why would you pack a string anyway?

Can someone explain the benefits of packing a string first and unpacking it afterwards, besides saving memory?
I know packed strings only consume 1 byte per character (8 bit), while unpacked strings consume 4 bytes per character (32 bit).

Perhaps you need packed strings for some DLL communication which only understands strings with 8-bit characters?
Other than that, I don't see a need to pack strings in a standard PAWN script.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)