02.03.2011, 07:42
Hello, i made a bus menu but i have a problem the objects and pickups does not appear. The compile doesn't show any error . Help me please !
Here is :
Here is :
pawn Код:
#include <a_samp>
#define BusSationsLS 9 // How mutch bus-stations are there in Los Santos ?
#define BUS_MONEY 100
#define BUS_TIME 20000 // How long must the player stay in the bus? (miliseconds!)
new Menu:BusMenuLS;
new BusPickupLS[BusSationsLS];
new Float:BusStationX[BusSationsLS], Float:BusStationY[BusSationsLS], Float:BusStationZ[BusSationsLS], Float:BusStationA[BusSationsLS];
forward SetPlayerToBusStation(playerid);
forward AddBusStationLS(id, Float:x, Float:y, Float:z, Float:a);
forward PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z);
new PlayerInBus[MAX_PLAYERS];
new InBusTimer[MAX_PLAYERS];
public OnPlayerConnect(playerid)
{
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
if(PlayerInBus[playerid] != 0){KillTimer(InBusTimer[playerid]);}
PlayerInBus[playerid] = 0;
return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
if(PlayerInBus[playerid] != 0){KillTimer(InBusTimer[playerid]);PlayerInBus[playerid] = 0;}
return 1;
}
public OnGameModeInit()
{
BusMenuLS = CreateMenu("Los Santos:",1,200,200,400,35);
AddMenuItem(BusMenuLS, 0, "Spawn Place");
AddMenuItem(BusMenuLS, 0, "City Hall");
AddMenuItem(BusMenuLS, 0, "Police Department");
AddMenuItem(BusMenuLS, 0, "Bank");
AddMenuItem(BusMenuLS, 0, "Ammunation");
AddMenuItem(BusMenuLS, 0, "Up Town");
AddMenuItem(BusMenuLS, 0, "Vinewood");
AddMenuItem(BusMenuLS, 0, "Airport");
CreateObject(5710, -2736.000000, 714.000000, 1000.000000, 0.0000, 0.0000, 0.0000);
CreateObject(7191, -2740.084473, 714.154297, 998.273987, 0.0000, 0.0000, 0.0000);
CreateObject(7191, -2740.084473, 714.154297, 1002.224915, 0.0000, 0.0000, 0.0000);
CreateObject(7191, -2746.557617, 714.154297, 998.273987, 0.0000, 0.0000, 180.0000);
CreateObject(7191, -2746.557617, 714.154297, 1002.224182, 0.0000, 0.0000, 180.0000);
CreateObject(7191, -2747.057617, 706.953613, 998.273987, 0.0000, 0.0000, 270.0000);
CreateObject(7191, -2747.057617, 706.953613, 1002.225159, 0.0000, 0.0000, 270.0000);
CreateObject(7191, -2747.057617, 725.705078, 998.273987, 0.0000, 0.0000, 90.0000);
CreateObject(7191, -2747.057617, 725.705078, 1002.225647, 0.0000, 0.0000, 90.0000);
CreateObject(18095, -2739.982666, 715.474365, 998.531494, 0.0000, 0.0000, 90.0000);
CreateObject(18095, -2746.627197, 708.046753, 998.531494, 0.0000, 0.0000, 270.0000);
CreateObject(14405, -2743.942383, 730.476074, 997.094604, 0.0000, 0.0000, 180.0000);
CreateObject(14405, -2743.063965, 730.476074, 997.094604, 0.0000, 0.0000, 180.0000);
CreateObject(14405, -2743.942383, 728.001343, 997.094604, 0.0000, 0.0000, 180.0000);
CreateObject(14405, -2743.063965, 728.000122, 997.094604, 0.0000, 0.0000, 180.0000);
CreateObject(14405, -2743.942383, 725.299927, 997.094604, 0.0000, 0.0000, 180.0000);
CreateObject(14405, -2743.063965, 725.299927, 997.094604, 0.0000, 0.0000, 180.0000);
CreateObject(14405, -2743.063965, 722.599731, 997.094604, 0.0000, 0.0000, 180.0000);
CreateObject(14405, -2743.942383, 722.599487, 997.094604, 0.0000, 0.0000, 180.0000);
CreateObject(14405, -2743.942383, 719.499634, 997.094604, 0.0000, 0.0000, 180.0000);
CreateObject(14405, -2743.063965, 719.524170, 997.094604, 0.0000, 0.0000, 180.0000);
CreateObject(14405, -2743.942383, 716.448120, 997.094604, 0.0000, 0.0000, 180.0000);
CreateObject(14405, -2743.063965, 716.447388, 997.094604, 0.0000, 0.0000, 180.0000);
CreateObject(1231, -2743.568359, 708.475586, 1003.627136, 180.4711, 0.0000, 0.0000);
CreateObject(1231, -2743.568359, 712.800415, 1003.627136, 180.4711, 0.0000, 0.0000);
CreateObject(1231, -2743.568359, 715.875000, 1003.627136, 180.4711, 0.0000, 0.0000);
CreateObject(1231, -2743.568359, 718.799683, 1003.627136, 180.4711, 0.0000, 0.0000);
CreateObject(1231, -2743.568359, 721.324219, 1003.627136, 180.4711, 0.0000, 0.0000);
CreateObject(1231, -2743.568359, 724.123779, 1003.627136, 180.4711, 0.0000, 0.0000);
CreateObject(10844, -2740.196533, 714.356018, 993.607056, 0.0000, 0.0000, 270.0000);
AddBusStationLS(1, 1802.837, -1862.350, 13.856, -90.000); // Spawn Place
AddBusStationLS(2, 1421.664, -1709.217, 13.822, -180.000); // City Hall
AddBusStationLS(3, 1537.703, -1654.446, 13.826, -360.000); // Police
AddBusStationLS(4, 1498.532, -1739.609, 13.826, -450.000); // Bank
AddBusStationLS(5, 1364.835, -1288.943, 13.776, 0.0); // Ammunation
AddBusStationLS(6, 1241.476, -921.677, 43.015, 101.250); // Up town
AddBusStationLS(7, 929.919, -840.863, 94.355, -67.500); // Vinewood
AddBusStationLS(8, 1951.345, -2173.420, 13.783, -450.000); // Airport
return 1;
}
public AddBusStationLS(id, Float:x, Float:y, Float:z, Float:a)
{
CreateObject(1257, x, y, z, 0.0000, 0.0000, a);
BusPickupLS[id] = CreatePickup(1239, true, x, y, z);
BusStationX[id] = x;
BusStationY[id] = y;
BusStationZ[id] = z;
BusStationA[id] = a;
return id;
}
public OnPlayerSelectedMenuRow(playerid, row)
{
new Menu:Current = GetPlayerMenu(playerid);
if (Current == BusMenuLS)
{
switch(row)
{
case 0: {TogglePlayerControllable(playerid, true);PlayerInBus[playerid] = 1;SetPlayerPos(playerid, -2743.538,708.751,997.588);SetPlayerInterior(playerid, 1);GivePlayerMoney(playerid, -BUS_MONEY);InBusTimer[playerid] = SetTimerEx("SetPlayerToBusStation", BUS_TIME, false, "d", playerid);}
case 1: {TogglePlayerControllable(playerid, true);PlayerInBus[playerid] = 2;SetPlayerPos(playerid, -2743.538,708.751,997.588);SetPlayerInterior(playerid, 1);GivePlayerMoney(playerid, -BUS_MONEY);InBusTimer[playerid] = SetTimerEx("SetPlayerToBusStation", BUS_TIME, false, "d", playerid);}
case 2: {TogglePlayerControllable(playerid, true);PlayerInBus[playerid] = 3;SetPlayerPos(playerid, -2743.538,708.751,997.588);SetPlayerInterior(playerid, 1);GivePlayerMoney(playerid, -BUS_MONEY);InBusTimer[playerid] = SetTimerEx("SetPlayerToBusStation", BUS_TIME, false, "d", playerid);}
case 3: {TogglePlayerControllable(playerid, true);PlayerInBus[playerid] = 4;SetPlayerPos(playerid, -2743.538,708.751,997.588);SetPlayerInterior(playerid, 1);GivePlayerMoney(playerid, -BUS_MONEY);InBusTimer[playerid] = SetTimerEx("SetPlayerToBusStation", BUS_TIME, false, "d", playerid);}
case 4: {TogglePlayerControllable(playerid, true);PlayerInBus[playerid] = 5;SetPlayerPos(playerid, -2743.538,708.751,997.588);SetPlayerInterior(playerid, 1);GivePlayerMoney(playerid, -BUS_MONEY);InBusTimer[playerid] = SetTimerEx("SetPlayerToBusStation", BUS_TIME, false, "d", playerid);}
case 5: {TogglePlayerControllable(playerid, true);PlayerInBus[playerid] = 6;SetPlayerPos(playerid, -2743.538,708.751,997.588);SetPlayerInterior(playerid, 1);GivePlayerMoney(playerid, -BUS_MONEY);InBusTimer[playerid] = SetTimerEx("SetPlayerToBusStation", BUS_TIME, false, "d", playerid);}
case 6: {TogglePlayerControllable(playerid, true);PlayerInBus[playerid] = 7;SetPlayerPos(playerid, -2743.538,708.751,997.588);SetPlayerInterior(playerid, 1);GivePlayerMoney(playerid, -BUS_MONEY);InBusTimer[playerid] = SetTimerEx("SetPlayerToBusStation", BUS_TIME, false, "d", playerid);}
case 7: {TogglePlayerControllable(playerid, true);PlayerInBus[playerid] = 8;SetPlayerPos(playerid, -2743.538,708.751,997.588);SetPlayerInterior(playerid, 1);GivePlayerMoney(playerid, -BUS_MONEY);InBusTimer[playerid] = SetTimerEx("SetPlayerToBusStation", BUS_TIME, false, "d", playerid);}
}
}
return 1;
}
public OnPlayerExitedMenu(playerid)
{
new Menu:Current = GetPlayerMenu(playerid);
if (Current == BusMenuLS)
{
TogglePlayerControllable(playerid, true);
}
return 1;
}
public SetPlayerToBusStation(playerid)
{
if(PlayerInBus[playerid] == 1){SetPlayerPos(playerid, BusStationX[1], BusStationY[1], BusStationZ[1]);SetPlayerFacingAngle(playerid, BusStationA[1]);SetPlayerInterior(playerid, 0);PlayerInBus[playerid] = 0;}
if(PlayerInBus[playerid] == 2){SetPlayerPos(playerid, BusStationX[2], BusStationY[2], BusStationZ[2]);SetPlayerFacingAngle(playerid, BusStationA[2]);SetPlayerInterior(playerid, 0);PlayerInBus[playerid] = 0;}
if(PlayerInBus[playerid] == 3){SetPlayerPos(playerid, BusStationX[3], BusStationY[3], BusStationZ[3]);SetPlayerFacingAngle(playerid, BusStationA[3]);SetPlayerInterior(playerid, 0);PlayerInBus[playerid] = 0;}
if(PlayerInBus[playerid] == 4){SetPlayerPos(playerid, BusStationX[4], BusStationY[4], BusStationZ[4]);SetPlayerFacingAngle(playerid, BusStationA[4]);SetPlayerInterior(playerid, 0);PlayerInBus[playerid] = 0;}
if(PlayerInBus[playerid] == 5){SetPlayerPos(playerid, BusStationX[5], BusStationY[5], BusStationZ[5]);SetPlayerFacingAngle(playerid, BusStationA[5]);SetPlayerInterior(playerid, 0);PlayerInBus[playerid] = 0;}
if(PlayerInBus[playerid] == 6){SetPlayerPos(playerid, BusStationX[6], BusStationY[6], BusStationZ[6]);SetPlayerFacingAngle(playerid, BusStationA[6]);SetPlayerInterior(playerid, 0);PlayerInBus[playerid] = 0;}
if(PlayerInBus[playerid] == 7){SetPlayerPos(playerid, BusStationX[7], BusStationY[7], BusStationZ[7]);SetPlayerFacingAngle(playerid, BusStationA[7]);SetPlayerInterior(playerid, 0);PlayerInBus[playerid] = 0;}
if(PlayerInBus[playerid] == 8){SetPlayerPos(playerid, BusStationX[8], BusStationY[8], BusStationZ[8]);SetPlayerFacingAngle(playerid, BusStationA[8]);SetPlayerInterior(playerid, 0);PlayerInBus[playerid] = 0;}
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/busmenu", cmdtext, true, 10) == 0)
{
if(PlayerToPoint(4.0, playerid, BusStationX[1], BusStationY[1], BusStationZ[1]) ||
PlayerToPoint(4.0, playerid, BusStationX[2], BusStationY[2], BusStationZ[2]) ||
PlayerToPoint(4.0, playerid, BusStationX[3], BusStationY[3], BusStationZ[3]) ||
PlayerToPoint(4.0, playerid, BusStationX[4], BusStationY[4], BusStationZ[4]) ||
PlayerToPoint(4.0, playerid, BusStationX[5], BusStationY[5], BusStationZ[5]) ||
PlayerToPoint(4.0, playerid, BusStationX[6], BusStationY[6], BusStationZ[6]) ||
PlayerToPoint(4.0, playerid, BusStationX[7], BusStationY[7], BusStationZ[7]) ||
PlayerToPoint(4.0, playerid, BusStationX[8], BusStationY[8], BusStationZ[8]))
{
ShowMenuForPlayer(BusMenuLS, playerid);
TogglePlayerControllable(playerid, false);
return 1;
}
return 1;
}
return 0;
}
public OnPlayerPickUpPickup(playerid, pickupid)
{
for(new z = 0; z < sizeof(BusPickupLS); z++)
{
if(pickupid == BusPickupLS[z])
{
GameTextForPlayer(playerid, "~w~Type ~r~/busmenu ~w~to get a list of the places", 5000, 4);
}
}
return 0;
}
public PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z)
{
new Float:oldposx, Float:oldposy, Float:oldposz;
new Float:tempposx, Float:tempposy, Float:tempposz;
GetPlayerPos(playerid, 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;
}