04.10.2011, 03:46
pawn Код:
if(strcmp(CarInfo[i][vOwner], PlayerName(playerid)) == 0) return i;
if(strcmp(CarInfo[i][vOwner], PlayerName(playerid)) == 0) return i;
for(new i=0; i<sizeof(CarInfo); i++)
{
//strcmp code here asking if playername matches CarInfo[i][vOwner]
}
for (new i = 0; i < sizeof(CarInfo); i++)
{
if (strlen(CarInfo[i][vOwner]) && strcmp(CarInfo[i][vOwner],PlayerName(playerid)) == 0)
{
return i;
}
}
|
I'm still trying to get the point of the ID getting returned. Is a specific ID / player ID suppose to be returned? Because correct me if I'm wrong, you're looping through an array and just waiting for a match, and whatever match that is an ID is suppose to be returned?
|
|
Yes I am looping through the arrays and waiting for the vOwner and PlayerName to match, if they do, return the id of that match (from the loop), if not, then return whatever else.
|
and see if it has an given output. You are checking for the name and might get a match, but the way strcmp was created might give a different output.