17.03.2009, 14:39
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;
}