14.04.2013, 13:08 
	(
 Last edited by Ash.; 14/04/2013 at 01:59 PM.
)
	
	Quote:
| It would be so difficult to do that. I've been working for this one. I will fix it if i've time. It works fine when typing the numeric numbers. However, If you type the text not the numeric ones. It wouldn't display the text parameters OnPlayerText. It is because it return wrong. Current i will not give the code i'm current working on it. | 
You mean something like...
pawn Code:
public OnPlayerText(playerid, text[])
{
new idCheck = strfind(text, "id", true);
if(idCheck != -1)
{
new sid[128];
strcat(sid, text);
strdel(sid, 0, idCheck);
new spacePos = strfind(sid, " ");
if(spacePos != -1) strdel(sid, spacePos, strlen(sid));
new newString[128], pName[24];
GetPlayerName(strval(sid[2]), pName, 24);
strcat(newString, str_replace(sid, pName, text));
SendPlayerMessageToAll(playerid, newString);
return 0;
}
return 1;
}
pawn Code:
/*
Snippet taken from:
strlib library for string manipulation.
Created by David Weston
Version: 1.3
Licence: http://www.typefish.co.uk/licences/
*/
stock str_replace(sSearch[], sReplace[], const sSubject[], &iCount = 0)
{
new
iLengthTarget = strlen(sSearch),
iLengthReplace = strlen(sReplace),
iLengthSource = strlen(sSubject),
iItterations = (iLengthSource - iLengthTarget) + 1;
new
sTemp[128],
sReturn[128];
strcat(sReturn, sSubject, 128);
iCount = 0;
for(new iIndex; iIndex < iItterations; ++iIndex)
{
strmid(sTemp, sReturn, iIndex, (iIndex + iLengthTarget), (iLengthTarget + 1));
if(!strcmp(sTemp, sSearch, false))
{
strdel(sReturn, iIndex, (iIndex + iLengthTarget));
strins(sReturn, sReplace, iIndex, iLengthReplace);
iIndex += iLengthTarget;
iCount++;
}
}
return sReturn;
}



