03.04.2013, 02:26
I would like to know how to fix this:
I get this errors:
At this line:
pawn Code:
public OnPlayerText(playerid, text[])
{
new finalstr[128+MAX_PLAYER_NAME], str3[3];
format(finalstr, sizeof(finalstr), "%s", text);
new startpos = strfind(finalstr, "id", true), len=0;
if(startpos != -1)
{
for(new i=0;i<3;i++) if(finalstr[startpos+2+i] >= 48 && finalstr[startpos+2+i] <= 57) len++; else break;
if(len > 0)
{
strmid(str3, finalstr, startpos+2, startpos+2+len);
if(IsPlayerConnected(strval(str3)))
{
new temp[5];
format(temp, 5, "id%s", str3);
strreplace(finalstr, temp, PlayerName(strval(str3)));
SendClientMessageToAll(0xffffffff, finalstr);
}
else SendClientMessageToAll(0xffffffff, text);
}
else SendClientMessageToAll(0xffffffff, text);
}
else SendClientMessageToAll(0xffffffff, text);
return 0;
}
stock PlayerName(playerid)
{
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, MAX_PLAYER_NAME);
return name;
}
stock strreplace(string[], const search[], const replacement[], bool:ignorecase = false, pos = 0, limit = -1, maxlength = sizeof(string)) {
// No need to do anything if the limit is 0.
if (limit == 0)
return 0;
new
sublen = strlen(search),
replen = strlen(replacement),
bool:packed = ispacked(string),
maxlen = maxlength,
len = strlen(string),
count = 0
;
// "maxlen" holds the max string length (not to be confused with "maxlength", which holds the max. array size).
// Since packed strings hold 4 characters per array slot, we multiply "maxlen" by 4.
if (packed)
maxlen *= 4;
// If the length of the substring is 0, we have nothing to look for..
if (!sublen)
return 0;
// In this line we both assign the return value from "strfind" to "pos" then check if it's -1.
while (-1 != (pos = strfind(string, search, ignorecase, pos))) {
// Delete the string we found
strdel(string, pos, pos + sublen);
len -= sublen;
// If there's anything to put as replacement, insert it. Make sure there's enough room first.
if (replen && len + replen < maxlen) {
strins(string, replacement, pos, maxlength);
pos += replen;
len += replen;
}
// Is there a limit of number of replacements, if so, did we break it?
if (limit != -1 && ++count >= limit)
break;
}
return count;
}
Code:
.pwn(2025) : error 025: function heading differs from prototype .pwn(2025) : error 025: function heading differs from prototype .pwn(2025) : error 025: function heading differs from prototype .pwn(2025) : fatal error 107: too many error messages on one line
pawn Code:
stock strreplace(string[], const search[], const replacement[], bool:ignorecase = false, pos = 0, limit = -1, maxlength = sizeof(string)) {