26.08.2011, 14:55
Enter/Exit points
Creating default entering/exiting stores arrows that move and respond!
What is this?Creating default entering/exiting stores arrows that move and respond!
As most of you people, you may of inserted this little code into your gamemodes init:
pawn Код:
DisableInteriorEnterExits();
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)
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);
- native IsValidPoint(pointid)
pawn Код:
public OnPlayerEnterPoint(playerid, pointid)
{
if(!IsValidPoint(pointid)) return print("script/include has a error"), 0;
return 1;
}
- native DestroyDynamicPoint(pointid)
pawn Код:
public OnPlayerEnterPoint(playerid, pointid)
{
if(pointid == ObjectiveBriefcase)
{
DestroyDynamicPoint(ObjectiveBriefcase);
return 1; // Isn't really needed but yeah.
}
return 1;
}
- native GetPointTag(pointid)
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;
}
- native GetTotalPoints()
pawn Код:
//gamemodeinit or fsinit....
printf("There are %d points!", GetTotalPoints());
pawn Код:
public OnPlayerEnterPoint(playerid, pointid)
{
return 1;
}
public OnPlayerLeavePoint(playerid, pointid)
{
return 1;
}
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