How replace this with strins?
#10

Enjoy
NOTE: you will have a problem if you dont set the player's color
pawn Код:
SetPlayerColor(playerid,color);
current "id's" limit 10

and heres your loop


EDIT: NEW VERSION (bug free)
PM me if you found any bugs

pawn Код:
public OnPlayerText(playerid, text[])
{
    new findid=strfind(text,"id",true,0);
    if(findid!=-1)
    {  
        new msg[20],id,extra,name[MAX_PLAYER_NAME],tempmsg[300],tempmsg2[300],index,success;
        format(tempmsg2,sizeof(tempmsg2),"%s",text);
        for(new i;i!=10;i++)
        {
            new pname[MAX_PLAYER_NAME];
            findid=strfind(tempmsg2,"id",true,index);
            index=findid+5;
            if(findid==-1)
            {
                break;
            }
            strmid(msg,tempmsg2,findid,findid+5);
            if(sscanf(msg,"uu",extra,id))
            {
                continue;
            }
            if(id==INVALID_PLAYER_ID)
            {
                continue;
            }
            GetPlayerName(id,pname,sizeof(pname));
            strdel(tempmsg2,findid,index);
            strins(tempmsg2,"{%06x}%s{FFFFFF} ",findid,strlen("{%06x}%s{FFFFFF}"));
            format(tempmsg,sizeof(tempmsg),tempmsg2,GetPlayerColor(id) >>> 8,pname);
            format(tempmsg2,sizeof(tempmsg2),"%s",tempmsg);
            success++;
        }
        if(success==0)
        {
            return 1;
        }
        GetPlayerName(playerid,name,sizeof(name));
        format(tempmsg2,sizeof(tempmsg2),"{%06x}%s:  {FFFFFF}",GetPlayerColor(playerid) >>> 8,name);
        strcat(tempmsg2,tempmsg);
        SendClientMessageToAll(-1,tempmsg2);
        return 0;
    }
    return 1;
}
Reply


Messages In This Thread
How replace this with strins? - by MasonSFW - 02.11.2014, 01:24
Re: How replace this with strins? - by MasonSFW - 02.11.2014, 01:01
Re: How replace this with strins? - by MasonSFW - 02.11.2014, 01:47
Re: How replace this with strins? - by Jefff - 02.11.2014, 01:49
Re: How replace this with strins? - by Quickie - 02.11.2014, 05:48
Re: How replace this with strins? - by MasonSFW - 02.11.2014, 05:55
Re: How replace this with strins? - by Quickie - 02.11.2014, 05:59
Re: How replace this with strins? - by MasonSFW - 02.11.2014, 06:00
Re: How replace this with strins? - by MasonSFW - 02.11.2014, 06:05
Re: How replace this with strins? - by Quickie - 02.11.2014, 08:12

Forum Jump:


Users browsing this thread: 4 Guest(s)