"CheckOwner" not working...
#4

pawn Code:
public CheckOwner(playerid)
{
    if(IsPlayerConnected(playerid))
    {
        for(new i = 1; i < sizeof(CarInfo); i++)
        {
            new playername[MAX_PLAYER_NAME];
            GetPlayerName(playerid,playername,sizeof(playername));
            if(strcmp(playername,CarInfo[i][vOwner],true)==0)
            {
                PlayerInfo[playerid][pVehicle] = 1;
                return i;
            }
            else
            {
                PlayerInfo[playerid][pVehicle] = 0;
                return i;
            }
        }
    }
    return 1;
}
You should use 'else' and not this:

pawn Code:
else if(strcmp(playername,CarInfo[i][vOwner],false)==0)
            {
                PlayerInfo[playerid][pVehicle] = 0;
                return i;
            }
That checks if the player's name IS the owner of the vehicle again!
Reply


Messages In This Thread
"CheckOwner" not working... - by Jack_Leslie - 25.08.2011, 08:06
Re: "CheckOwner" not working... - by PrawkC - 25.08.2011, 08:38
Re: "CheckOwner" not working... - by Jack_Leslie - 25.08.2011, 08:38
Re: "CheckOwner" not working... - by Emmet_ - 25.08.2011, 08:39
Re: "CheckOwner" not working... - by PrawkC - 25.08.2011, 08:41
Re: "CheckOwner" not working... - by Jack_Leslie - 25.08.2011, 08:42
Re: "CheckOwner" not working... - by jameskmonger - 25.08.2011, 08:46
Re: "CheckOwner" not working... - by Jack_Leslie - 25.08.2011, 08:47
Re: "CheckOwner" not working... - by PrawkC - 25.08.2011, 08:51
Re: "CheckOwner" not working... - by Jack_Leslie - 25.08.2011, 08:59
Re: "CheckOwner" not working... - by PrawkC - 25.08.2011, 09:04
Re: "CheckOwner" not working... - by Jack_Leslie - 25.08.2011, 09:09
Re: "CheckOwner" not working... - by PrawkC - 25.08.2011, 09:13
Re: "CheckOwner" not working... - by Jack_Leslie - 25.08.2011, 09:18
Re: "CheckOwner" not working... - by jameskmonger - 25.08.2011, 09:28

Forum Jump:


Users browsing this thread: 3 Guest(s)