SA-MP Forums Archive
Low signal simulation in a string: - 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: Low signal simulation in a string: (/showthread.php?tid=531903)



Low signal simulation in a string: - Twizted - 15.08.2014

I'm releasing a cellphone system and I've introduced radio towers for the same purpose. Towers have a certain range, and if you're not in the range, the signal will be low. However, I'm not quite sure how I could replace the message the player types with dots and hyphens, for example:

Hey ma.. c.. you hea.. me? Lo.. where I liv...

Could anyone give me a practical example on how to perform this and what functions to use?


Re: Low signal simulation in a string: - Virtual1ty - 15.08.2014

In real life, you don't receive the message in a low signal zone until you get a better signal. I've also done this a while back for my cellphone sys, the "signal bars".
I can only answer your question which functions to use: strfind, strdel and strins.


Re: Low signal simulation in a string: - Faisal_khan - 15.08.2014

This is inefficient but try to do something like this.
pawn Код:
new a = random(3);
    strdel(word, a, random(5));
    strins(word, "...", a);
Instead of the whole text work on each words. And I don't know how to work on each words. Maybe use sscanf() to get all the words and store them separately.


Re: Low signal simulation in a string: - legodude - 15.08.2014

loop over the string, use random to decide change the str[i] to a .