05.10.2011, 06:44
Okay so I have two codes using strcmp to compare two strings that are both kicking me in the balls.
The problem with that code is that, if the two strings match, it still returns 0, when it should return i, but if I take out the else if bit and just have the first if .... return i; then it returns the i. The solution is to remove the else if, but I need to have that so it returns 0 if the two strings do not match.
The problem with that code is that it does nothing. I have codes above it. I debugged it, and it stops at the bit of code. "Incorrect pass" doesn't print either.
I'll pay someone $10 if they can either fix this or make another code doing the same thing, I've requested help so many times and no one has been able to fix it >.>
pawn Код:
stock GetCarIDFromPlayer_Enum(playerid)
{
for(new i=0; i<sizeof(CarInfo); i++)
{
if(!strcmp(CarInfo[i][vOwner], PlayerName(playerid), true)) return i;
else if(strcmp(CarInfo[i][vOwner], PlayerName(playerid), true)) return 0;
}
return -1;
}
pawn Код:
if(strcmp(tmp, gatepass) != 0)
{
SendClientMessage(playerid, COLOR_LIGHTRED, "* Dills gate: Incorrect password !");
print("Incorrect pass");
return 1;
}
I'll pay someone $10 if they can either fix this or make another code doing the same thing, I've requested help so many times and no one has been able to fix it >.>