[Include] Enter/Exit points - The new checkpoints!
#1

Enter/Exit points
Creating default entering/exiting stores arrows that move and respond!
What is this?

As most of you people, you may of inserted this little code into your gamemodes init:
pawn Код:
DisableInteriorEnterExits();
Well, have you ever wanted to create something like it that actually moves up and down? This does the thing, I wouldn't say its the best but yeah, the only minor things when its displayed is that the actual object ID color isn't yellow. It's actually white but I heard if the time is changed the color will change, may be false.

This include uses foreach and streamer. If you don't have those, then the performance of the include wont be the "best" so grab it by looking around/searching.

Checkpoints also set on the ground Z, this doesn't xD

Functions
Since the current version is 1.0, I expect to have the base finished before I add more features.

Okay lets begin with the functions:
  • native CreateDynamicPoint(&id, tag[], Float: x, Float: y, Float: z)
Usage:

pawn Код:
new Enter247; // This variable will store the ID, it's much more neat this way.

//Gamemodeinit? Or fsinit.
//instead of Enter247 = CreateDynamicPoint(...) theres now a parameter to be used, making it neater.
CreateDynamicPoint(Enter247, "24/7 Entry", 1234.0, 1234, 5);
^ That'll create the dynamic enter/exit arrow mover.

  • native IsValidPoint(pointid)
Usage:

pawn Код:
public OnPlayerEnterPoint(playerid, pointid)
{
    if(!IsValidPoint(pointid)) return print("script/include has a error"), 0;
    return 1;
}
^ Checks if a point is invalid/valid. Remember guys, point = the arrow that moves up and down
  • native DestroyDynamicPoint(pointid)
Usage:

pawn Код:
public OnPlayerEnterPoint(playerid, pointid)
{
    if(pointid == ObjectiveBriefcase)
    {
        DestroyDynamicPoint(ObjectiveBriefcase);
        return 1; // Isn't really needed but yeah.
    }
    return 1;
}
  • native GetPointTag(pointid)
Usage:

pawn Код:
CMD:derp(playerid, params[])
{
    new
        pID
        string[128]
    ;
   
    if(sscanf(params, "d", pID)) SendClientMessage(playerid, -1, "/derp [point id]");
    else if(!IsValidPoint(pID)) SendClientMessage(playerid, -1, "Invalid point");
    else
    {
        format(string, sizeof(string), "The tag of point: %d is %s", pID, GetPointTag(pID));
        SendClientMessage(playerid, -1, string);
    }
    return 1;
}
Gathers the pointid's tag via a command.

  • native GetTotalPoints()
Usage:

pawn Код:
//gamemodeinit or fsinit....
printf("There are %d points!", GetTotalPoints());
Callbacks

pawn Код:
public OnPlayerEnterPoint(playerid, pointid)
{
    return 1;
}

public OnPlayerLeavePoint(playerid, pointid)
{
    return 1;
}
If a player enters a point, if the player doesn't, self explanatory.

Pictures
I've got pictures but it's mainly the movement of the object going up and down.





Credits
Lorenc - Include
Incognito - Streamer
****** - foreach
[nL]W0rfleR - beast mapper finds me object id's in one second haha

Download

Version 1.0

Save as a_enterexits.inc and include it to your gamemode

Problems
"Please do report problems. I'll be repairing them ASAP. The code looks fine and should work well."

It's not been fully tested, if theres problems please try to explain the problem in the highest so I understand. I'd therefore commence this as a under construction script

Will be releasing more stuff soon. Just for the community
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)