command
#1

can anyone give me like a /destroycar, so it destroy's the closest car, NOT when im in it
it destroys the closest car, is it possible?
Reply
#2

Quote:
Originally Posted by dark_clown
Посмотреть сообщение
can anyone give me like a /destroycar, so it destroy's the closest car, NOT when im in it
it destroys the closest car, is it possible?
Yeah, It's possible.

This forum requires that you wait 120 seconds between posts. Please try again in 87 seconds.
This forum requires that you wait 120 seconds between posts. Please try again in 3 seconds.
Reply
#3

Quote:
Originally Posted by [FU]Victious
Посмотреть сообщение
Yeah, It's possible.

This forum requires that you wait 120 seconds between posts. Please try again in 87 seconds.
This forum requires that you wait 120 seconds between posts. Please try again in 3 seconds.
can u gimme one?
Reply
#4

Yeah sure, give me a couple of minutes.

EDIT:

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/destroycar", cmdtext, true, 10) == 0)
    {
        for(new v = 0; v < MAX_VEHICLES; v++)
        {
            GetClosestVehicle(v);
            DestroyVehicle(v);
        }
        return 1;
    }
    return 0;
}

stock GetClosestVehicle(playerid, &Float:dis = (Float:0x7F800000))
{
  dis = (Float:0x7F800000);
  new Float:X, Float:Y, Float:Z;
  if(GetPlayerPos(playerid, X, Y, Z)) {
    new vehicleid = INVALID_VEHICLE_ID;
    for(new v, Float:temp, Float:VX, Float:VY, Float:VZ; v != MAX_VEHICLES; v++) {
      if(GetVehiclePos(v, VX, VY, VZ)) {
        VX -= X, VY -= Y, VZ -= Z;
        temp = VX * VX + VY * VY + VZ * VZ;
        if(temp < dis) dis = temp, vehicleid = v;
      }
    }
    dis = floatpower(dis, 0.5);
    return vehicleid;
  }
  return INVALID_VEHICLE_ID;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)