01.10.2018, 18:47
I would like to add a command that when putting the wrong car ID appears: "Vehicle not found", the command I created has some properties, I will be leaving it below:
Код:
ACMD:veiculo[3](playerid, params[]) { if(!IsPlayerOnAdminDuty(playerid) && GetPlayerAdminLevel(playerid) < STAFF_LEVEL_LEAD) return 6; new command[30], vehicleid; if(sscanf(params, "s[30]D(-1)", command, vehicleid)) { Msg(playerid, NovoA, "[ > ] Uso correto: /veiculo []/ir/entrar/dono/deletar/respawn/resetar/trancar/destrancar/removerchave] [id]"); return 1; } if(vehicleid == -1) vehicleid = GetPlayerVehicleID(playerid); if(!IsValidVehicle(vehicleid)) return 4; if(!strcmp(command, "puxar")) { new Float:x, Float:y, Float:z; GetPlayerPos(playerid, x, y, z); PutPlayerInVehicle(playerid, vehicleid, 0); SetVehiclePos(vehicleid, x, y, z); SetPlayerPos(playerid, x, y, z + 2); SetCameraBehindPlayer(playerid); MsgAdminsF(1, NovoA, "{00CED1}[ > ] O(a) administrador(a) %P{00CED1} puxou o veнculo de ID {FFFFFF}%d !", playerid, vehicleid); return 1; } if(!strcmp(command, "ir")) { new Float:x, Float:y, Float:z; GetVehiclePos(vehicleid, x, y, z); SetPlayerPos(playerid, x, y, z); MsgAdminsF(1, NovoA, "{00CED1}[ > ] O(a) administrador(a) %P{00CED1} foi atй o veнculo de ID {FFFFFF}%d !", playerid, vehicleid); return 1; } if(!strcmp(command, "entrar")) { PutPlayerInVehicle(playerid, vehicleid, 0); MsgAdminsF(1, NovoA, "{00CED1}[ > ] O(a) administrador(a) %P{00CED1} usou o comando de entrar no veнculo de ID {FFFFFF}%d !", playerid, vehicleid); return 1; } if(!strcmp(command, "dono")) { new owner[MAX_PLAYER_NAME]; GetVehicleOwner(vehicleid, owner); MsgF(playerid, NovoA, "[ > ] O dono desse veнculo й: {FFFFFF}'%s'", owner); MsgAdminsF(1, NovoA, "{00CED1}[ > ] O(a) administrador(a) %P{00CED1} estб vendo quem й o dono do veнculo de ID {FFFFFF}%d !", playerid, vehicleid); return 1; } if(!strcmp(command, "deletar")) { DestroyWorldVehicle(vehicleid); MsgF(playerid, RED, "[x] Veнculo %d foi deletado!", vehicleid); MsgAdminsF(1, NovoA, "{00CED1}[ > ] O(a) administrador(a) %P{00CED1} deletou o veнculo de ID {FFFFFF}%d !", playerid, vehicleid); return 1; } if(!strcmp(command, "respawn")) { RespawnVehicle(vehicleid); MsgF(playerid, RED, "[x] Veнculo %d foi respawnado!", vehicleid); MsgAdminsF(1, NovoA, "{00CED1}[ > ] O(a) administrador(a) %P {00CED1}respawnou o veнculo de ID {FFFFFF}%d !", playerid, vehicleid); return 1; } if(!strcmp(command, "resetar")) { ResetVehicle(vehicleid); MsgF(playerid, RED, "[x] Veнculo %d foi resetado!", vehicleid); MsgAdminsF(1, NovoA, "{00CED1}[ > ] O(a) administrador(a) %P {00CED1}resetou o veнculo de ID {FFFFFF}%d !", playerid, vehicleid); return 1; } if(!strcmp(command, "trancar")) { SetVehicleExternalLock(vehicleid, 1); MsgF(playerid, RED, "[x] Veнculo %d foi trancado!", vehicleid); MsgAdminsF(1, NovoA, "{00CED1}[ > ] O(a) administrador(a) %P {00CED1}trancou o veнculo de ID {FFFFFF}%d !", playerid, vehicleid); return 1; } if(!strcmp(command, "destrancar")) { SetVehicleExternalLock(vehicleid, 0); MsgF(playerid, RED, "[x] Veнculo %d foi destrancado!", vehicleid); MsgAdminsF(1, NovoA, "{00CED1}[ > ] O(a) administrador(a) %P {00CED1}destrancou o veнculo de ID {FFFFFF}%d !", playerid, vehicleid); return 1; } if(!strcmp(command, "removerchave")) { SetVehicleKey(vehicleid, 0); MsgF(playerid, RED, "[x] Veнculo %d teve sua chave removida!", vehicleid); MsgAdminsF(1, NovoA, "{00CED1}[ > ] O(a) administrador(a) %P{00CED1} removeu a chave do veнculo de ID {FFFFFF}%d !", playerid, vehicleid); return 1; } Msg(playerid, NovoA, "[ > ] Uso correto: /veiculo [puxar/entrar/dono/deletar/respawn/resetar/trancar/destrancar] [id]"); return 1; }