Hey,
ich hab einen Fail in einem OCMD: Command.
Folgendes, ich möchte, das näheste Car was neben mir steht, soll respawned werdnen.
Hier der Befehl:
ocmd:delcar(playerid,params[])
{
new CarID, MSG[125];
CarID = GetClosestVehicle(playerid, 4.0);
if(!isPlayeranAdmin(playerid,1))return SendClientMessage(playerid, rot, "Du bist kein Admin");
DestroyVehicle(CarID);
format(MSG,sizeof(MSG),"Du hast CarID %i gelöscht.", CarID);
SendClientMessage(playerid, gruen, MSG);
return 1;
}
hier der stock von getclosestvehicle:
stock GetClosestVehicle(playerid, Float:range)
{
new Float:p_X;
new Float:p_Y;
new Float:p_Z;
new Float:Distance;
new Float:PretendentDistance = range +1;
new Pretendent;
GetPlayerPos(playerid, p_X, p_Y, p_Z);
for(new vehicleid=1; vehicleid < MAX_VEHICLES; vehicleid++)
{
Distance = GetVehicleDistanceFromPoint(vehicleid, p_X, p_Y, p_Z);
if(Distance <= range && Distance <= PretendentDistance)
{
Pretendent = vehicleid;
PretendentDistance = Distance;
}
}
return Pretendent;
}