How do I get the first three letters of a name? - 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: How do I get the first three letters of a name? (
/showthread.php?tid=260279)
How do I get the first three letters of a name? -
linuxthefish - 08.06.2011
How do I get the first three letters of a name exluding clantag? Thanks.
[FOX]Gonad > Gon
Finlay > Fin
linuxthefish > lin
[FOX]FriedEGG > Fri
Re: How do I get the first three letters of a name? -
Vince - 08.06.2011
https://sampwiki.blast.hk/wiki/Strmid
Excluding clantags will be a little bit tricky, because you don't know what their excact length will be. You could use strfind to find the first occurance of ']' and use that as the start index for strmid (and index + 3 for the end). However, if someone with a name like
]]someone[[ joines, this won't work.
Re: How do I get the first three letters of a name? -
linuxthefish - 08.06.2011
Thanks