// 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;
}
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;
}
|
Quite possibly because you set the spawn location to the exact location of the pickup. This results in the player picking it up and the code to be executed again. You may want to use a function to slightly offset the spawn position. A variation of GetXYInFrontOfPlayer should work.
|
|
pawn Код:
|
printf("Entered pickupid: %d", pickupid);