Loop through a file, see if string matches then get ID.
#2

I don't think this will make much of a difference but.. Try this.

Код:
stock GetCarIDFromPlayer(playerid)
{
    new PlayersName[MAX_PLAYER_NAME];
    GetPlayerName(playerid, PlayersName, MAX_PLAYER_NAME);
    for(new i=0; i<sizeof(CarInfo); i++)
    {
        if(!strcmp(CarInfo[i][vOwner], PlayersName, true)) return i;  //Returns the Vehicle ID
    }
    return -1;
}
Oh and are you sure its 1 not -1?
Reply


Messages In This Thread
Loop through a file, see if string matches then get ID. - by Jack_Leslie - 16.09.2011, 03:58
Re: Loop through a file, see if string matches then get ID. - by MisterTickle - 16.09.2011, 04:32

Forum Jump:


Users browsing this thread: 1 Guest(s)