Game Text .:HELP:.
#1

I've seen a lot of server's use this and i was hoping someone could help me make it work. I'm wanting to change a gametext so you dont have to press a certain key.

I have to press a certain key in order for this information to pop up and i want to change it to where it pops up automatically.
Reply
#2

You use the streamer plugin by any chance?

If you do you can also create areas with it, and when a player enters an area show some textdraw or gametext.

If you don't use the streamer plugin you would either have to make your own area system or keep checking if the player is in range of the point you want the text to show.
Reply
#3

Yes i am using the streamer plugin...
Reply
#4

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.

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");
    }
}
Edit that and add "CreateTextPoint" lines in OnFilterSciptInit where the comments ask.

EG,
pawn Код:
CreateTextPoint( "Hello ~n~World!", 10.0, 0.0, 0.0, 0.0, 5000, 3);
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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)