SA-MP Forums Archive
Command to Delete players vehicle - 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: Command to Delete players vehicle (/showthread.php?tid=520350)



Command to Delete players vehicle - Jigsaw123 - 18.06.2014

I got the American Roleplay Script, and i need to make a command which will delete a players car.. Help ?


Re: Command to Delete players vehicle - Jay_Dixon - 18.06.2014

pawn Код:
CMD:destroyvehicle(playerid, params[]) return cmd_destroycar(playerid, params);
CMD:destroycar(playerid, params[]) {
    if(PlayerInfo[playerid][pAdmin] >= 2) {
        new car;
        if(!sscanf(params, "i", car)) {
            if(GetVehicleModel(car) >= 400) {
                DestroyVehicleEx(car);
                new string[30];
                format(string, sizeof(string), "* Vehicle %d destroyed!", car);
                SendClientMessage(playerid, COLOR_LIGHTGREEN, string);
            } else {
                SendClientMessage(playerid, COLOR_LIGHTRED, "   That vehicle doesn't exist!");
            }
            return 1;
        } else {
            if(IsPlayerInAnyVehicle(playerid)) {
                car = GetPlayerVehicleID(playerid);
                DestroyVehicleEx(car);
                SendClientMessage(playerid, COLOR_LIGHTGREEN, "* Vehicle destroyed!");
                return 1;
            } else {
                SendClientMessage(playerid, COLOR_WHITE, "USAGE: /Destroycar [Car ID]");
                return 1;
            }
        }
    }
    return 1;
}