Problem with a stock - 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: Problem with a stock (
/showthread.php?tid=364044)
Problem with a stock -
Strech - 29.07.2012
pawn Код:
stock strreplace(string[], find, replace)
{
for(new i=0; string[i]; i++)
{
if(string[i] == find)
{
string[i] = replace;
}
}
}
That's the stock.
pawn Код:
C:\Documents and Settings\Dimitar\Desktop\samp03e_svr_win32\gamemodes\EsRp.pwn(97) : error 025: function heading differs from prototype
C:\Documents and Settings\Dimitar\Desktop\samp03e_svr_win32\gamemodes\EsRp.pwn(98) : error 021: symbol already defined: "strreplace"
C:\Documents and Settings\Dimitar\Desktop\samp03e_svr_win32\gamemodes\EsRp.pwn(106) : warning 209: function "strreplace" should return a value
C:\Documents and Settings\Dimitar\Desktop\samp03e_svr_win32\gamemodes\EsRp.pwn(113) : error 035: argument type mismatch (argument 2)
And i get these errors.What's the problem.
Re: Problem with a stock -
Dolby - 29.07.2012
Do you already have this Stock in your script...
pawn Код:
stock strreplaceEX(string[], find, replace)
{
for(new i=0; strlen(string); i++)
{
if(string[i] == find)
{
string[i] = replace;
}
}
return 1;
}
Re: Problem with a stock -
Misiur - 29.07.2012
1. You probably have forward, because...
2. The function is there already somewhere
3. return is needed
4. "A" != 'A' - first is string containing A\0, second one is single character
Re: Problem with a stock -
Strech - 29.07.2012
Fixed.Thanks people.