Want to Convert Specific Text....
#1

Hello i've a code to convert texts... like if i write $loc in chat it converts it into "My Location"
so i've a problem with it, it sends new clientmessage skipping realone...
so it is good for main chat under onplayertext but when i used it in command /pm and its color is yellow and some method of sending message is change it is "PM From Name (ID): message.." but it send only white message like main chat..

it do not convert text but skip real message and create newone...
code
pawn Код:
CheckQuickStrings(playerid, text[])
{
    new idx = strfind(text, "$");

    if(idx != -1)
    {
        new string[144];
        strcat(string, text);
        do
        {
            if(strcmp(string[idx], "$loc", true, 4) == 0)
            {
                new zone[MAX_ZONE_NAME];
                GetPlayer2DZone(playerid, zone, MAX_ZONE_NAME);

                strdel(string, idx, idx + 4);
                strins(string, zone, idx);
                continue;
            }
            else
            if(strcmp(string[idx], "$cash", true, 5) == 0)
            {
                new pmoney[70];
                format(pmoney, sizeof(pmoney), "$%d",GetPlayerCash(playerid));

                strdel(string, idx, idx + 5);
                strins(string, pmoney, idx);
                continue;
            }
            else
            if(strcmp(string[idx], "$ply", true, 4) == 0)
            {
                new closeststr[100], closestplayer = GetPlayerWhoIsClosest(playerid);

                if(IsPlayerConnected(closestplayer))
                format(closeststr, sizeof(closeststr), "%s (%d)",PlayerInfo[closestplayer][pName],closestplayer);
                else
                format(closeststr, sizeof(closeststr), "%s (%d)",PlayerInfo[playerid][pName], playerid);

                strdel(string, idx, idx + 4);
                strins(string, closeststr, idx);
                continue;
            }
        }
        while((idx = strfind(string, "$", false, idx + 1)) != -1);

        SendPlayerMessageToAll(playerid, string);
    }
    return 1;
}
Reply
#2

As I told in your previous post, mix both the stock and command.
Reply
#3

Quote:
Originally Posted by ATGOggy
Посмотреть сообщение
As I told in your previous post, mix both the stock and command.
didnt got you..
Reply
#4

anyone?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)