using array for enter/exits etc
#1

They're mixing up and I don't know how to fix it really, I got tired of using a zillion lines so I gave this a try -_-

The script doesn't know which is which so I end up getting teleported to the wrong X,Y,Z etc
pawn Код:
// This is a comment
// uncomment the line below if you want to write a filterscript
#define FILTERSCRIPT

#include <a_samp>
#include <streamer>
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
}

// Setup an array that holds all location-data (except taxi and busdriver classes, these have their own locations)
new ALocations[][TLocation] =
{   //ID  Loc   Area        X           Y           Z       F           X2      Y2      Z2          F2      robX    robY        robZ
    {0, "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, 1, 5},
    {1, "Ammunation", "Market", 1368.2839, -1279.7400, 13.5469, 00.000, 315.7189, -143.4224, 999.6016, 00.000, 314.0695,-133.5970,999.6016, 10000, 25000, 2, 7}
},
    accessPoints[][3];
new entertime[MAX_PLAYERS];
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
    }
}

stock Checkpoints()
{
    for(new i; i < sizeof(ALocations); i++)
    {
        accessPoints[i][2] = CreateDynamicCP(ALocations[i][robX], ALocations[i][robY], ALocations[i][robZ], 2, ALocations[i][Vw], ALocations[i][Interior], -1, 100.0);
    }
}


stock ShopDialog(playerid)
{
    for(new i; i < sizeof(ALocations); i++)
    {
            new string[256];
            format(string,sizeof(string), "You're in %s", ALocations[i][LocationName]);
            SendClientMessage(playerid, -1, string);
    }
}
public OnFilterScriptInit()
{
    print("\n--------------------------------------");
    print(" Blank Filterscript by your name here");
    print("--------------------------------------\n");
    Checkpoints();
    Pickups();
    return 1;
}

public OnFilterScriptExit()
{
    return 1;
}


public OnPlayerPickUpDynamicPickup(playerid, pickupid)
{
    if(entertime[playerid] <= gettime())
    {
        for(new i; i < sizeof(ALocations); i++)
        {
            if(pickupid == accessPoints[i][0])
            {
                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]);
                entertime[playerid] = gettime() + 5;
            }
            if(pickupid == accessPoints[i][1])
            {
                SetPlayerPos(playerid, ALocations[i][EntX], ALocations[i][EntY], ALocations[i][EntZ]);
                SetPlayerFacingAngle(playerid, ALocations[i][EntF]);
                SetPlayerInterior(playerid, 0);
                SetPlayerVirtualWorld(playerid, 0);
                entertime[playerid] = gettime() + 5;
            }
        }
        return 1;
    }
    return 1;
}

public OnPlayerEnterDynamicCP(playerid, checkpointid)
{
    for(new i; i < sizeof(ALocations); i++)
    {
        if(checkpointid == accessPoints[i][2])
        {
            ShopDialog(playerid);
        }
    }
    return 1;
}
Reply


Messages In This Thread
using array for enter/exits etc - by Knekt - 28.02.2014, 07:28
Re: using array for enter/exits etc - by Aerotactics - 28.02.2014, 09:08
Re: using array for enter/exits etc - by Vince - 28.02.2014, 09:50
Re: using array for enter/exits etc - by Knekt - 28.02.2014, 10:05
Re: using array for enter/exits etc - by Knekt - 28.02.2014, 11:24

Forum Jump:


Users browsing this thread: 1 Guest(s)