16.07.2013, 09:18
Well you can initialize those vars to "INVALID_VEHICLE_ID", then check their value.
There are other ways to do it, but this is the simplest i can think of. Not sure why you used "targetid" as well as "playerid".
pawn Код:
//OnPlayerConnect
PlayerData[playerid][pPcarkey] = INVALID_VEHICLE_ID;
PlayerData[playerid][pPcarkey2] = INVALID_VEHICLE_ID;
PlayerData[playerid][pPcarkey3] = INVALID_VEHICLE_ID;
//when your giving the player a vehicle
if( PlayerData[playerid][pPcarkey] == INVALID_VEHICLE_ID )
{
//player doesn't have a vehice in this slot
PlayerData[playerid][pPcarkey] = 420;//give a vehicle
}
else if( PlayerData[playerid][pPcarkey2] == INVALID_VEHICLE_ID )
{
//player doesn't have a vehice in this slot
PlayerData[playerid][pPcarkey2] = 425;
}
else if( PlayerData[playerid][pPcarkey3] == INVALID_VEHICLE_ID )
{
//player doesn't have a vehice in this slot
PlayerData[playerid][pPcarkey3] = 200;
}
else
{
//player has a vehicle in all slots
}