SA-MP Forums Archive
Im trying to put this code. - 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: Im trying to put this code. (/showthread.php?tid=628370)



Im trying to put this code. - gamersx - 09.02.2017

Hi,i'm trying to put this code on my gamemode.

new
string[180] ,i;
strcat(string,text);
while(string[i])
{
if((string[i] == '*' && string[i+1] != '*')||(string[i] == '-' && string[i+1] != '-'))
{
strdel(string,i,i+1);
strins(string,"{FA7E7D}",i);
}
i++;
}

But after compiling i get tons of error on almost all lines saying "local variable "i" shadows a variable at a preceding level " ,etc. Thanks for reading.


Re: Im trying to put this code. - iLearner - 09.02.2017

From what i see it should be something like:

PHP код:
stock SomeName(text[])
{
new
string[180] ,i;
strcat(string,text);
while(
string[i])
{
if((
string[i] == '*' && string[i+1] != '*')||(string[i] == '-' && string[i+1] != '-'))
{
strdel(string,i,i+1);
strins(string,"{FA7E7D}",i);
}
i++;
}




Re: Im trying to put this code. - gamersx - 09.02.2017

Hello, it compile right. The problem i think , its not working. i want to do this, when you write " Hello how are you *looking into his eyes* " that part want to be in color , its for roleplay.