GetClosestCar problem
#1

hey, i got a GetClosestCar stock and when i try to respawn the car it's say that is respawning car 1999 every time.

GetClosestCar:
Код:
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;
}
Command:
Код:
CMD:closestcar(playerid, params[])
{
	if(pInfo[playerid][pLogged] == 0) return SCM(playerid, COLOR_GREY, ConnectFirst);
	if(pInfo[playerid][pAdmin] > 0)
	{
		new vehid, str[255];
		vehid = GetClosestVehicle(playerid, 5);
		SetVehicleToRespawn(vehid);
		format(str, sizeof(str), ""w"( "dr"Admin Info "w") Admin %s has respawned vehicle %d.", pInfo[playerid][pName], vehid);
		ABroadCast(COLOR_WHITE, str, 1);
		format(str, sizeof(str), "Vehicle %d has been respawned.", vehid);
		SCM(playerid, COLOR_WHITE, str);
	}
	return 1;
}
Reply


Messages In This Thread
GetClosestCar problem - by C0oL3r - 22.02.2018, 19:07
Re: GetClosestCar problem - by Pottus - 22.02.2018, 19:18
Re: GetClosestCar problem - by C0oL3r - 22.02.2018, 19:36
Re: GetClosestCar problem - by C0oL3r - 22.02.2018, 20:03
Re: GetClosestCar problem - by David (Sabljak) - 22.02.2018, 20:04
Re: GetClosestCar problem - by C0oL3r - 22.02.2018, 20:11
Re: GetClosestCar problem - by C0oL3r - 22.02.2018, 20:15

Forum Jump:


Users browsing this thread: 1 Guest(s)