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

Hey guys.
So I'm having trouble with this code, that Jeffrey made for me. It's meant to loop through, see if the two strings match anywhere then return the ID of where they matched.

pawn Код:
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)) return i;  //Returns the Vehicle ID
    }
    return -1;
}
It keeps returning ID 1 though.
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)