SA-MP Forums Archive
Despawn vehicle by ID? - 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: Despawn vehicle by ID? (/showthread.php?tid=484074)



Despawn vehicle by ID? - Zion22be - 29.12.2013

I'm pretty new to scripting, and I need a basic command to despawn a vehicle by its ID. For instance, /despawnveh 103 would despawn the 103 vehicle on the server. And if possible, I need the command to tell me what vehicle has despawned by its name.

Basically this:

/despawnveh 103
"You have despawned a Maverick."


Re: Despawn vehicle by ID? - Emmet_ - 29.12.2013

Try this:

pawn Код:
CMD:despawnveh(playerid, params[])
{
    static
        id,
        str[32];

    if (isnull(params))
        return SendClientMessage(playerid, -1, "Usage: /despawnveh <id>");

    DestroyVehicle((id = strval(params)));
    format(str, sizeof(str), "You have despawned vehicle ID: %d.", id);

    return SendClientMessage(playerid, -1, str);
}
If you want the one for vehicle names, say so.


Re: Despawn vehicle by ID? - Zion22be - 30.12.2013

Thank you very much.