03.06.2012, 08:38
(
Последний раз редактировалось iggy1; 03.06.2012 в 09:25.
Причина: Fixed a bug i spotted
)
Well you can create areas with the plugin (CreateDynamicRectangle ect) and use the callback "OnPlayerEnterDynamicArea". Look through the plugins first post for all the functions/callbacks.
I did make you a little script but haven't tested it. It might not work.
Edit that and add "CreateTextPoint" lines in OnFilterSciptInit where the comments ask.
EG,
You could also see how i've done that and implement your own system, it's really simple. Probably would have been better if i made it an include.
I did make you a little script but haven't tested it. It might not work.
pawn Код:
#define FILTERSCRIPT
#include <a_samp>
#include <foreach>
#define MAX_TEXTPOINTS (10)//increase if you need more than 10 obviously
#define MAX_TEXTPOINT_LENGTH (128)//im not sure about gametext max strings
#define TEXTPOINT_UPDATE_TIME (1000)//1 second change if you want
forward textpoint_Update();
enum E_TEXTPOINT_DATA
{
TEXTPOINT_TEXT[MAX_TEXTPOINT_LENGTH],
Float: TEXTPOINT_X,
Float: TEXTPOINT_Y,
Float: TEXTPOINT_Z,
TEXTPOINT_RANGE,
TEXTPOINT_TIME,
TEXTPOINT_STYLE
}
new gTextPointData[MAX_TEXTPOINTS][E_TEXTPOINT_DATA];
new gTextPointTimerID;
new gTextPointCount=0;
new Iterator:TextPointItr<MAX_TEXTPOINTS>;
public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" TextPoints Loadesd");
print("--------------------------------------\n");
// create text points here /////////////////////////////////////////////////
// CreateTextPoint( const Text[], Float: range, Float: x, Float: y, Float: z, time, type )
// ...
////////////////////////////////////////////////////////////////////////////
gTextPointTimerID = SetTimer( "textpoint_Update", TEXTPOINT_UPDATE_TIME, true );
return 1;
}
public OnFilterScriptExit()
{
KillTimer( gTextPointTimerID );
return 1;
}
public textpoint_Update()
{
foreach(new textpointid : TextPointItr)//loop through created textpoints
{
foreach(new playerid : Player)//loop through connected players
{
if( IsPlayerInRangeOfPoint( playerid, gTextPointData[textpointid][TEXTPOINT_RANGE], gTextPointData[textpointid][TEXTPOINT_X],
gTextPointData[textpointid][TEXTPOINT_Y], gTextPointData[textpointid][TEXTPOINT_Z] ) )
{
GameTextForPlayer( playerid, gTextPointData[textpointid][TEXTPOINT_TEXT], gTextPointData[textpointid][TEXTPOINT_TIME], gTextPointData[textpointid][TEXTPOINT_STYLE]);
}
}
}
}
/*
Function: CreateTextPoint
Params:
Text[] - The string to display at the position.
Float: Range - How far to show the text from the position
Float x, y, z - co-ordinates for the text point to be created on.
time - Time to show the text
style - style of the gametext
*/
stock CreateTextPoint( const Text[], Float: range, Float: x, Float: y, Float: z, time, style )
{
if( gTextPointCount < MAX_TEXTPOINTS )
{
strcat(gTextPointData[gTextPointCount][TEXTPOINT_TEXT], Text );
gTextPointData[gTextPointCount][TEXTPOINT_RANGE] = range;
gTextPointData[gTextPointCount][TEXTPOINT_X] = x;
gTextPointData[gTextPointCount][TEXTPOINT_Y] = y;
gTextPointData[gTextPointCount][TEXTPOINT_Z] = z;
gTextPointData[gTextPointCount][TEXTPOINT_TIME] = time;
gTextPointData[gTextPointCount][TEXTPOINT_STYLE] = style;
Iter_Add(TextPointItr, gTextPointCount++);
}
else
{
printf("ERROR: Max textpoints reached");
}
}
EG,
pawn Код:
CreateTextPoint( "Hello ~n~World!", 10.0, 0.0, 0.0, 0.0, 5000, 3);