Textdraw on Joining
#1

Hi,

i want have a textdraw in middle of my monitor if i join my server.

Like: Welcome To xxxxxxxxx
Visit: xxxxxxxxxx
(with colours)

have anyone the code for it
Reply
#2

Im not sure what you mean, but if you want a message to all when a player joins a server try this

Add this under OnPlayerConnect

Код:
  new pName[MAX_PLAYER_NAME];
  new string[48];
  GetPlayerName(playerid, pName, sizeof(pName));
  format(string, sizeof(string), "Welcome to % (Joining)", pName);
  SendClientMessageToAll(COLOR_GREY, string);
Reply
#3

here, that i mean:

http://www.myimg.de/?img=samp176c23b6.png
Reply
#4

You have to edit to fit your needs... like text size, positions, colors, etc.

pawn Код:
public OnPlayerConnect(playerid)
{
    new Text:JoinText;
    new JName[64], string[128];
    GetPlayerName(playerid, JName, sizeof(JName));

    JoinText = TextDrawCreate(300.000000,350.000000,"-");
    TextDrawFont(JoinText,2);
    TextDrawLetterSize(JoinText,0.399999,2.000000);
    TextDrawSetShadow(JoinText,1);
    TextDrawSetOutline(JoinText,1);
    format(string, sizeof(string), "%s Welcome To server", JName);
    TextDrawSetString(JoinText, string);
    TimeTextForPlayer(playerid, JoinText, 6000);
You need this in your script too:
pawn Код:
forward TimeTextForPlayer(playerid, Text:text, time)
public TimeTextForPlayer(playerid, Text:text, time)
{
    TextDrawShowForPlayer(playerid,text);
    SetTimerEx("DestroyTextTimer",time,0,"i",_:text); // from Simon
}

forward DestroyTextTimer(Text:text);
public DestroyTextTimer(Text:text)
{
    TextDrawDestroy(text);
}
Reply
#5

OK thx and where i must paste it?

nd how can i add more lines?

format(string, sizeof(string), "%s Welcome To server", JName);
format(string, sizeof(string), "Visit us: xxxx", JName);

is this right?
Reply
#6

Код:
format(string, sizeof(string), "%s Welcome To server~n~Visit us: xxxx", JName,something);
Reply
#7

Okay ty, and how can i colour it? And where i must paste it
Reply
#8

pawn Код:
TextDrawColor(JoinText, 0xFF0000FF); // Red
Just put it under TextDrawSetOutline....
Reply
#9

Hi there,

You can use "~n~" to insert a new line.

For example, this:
Код:
~g~Hello~w~,~n~~b~%s~w~.
Would print out:
Quote:
Hello,
%s.

Have fun scripting.

Kind regards,

Francis Morissette
SA-MP Scripter
http://sa-mp.com
Reply
#10

error
D:\VISKAS~1\Serveris\Server1\GAMEMO~1\LT-SF.pwn(546) : error 001: expected token: ";", but found "public"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


1 Error.

forward TimeTextForPlayer(playerid, Text:text, time)
public TimeTextForPlayer(playerid, Text:text, time)
{
TextDrawShowForPlayer(playerid,text);
SetTimerEx("DestroyTextTimer",time,0,"i",_:text); // from Simon
}

forward DestroyTextTimer(Text:text);
public DestroyTextTimer(Text:text)
{
TextDrawDestroy(text);
}
Reply


Forum Jump:


Users browsing this thread: