Posts: 53
Threads: 8
Joined: Feb 2015
Reputation:
0
Hello, I want to make a drug effect based on the function "strins". Can you tell me how I can add some crazy characters in the text written by the player?
Example:
I write "hello, it`s me!", but, on chat appear "Heeqewleo, dsait`s m2qwme!". This is just one example. How can I do this?
Posts: 734
Threads: 8
Joined: Jun 2009
A very hard thing to do, either have predefined list sets of what you will be inserting either at the start of every word, the end, or any random position. You can insert random characters at random positions but make sure you always know the (final) string length.
Posts: 53
Threads: 8
Joined: Feb 2015
Reputation:
0
You think you can do that? Can you show me an example?
Posts: 53
Threads: 8
Joined: Feb 2015
Reputation:
0
This example causes a bug in this callback
(Appears "Lunoxx: text", not "Lunoxx says: text", and name is colored with TAB color)
Posts: 734
Threads: 8
Joined: Jun 2009
The reason why I said this is very hard to do is because PAWN has static memory allocation. And for what you are doing you would need some kind of word tokeniser, specifically getting every word save to substrings and using the function posted by Adeon on each word.
Alternatively you could loop N times and run the function to insert at random places, you could add a check to test if the random position is not a space, or some other punctuation mark.