SA-MP Forums Archive
This code with strmid correct? - 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: This code with strmid correct? (/showthread.php?tid=181287)



This code with strmid correct? - DarrenReeder - 04.10.2010

Hello,,

In my orgs enum i have got fColor which is a string, the string is only 10 characters long... And i have got a command in which i use sscanf which i use the change the value of fColor...but the variable i save my new Color with in the command is larger than 10 Characters, so it wont let me use
pawn Код:
orgsStats[orgID][fColor] = Value;
because Value is a larger string than fColor...

so i have tried this:
pawn Код:
strmid(orgStats[user][fColor], value, 0, 9);
it seems to of compiled, will it work okay?


Re: This code with strmid correct? - Jefff - 04.10.2010

use
pawn Код:
strcat(orgStats[user][fColor], value);



Re: This code with strmid correct? - DarrenReeder - 04.10.2010

Would both of these work though?

and thanks!


Re: This code with strmid correct? - bigcomfycouch - 04.10.2010

That will only work if 'orgsStats[orgID][fColor]' is null because strcat merges two strings into one string.

pawn Код:
orgsStats[orgID][fColor] = "lemon";
value = "cake";
strcat(orgStats[user][fColor], value); // orgsStats[orgID][fColor] now is 'lemoncake'



Re: This code with strmid correct? - DarrenReeder - 04.10.2010

So i should use my original one, yeah? It shuld replace the string...


Re: This code with strmid correct? - Jefff - 04.10.2010

so he must clear the array
pawn Код:
orgStats[user][fColor]="";
strcat(orgStats[user][fColor], value);
strmid works too btw