How replace this with strins?
#5

i got a better one
it only works for the first "id 0"
ill be adding loops later
pawn Код:
public OnPlayerText(playerid, text[])
{
    new findid=strfind(text,"id",true,0);
    if(findid!=-1)
    {  
        new msg[20],id,extra,pname[MAX_PLAYER_NAME],name[MAX_PLAYER_NAME];
        strmid(msg,text,findid,findid+5);
        if(sscanf(msg,"uu",extra,id))
        {
            return 1;
        }
        if(id==INVALID_PLAYER_ID)
        {
            return 1;
        }
        printf("findid %d",findid);
        GetPlayerName(id,pname,sizeof(pname));
        GetPlayerName(playerid,name,sizeof(name));
        strdel(text,findid,findid+5);
        new tempmsg[128],chat[128];
        strins(text,"%s ",findid,strlen("%s"));
        format(chat,sizeof(chat),"{%06x}%s: {FFFFFF}",GetPlayerColor(playerid) >>> 8,name);
        format(tempmsg,sizeof(tempmsg),text,pname);
        strcat(chat,tempmsg);
        SendClientMessageToAll(-1,chat);
        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: 3 Guest(s)