#1

Hello, i have a command to delete vehicles but for some reason i have failed

pawn Код:
CMD:dveh(playerid, params[])
{
    new playerState = GetPlayerState(playerid);
    if(PlayerInfo[playerid][Padmin] >=2)
    {
        new currentveh;
        currentveh = GetPlayerVehicleID(playerid);
        DestroyVehicle(currentveh);
    }
    else if(PlayerInfo[playerid][Padmin] <=1)
    {
        SendClientMessage(playerid, -1, "Your not high enough level to do that");
    }
    else if (playerState == PLAYER_STATE_ONFOOT)// all of this
    {
        if(PlayerInfo[playerid][Padmin] >=2)// doesnt show this
        SendClientMessage(playerid, -1, "You need to be in a car to use this command");// or this
    }
    return 1;
}
Reply
#2

pawn Код:
CMD:dveh(playerid)
{
      if(PlayerInfo[playerid][Padmin] < 2) return SendClientMessage(playerid, -1, "Your not high enough level to do that");
      if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, -1, "You need to be in a car to use this command");
      new currentveh;
      currentveh = GetPlayerVehicleID(playerid);
      DestroyVehicle(currentveh);
      return 1;
}
Try this.
Reply
#3

Duh why didnt i think of that before thanks
Reply
#4

There is also a cool little native you can use, it's not much help. But I use it.

pawn Код:
native IsValidVehicle(vehicleid);

// snippet of my /dveh command.
if(!IsValidVehicle(targetveh))
        return SendClientMessage(playerid, COLOR, "Vehicle doesn't exist.");
Reply
#5

That would be handy! thanks
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)