SA-MP Forums Archive
CMD - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: CMD (/showthread.php?tid=357284)



CMD - thefatshizms - 06.07.2012

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;
}



Re: CMD - .FuneraL. - 06.07.2012

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.


Re: CMD - thefatshizms - 06.07.2012

Duh why didnt i think of that before thanks


Re: CMD - Steven82 - 06.07.2012

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.");



Re: CMD - thefatshizms - 06.07.2012

That would be handy! thanks