odd problem
#1

When I add more locations to the array, some of them stop working, like ammunation and burgershot.
I added a msg to be sent when I enter any pickups, it doesn't get called when I enter the ammu & burger pickups..

I'm figuring it's a typo or something, the array is pretty messy atm :P
pawn Код:
enum TLocation
{
    ID,
    LocationName[50], // The name of the location
    AreaName[25], // Area name, 'Market' for example.
    // THE ENTER CHECKPOINT, FACING ANGLE FOR EXIT POS IS SET HERE
    Float:EntX, // The X-position of the Entrance
    Float:EntY, // The Y-position of the Entrance
    Float:EntZ, // The Z-position of the Entrance
    Float:EntF, // The Facing Angle once exitted
   
    // THE EXIT CHECKPOINT, FACING ANGLE FOR ENTER POS IS SET HERE
    Float:ExiX, // The X-position of the Exit
    Float:ExiY, // The Y-position of the Exit
    Float:ExiZ, // The Z-position of the Exit
    Float:ExiF, // The Facing Angle once Entered
    //OTHER SETTINGS
    Float:robX, // Robbery/Store checkpoint
    Float:robY,
    Float:robZ,
    RobMin, // Minimum money from robbbery
    RobMax, // maximum money from robbery
    Vw, // interior virtualworld
    Interior // interior id
}


new ALocations[][TLocation] =
{   //ID  Loc   Area        X           Y           Z       F           X2      Y2      Z2          F2      robX    robY        robZ    robmin robmax vw interior
    {0, "Ammunation", "Market", 1368.2839, -1279.7400, 13.5469, 90.000,   315.7189, -143.4224, 999.6016, 0.000, 314.0695,-133.5970,999.6016, 10000, 25000, 1, 7},
    {1, "Gym", "Ganton", 2229.5847, -1721.5706, 13.5642, 180.5844, 772.2877, -5.3067,   1000.7286, 319.2422, 766.7114, 9.7772, 1000.7092, 10000, 25000, 2, 5},
    {2, "Burgershot", "Mulholland", 1199.4059, -918.7872, 43.1174, 347.8228, 363.0960, -75.0234,  1001.5078,  118.8259, 376.3915, -67.7262, 1001.5151, 10000, 25000, 3, 10},
    {3, "Well Stacked Pizza", "Ganton", 2104.9961, -1806.4435, 13.5547, 267.2592, 372.4197, -133.3273, 1001.4922, 174.0671, 375.6662, -119.1072,1001.4995, 10000, 25000, 4, 5},
    {4, "Barber Saloon", "Ganton", 2071.3215, -1793.8904, 13.5533, 95.0642, 418.6574, -84.3595, 1001.8047, 179.3885, 375.6662, -119.1072,1001.4995, 10000, 25000, 5, 3}
},
    accessPoints[][3];
I added a dummy location on top and ammunation seems to work now, now the exit of burgershot seems bugged.. i've got no idea why :S
Stock used for creating the pickups:
pawn Код:
stock Pickups()
{
    for(new i; i < sizeof(ALocations); i++)
    {
        accessPoints[i][0] = CreateDynamicPickup(19198, 1, ALocations[i][EntX], ALocations[i][EntY], ALocations[i][EntZ], 0, 0, -1, 200.0); // enter
        accessPoints[i][1] = CreateDynamicPickup(19198, 1, ALocations[i][ExiX], ALocations[i][ExiY], ALocations[i][ExiZ], ALocations[i][Vw], ALocations[i][Interior], -1, 200.0); //exit

        new string[256];
        format(string,sizeof(string), "[ENTER]\n%s", ALocations[i][LocationName]);
        CreateDynamic3DTextLabel(string, 0x008080FF, ALocations[i][EntX], ALocations[i][EntY], ALocations[i][EntZ], 30.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, -1, -1, -1, 100.0);
       
        new string2[256];
        format(string2,sizeof(string2), "[EXIT]\n%s", ALocations[i][LocationName]);
        CreateDynamic3DTextLabel(string2, 0x008080FF, ALocations[i][ExiX], ALocations[i][ExiY], ALocations[i][ExiZ], 30.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, -1, -1, -1, 100.0);
    }

onplayerpickuppickup:
pawn Код:
public OnPlayerPickUpDynamicPickup(playerid, pickupid)
{
    for(new i; i < sizeof(ALocations); i++)
    {
        if(pickupid == accessPoints[i][0])
        {
            SetCameraBehindPlayer(playerid);
            SetPlayerPos(playerid, ALocations[i][ExiX], ALocations[i][ExiY], ALocations[i][ExiZ]);
            SetPlayerFacingAngle(playerid, ALocations[i][ExiF]);
            SetPlayerInterior(playerid, ALocations[i][Interior]);
            SetPlayerVirtualWorld(playerid, ALocations[i][Vw]);
           
            SendClientMessage(playerid, -1,"Entered pickup");
        }
        if(pickupid == accessPoints[i][1])
        {
            SetCameraBehindPlayer(playerid);
            SetPlayerPos(playerid, ALocations[i][EntX], ALocations[i][EntY], ALocations[i][EntZ]);
            SetPlayerFacingAngle(playerid, ALocations[i][EntF]);
            SetPlayerInterior(playerid, 0);
            SetPlayerVirtualWorld(playerid, 0);
            new string[126];
            format(string,sizeof(string), "pickupid %s", pickupid);
            printf(string);
        }
    }
    return 1;
}
Reply
#2

[19:27:09] <FUNExtreme> the problem is that you are creating an empty array
[19:27:14] <FUNExtreme> accessPoints[][3];
[19:27:21] <Markus> 3 is used for shop cps
[19:27:25] <FUNExtreme> if you use [] it will adjust the size based on the amount of data you put in it
[19:27:34] <FUNExtreme> you don't put anything in it when the script starts
[19:27:48] <FUNExtreme> so by the time you add values, the array is already created as accessPoints[0][3]
[19:28:06] <Markus> how come some locations work then and some don't
[19:28:20] <FUNExtreme> pure coincidence probably
[19:28:43] <Markus> hm, what do I change that to tne
[19:28:53] <FUNExtreme> accessPoints[sizeof(ALocations)][3]
[19:29:12] <FUNExtreme> that's the lazy way
[19:29:14] <FUNExtreme>
[19:30:02] <Markus> nice, workin' =P
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)