28.05.2015, 02:06
No es necesario hacer un ciclo, ya que el id del vehнculo ya lo conoces.
https://sampwiki.blast.hk/wiki/IsValidVehicle
Y no utilices params[0] (por ejemplo) como un NUMERO, porque es un dato tipo CARACTER.
pawn Код:
#include <a_samp>
native IsValidVehicle(vehicleid);
CMD:traerveh(playerid, params[])
{
new vehicleid, pool = GetVehiclePoolSize();
if(PlayerInfo[playerid][jAdminXLEP] == 0) return SendClientMessage(playerid, COLOR_GRAD, "Necesitas ser administrador para usar este comando.");
if(sscanf(params, "i", vehicleid)) return SendClientMessage(playerid, COLOR_GRAD, "Modo de uso: /traerveh [ID]");
if(vehicleid < 1 || vehicleid > pool) return SendClientMessage(playerid, COLOR_GRAD, "El vehiculo con ese id no existe.");
if(!IsValidVehicle(vehicleid)) return SendClientMessage(playerid, COLOR_GRAD, "El vehiculo con ese id es invalido.");
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
SetVehiclePos(vehicleid, x, y + 4, z);
SendClientMessage(playerid, COLOR_VERDE, "Has traido el coche seleccionado.");
return 1;
}
Y no utilices params[0] (por ejemplo) como un NUMERO, porque es un dato tipo CARACTER.