Y_Ini - Reading string (i tried..)
#3

Hi, try this:

(I guess 'value' is the string name)
pawn Код:
if(!strcmp(name, "Online_Time"))
{
    new tmpx[20], which;
    for(new i=0; i<strlen(value); i++)
    {
        if(value[i] == ':')
        {
            if(which == 0) PlayerInfo[playerid][pOnlineHours] = strval(tmpx);
            if(which == 1) PlayerInfo[playerid][pOnlineMinutes] = strval(tmpx);
            format(tmpx, sizeof(tmpx), "");
            which++;
        }
        else format(tmpx, sizeof(tmpx), "%s%c", tmpx, value[i]);
    }
    PlayerInfo[playerid][pOnlineSeconds] = strval(tmpx);
}
I hope this works, let me know if there are any problems.

Jeffry
Reply


Messages In This Thread
Y_Ini - Reading string (i tried..) - by Riddick94 - 30.08.2011, 14:46
Re: Y_Ini - Reading string (i tried..) - by [MWR]Blood - 30.08.2011, 14:56
Re: Y_Ini - Reading string (i tried..) - by Jeffry - 30.08.2011, 14:59
Re: Y_Ini - Reading string (i tried..) - by Riddick94 - 30.08.2011, 15:07
Re: Y_Ini - Reading string (i tried..) - by AndreT - 30.08.2011, 15:08

Forum Jump:


Users browsing this thread: 2 Guest(s)