SA-MP Forums Archive
destroy your car with a command? - 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: destroy your car with a command? (/showthread.php?tid=423565)



destroy your car with a command? - Eminem 2ka9 - 18.03.2013

I need a command like /suicide that will destroy my car completely, not just set it's health to 0 or cause a little explosion, i want the car to get destroyed.

I use ZCmd.


Re: destroy your car with a command? - Misiur - 18.03.2013

Depending on "destroy" meaning:
1. https://sampwiki.blast.hk/wiki/DestroyVehicle
2. https://sampwiki.blast.hk/wiki/UpdateVehicleDamageStatus


Re: destroy your car with a command? - Konstantinos - 18.03.2013

pawn Код:
CMD:suicide(playerid, params[])
{
    return DestroyVehicle(GetPlayerVehicleID(playerid));;
}



Re: destroy your car with a command? - Eminem 2ka9 - 18.03.2013

I set it to this, and it works flawlessly, thanks.

pawn Код:
CMD:suicide(playerid, params[])
{
        if(gTeam[playerid] == T_TALIBAN)
    {
        return DestroyVehicle(GetPlayerVehicleID(playerid));
    }
    else return SendClientMessage(playerid, 0xFF0000FF, "You must be a Taliban to use this command.");
}



Re: destroy your car with a command? - Eminem 2ka9 - 18.03.2013

Only 1 problem, i also want it to only work when the player is IN A VEHICLE.

Like OnPlayerStateDriver or something.

This is my current code>?
pawn Код:
CMD:suicide(playerid, params[])
{
        if(gTeam[playerid] == T_IRAQ)
    {
        return DestroyVehicle(GetPlayerVehicleID(playerid));
    }
    else return SendClientMessage(playerid, 0xFF0000FF, "You must be a Taliban to use this command.");
}



Re: destroy your car with a command? - Scenario - 18.03.2013

GetPlayerVehicleID() returns an invalid vehicle ID when a player is not in a vehicle, so it basically does a check on itself before trying to execute.


Re: destroy your car with a command? - Eminem 2ka9 - 18.03.2013

I added some more to it, but i get 1 error.

This is what i have now.
pawn Код:
CMD:suicide(playerid, params[])
{
            if(gTeam[playerid] == T_IRAQ && PLAYER_STATE_DRIVER)
        {
            return DestroyVehicle(GetPlayerVehicleID(playerid));
        }
        else return SendClientMessage(playerid, 0xFF0000FF, "You must be a Taliban to use this command.");
    }
    else return SendClientMessage(playerid, 0xFF0000FF, "You must be a in a vehicle");
}

1 error.
pawn Код:
error 010: invalid function or declaration

This is the line:
pawn Код:
else return SendClientMessage(playerid, 0xFF0000FF, "You must be a Taliban to use this command.");
    }
    else return SendClientMessage(playerid, 0xFF0000FF, "You must be in a vehicle");
}



Re: destroy your car with a command? - Eminem 2ka9 - 18.03.2013

I also tried to
pawn Код:
}
       
        else return SendClientMessage(playerid, 0xFF0000FF, "You must be a in a vehicle!");
    return 1;
}
but no!


Re: destroy your car with a command? - Misiur - 18.03.2013

pawn Код:
CMD:suicide(playerid, params[])
{
    if(gTeam[playerid] == T_IRAQ )
    {
        new seat = GetPlayerVehicleSeat(playerid);
        return 0 == seat ? DestroyVehicle(GetPlayerVehicleID(playerid)) : false;
    }
    else return SendClientMessage(playerid, 0xFF0000FF, "You must be a Taliban to use this command.");
}
Cheers


Re: destroy your car with a command? - Eminem 2ka9 - 18.03.2013

Thanks for your response.

I get 1 mismatch warning with that.

This is the line:
pawn Код:
return 0 == seat ? DestroyVehicle(GetPlayerVehicleID(playerid)) : false;