29.07.2012, 02:19
I'm sleepy, very sleepy.
Someone help me out, It's not returning me the name of the area.
Example usage:
It's like 4:30 AM here and I can barely think, but I want to finish this
Someone help me out, It's not returning me the name of the area.
pawn Code:
enum BusStopsMain
{
BusName[34],
Float:BusCords[3]
};
static const BusStops[][BusStopsMain] =
{
{"Doherty Station", {-2002.7013,145.5387,27.63840}}, // BusStop 1: Train Station
{"National Bank", {-1998.4659,471.1749,35.10720}}, // BusStop 2: San Fierro Bank
{"Department of Licenses", {-1869.0721,600.3917,35.11500}}, // Bus Stop 3: Department of licenses
{"San Fierro Police Department", {-1631.8818,726.1474,14.56140}}, // Bus Stop 4: San Fierro Police Department
{"Westside Avenue", {-1529.6941,961.0469,7.132800}}, // Bus Stop 5: Docks
{"Oto's Motorbikes", {-1630.6411,1251.6025,7.14990}}, // Bus Stop 6: Oto's autos
{"Pier-39", {-1990.4875,1314.1171,7.13860}}, // Bus Stop 7: Pier 39
{"Calton Heights", {-2147.3218,1278.8663,24.6881}}, // Bus Stop 8: Calton Heights
{"Juniper Hill", {-2271.9961,1064.8588,81.8771}}, // Bus Stop 9:Juniper Hill
{"Chinatown", {-2272.3606,689.1893,49.39800}}, // Bus Stop 10: Chinatown
{"San Fierro Medical Center", {-2588.3118,571.5823,14.56070}}, // Bus Stop 11: San Fierro Medical Center
{"Ocean Flats", {-2710.1938,-26.9371,4.350200}} // Bus Stop 12: Ocean Flats South
};
pawn Code:
forward GetNearestBus(playerid, name[], len);
public GetNearestBus(playerid, name[], len)
{
new Float:d = 0.000;
new Float:dis = 0.0000;
new number = -1;
for(new i = 0; i <= sizeof(BusStops); i++)
{
dis = GetPlayerDistanceFromPoint(playerid, BusStops[i][BusCords][0], BusStops[i][BusCords][1], BusStops[i][BusCords][2]);
if(dis > d)
{
d = dis;
number = i;
}
}
return format(name, len, BusStops[number][BusName], 0);
}
pawn Code:
new bs[34];
GetNearestBus(playerid, bs, 34);
new strr[128];
format(strr, sizeof(strr), "Current Stop - %s **Speaker**", bs);
It's like 4:30 AM here and I can barely think, but I want to finish this