CarID problem
#1

Ok. Im making a car command which tells u what car your in,
And its not all completed but when i say the command, If im not in a car it will send a message saying Car: [NotYetKnown] But it should only say your not in a car, but it does say it, but also says the other,

pawn Код:
if(!strcmp("/carid", cmdtext, true))
    {
        IsPlayerInAnyVehicle(playerid);
        new name[ 24 ], string[ 64 ];
    GetPlayerName( playerid, name, 24 );

    format( string, sizeof(string), "~w~CAR: [NotYetKnown]", name );
    GameTextForAll( string, 5000, 1 );
        }
        else
        {
        SendClientMessage(playerid, 0xFFFFFFFFF, "You are not in a car");
        return 1;
    }

Whats wrong?
Why if im in or out a car,
It says both: CAR: [NotYetKnown] and also You are not in a car,

So whats the problem?
If im on foot and say the command,
It says your not in a car AND says CAR: [NotYetKnown]
But it should only say your not in a car,
Anyone help
Reply
#2

Hi,,where's "if"?
pawn Код:
IsPlayerInAnyVehicle(playerid);
And I suggest use GetPlayerVehicleID
pawn Код:
if(!strcmp(...)){
  if(GetPlayerVehicleID(playerid)) printf "id:%d,%d",playerid,GetPlayerVehicleID(playerid);
else print "not in vec"
  return true;
}
Reply
#3

Quote:
Originally Posted by yezizhu
Hi,,where's "if"?
pawn Код:
IsPlayerInAnyVehicle(playerid);
And I suggest use GetPlayerVehicleID
pawn Код:
if(!strcmp(...)){
  if(GetPlayerVehicleID(playerid)) printf "id:%d,%d",playerid,GetPlayerVehicleID(playerid);
else print "not in vec"
  return true;
}
pawn Код:
if(!strcmp(...))
{
  if(IsPlayerInAnyVehicle(playerid) == true)
  {
    printf("id:%d,%d",playerid,GetPlayerVehicleID(playerid));
  }
  else
  {
    print("not in vehicle");
  }
  return 1;
}
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)