Max cars
#7

pawn Код:
if (strcmp(cmdtext, "/race", true) == 0)
{
  if (!PlayerToPoint(3.0, playerid,-2036.5963,302.3366,34.9292))
    return SendClientMessage(playerid, 0xFF66FFAA, "You're not near enough");

  if (!IsPlayerInAnyVehicle(playerid))
    return SendClientMessage(playerid, 0xFF66FFAA, "You're not in a car");
 
  // loop through all vehicles
  new vehiclecount;
  for (new v = 0; v < MAX_VEHICLES; v++)
  {
    if (VehicleToPoint(v, 'radius', 'x', 'y', 'z'))
      vehiclecount++;
  }

  if (vehiclecount >= 30)
    return SendClientMessage(playerid, 0xFF66FFAA, "Too many vehicles there already");

  SetVehiclePos(GetPlayerVehicleID(playerid), -2084.3301,-216.8675,34.6121);
  SetPlayerPos(playerid, -2090.3301,-216.8675,34.6121);

  return 1;
}

// some where else
stock VehicleToPoint(vehicleid, Float:radi, Float:x, Float:y, Float:z)
{
    new Float:oldposx, Float:oldposy, Float:oldposz;
    new Float:tempposx, Float:tempposy, Float:tempposz;
    GetVehiclePos(vehicleid, oldposx, oldposy, oldposz);
    tempposx = (oldposx - x);
    tempposy = (oldposy - y);
    tempposz = (oldposz - z);
    if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
        return 1;
   
    return 0;
}
Reply


Messages In This Thread
Max cars - by Scoots - 17.03.2009, 14:08
Re: Max cars - by MenaceX^ - 17.03.2009, 14:11
Re: Max cars - by Scoots - 17.03.2009, 14:31
Re: Max cars - by [RP]Rav - 17.03.2009, 14:33
Re: Max cars - by WoozieRocks - 17.03.2009, 14:34
Re: Max cars - by Scoots - 17.03.2009, 14:35
Re: Max cars - by [RP]Rav - 17.03.2009, 14:39
Re: Max cars - by Scoots - 17.03.2009, 15:02
Re: Max cars - by MenaceX^ - 17.03.2009, 15:05
Re: Max cars - by Scoots - 17.03.2009, 15:05

Forum Jump:


Users browsing this thread: 1 Guest(s)