Announce help
#1

^^^^^^^^
Reply
#2

Why would you make it this Difficult,you can do this

pawn Код:
CMD:announce(playerid, params[])
{
    new message[126];
    format(message,sizeof(message), "%s", params);
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        GameTextForPlayer(i, message, 5000, 6);
    }
}
Reply
#3

pawn Код:
GameTextForAll( "~w~test", 5000, 0 );
Reply
#4

pawn Код:
#include <zcmd>

CMD:announce(playerid, params[])
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        GameTextForPlayer(i, "~w~test", 5000, 6);
    }
}
Reply
#5

^^^^^^^^
Reply
#6

** Removed.
Reply
#7

1) Create your TD in OnGameModeInit()
2) Use the "_" character as the textstring when creating
3) Show for player when connecting
4) Use TextDrawSetString() to change the text and a timer
5) The timer will use TextDrawSetString() to set the textdraw back to the the "_" character making it invisible
Reply
#8

Quote:
Originally Posted by Ananisiki
Посмотреть сообщение
I want font #3, not a GameText..
Then make it yourself by using a Textdraw Editor: https://sampforum.blast.hk/showthread.php?tid=376758

GameText does pretty much the same result with the one you've posted in the picture.

@There's a function called "GameTextForAll", it's not necessary to loop through all the players!
Reply
#9

pawn Код:
/*
This is how to do it with a textdraw but using GameTextForPlayer is more recommended
    ZCMD - Zeex
   (SSCANF)SSCANF2 - ******
*/


new Text:ann;
forward HideAnn();

public OnGameModeInit()
{
    ann = TextDrawCreate(320.000000, 240.000000, "_");
    TextDrawAlignment(ann, 2);
    TextDrawBackgroundColor(ann, 255);
    TextDrawFont(ann, 3);
    TextDrawLetterSize(ann, 1.0, 1.400003);
    TextDrawColor(ann, -1);
    TextDrawSetOutline(ann, 1);
    TextDrawSetProportional(ann, 1);
    return 1;
}

CMD:announce(playerid, params[])
{
   new string[256];
   if(sscanf(params, "s[256]", params)) return SendClientMessage(playerid, -1, "/announce [message]");
   format(string, sizeof(string), "%s", params);
   TextDrawSetString(ann, string);
   TextDrawShowForAll(ann);
   SetTimer("HideAnn", 10000, false);
   return 1;
}

public HideAnn()
{
   TextDrawHideForAll(ann);
   return 1;
}
Reply
#10

Why bother using sscanf() and format() ?
Why bother hiding/showing the TD?
Why bother using return's that do nothing ?

pawn Код:
new Text:ann;
forward HideAnn();

public OnGameModeInit()
{
    ann = TextDrawCreate(320.000000, 240.000000, "_");
    TextDrawAlignment(ann, 2);
    TextDrawBackgroundColor(ann, 255);
    TextDrawFont(ann, 3);
    TextDrawLetterSize(ann, 1.0, 1.400003);
    TextDrawColor(ann, -1);
    TextDrawSetOutline(ann, 1);
    TextDrawSetProportional(ann, 1);
}

public OnPlayerConnect(playerid)
{
    TextDrawShowForPlayer(ann, playerid);
}

CMD:announce(playerid, params[])
{
    if(isnull(params)) SendClientMessage(playerid, -1, "/announce [message]");
    else
    {
        TextDrawSetString(ann, params);
        SetTimer("HideAnn", 10000, false);
    }
    return 1;
}

public HideAnn()
{
   TextDrawSetString(ann, "_");
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)