Inserting Text Draws in GameMod?
#1

I have this.

Код:
//On top of script:
new Text:Textdraw0;
new Text:Textdraw1;
new Text:Textdraw2;
 
//In OnGameModeInit or any other place, we procced to create our textdraw:
Textdraw0 = TextDrawCreate(4.000000,330.000000,"Original Cops And Robbers");
Textdraw1 = TextDrawCreate(3.000000,317.000000,"Welcome to");
Textdraw2 = TextDrawCreate(453.000000,2.000000,"Hosted by www.sampservers.info");
TextDrawAlignment(Textdraw0,0);
TextDrawAlignment(Textdraw1,0);
TextDrawAlignment(Textdraw2,0);
TextDrawBackgroundColor(Textdraw0,0xff00ff99);
TextDrawBackgroundColor(Textdraw1,0x00ff0099);
TextDrawBackgroundColor(Textdraw2,0x0000ff99);
TextDrawFont(Textdraw0,2);
TextDrawLetterSize(Textdraw0,0.299999,1.100000);
TextDrawFont(Textdraw1,2);
TextDrawLetterSize(Textdraw1,0.399999,1.000000);
TextDrawFont(Textdraw2,3);
TextDrawLetterSize(Textdraw2,0.299999,1.000000);
TextDrawColor(Textdraw0,0xffffffff);
TextDrawColor(Textdraw1,0xffffffff);
TextDrawColor(Textdraw2,0xffffffff);
TextDrawSetOutline(Textdraw0,1);
TextDrawSetOutline(Textdraw1,1);
TextDrawSetOutline(Textdraw2,1);
TextDrawSetProportional(Textdraw0,1);
TextDrawSetProportional(Textdraw1,1);
TextDrawSetProportional(Textdraw2,1);
TextDrawSetShadow(Textdraw0,3);
TextDrawSetShadow(Textdraw1,1);
TextDrawSetShadow(Textdraw2,1);
The "new Text:Textdraw0;" Im quessing goses under the includes?


The stuff that gose under OnGameModeInit, I put it in "on its own" and got errors.

What do i have to add?

Thanks
Reply
#2

pawn Код:
/* 3 lines below go anywhere outside of a callback */
new Text:Textdraw0;
new Text:Textdraw1;
new Text:Textdraw2;

public OnGameModeInit()
{
    Textdraw0 = TextDrawCreate(4.000000,330.000000,"Original Cops And Robbers");
    Textdraw1 = TextDrawCreate(3.000000,317.000000,"Welcome to");
    Textdraw2 = TextDrawCreate(453.000000,2.000000,"Hosted by www.sampservers.info");
    TextDrawAlignment(Textdraw0,0);
    TextDrawAlignment(Textdraw1,0);
    TextDrawAlignment(Textdraw2,0);
    TextDrawBackgroundColor(Textdraw0,0xff00ff99);
    TextDrawBackgroundColor(Textdraw1,0x00ff0099);
    TextDrawBackgroundColor(Textdraw2,0x0000ff99);
    TextDrawFont(Textdraw0,2);
    TextDrawLetterSize(Textdraw0,0.299999,1.100000);
    TextDrawFont(Textdraw1,2);
    TextDrawLetterSize(Textdraw1,0.399999,1.000000);
    TextDrawFont(Textdraw2,3);
    TextDrawLetterSize(Textdraw2,0.299999,1.000000);
    TextDrawColor(Textdraw0,0xffffffff);
    TextDrawColor(Textdraw1,0xffffffff);
    TextDrawColor(Textdraw2,0xffffffff);
    TextDrawSetOutline(Textdraw0,1);
    TextDrawSetOutline(Textdraw1,1);
    TextDrawSetOutline(Textdraw2,1);
    TextDrawSetProportional(Textdraw0,1);
    TextDrawSetProportional(Textdraw1,1);
    TextDrawSetProportional(Textdraw2,1);
    TextDrawSetShadow(Textdraw0,3);
    TextDrawSetShadow(Textdraw1,1);
    TextDrawSetShadow(Textdraw2,1);
    return 1;
}
Then you can use the following where you need them:
pawn Код:
TextDrawShowForPlayer(playerid, Textdraw0);
TextDrawShowForPlayer(playerid, Textdraw1);
TextDrawShowForPlayer(playerid, Textdraw2);
Or, if you want to show the textdraw's to all online players:
pawn Код:
TextDrawShowForAll(playerid, Textdraw0);
TextDrawShowForAll(playerid, Textdraw1);
TextDrawShowForAll(playerid, Textdraw2);
Reply
#3

I ented the "TextDrawShowForPlayer(playerid, Textdraw0);" but i got Undifend on the "playerid" ?
Reply
#4

Quote:
Originally Posted by Jackster
Посмотреть сообщение
I ented the "TextDrawShowForPlayer(playerid, Textdraw0);" but i got Undifend on the "playerid" ?
https://sampwiki.blast.hk/wiki/TextDrawShowForPlayer

pawn Код:
TextDrawShowForPlayer(playerid, Text:Textdraw0);
EDIT: You cannot use that at OnGameModeInit, as playerid isn't defined at that callback
Reply
#5

I did have it with some other TextDraws as having under the GameModeINIT still gave erros..
Reply
#6

Quote:
Originally Posted by Jackster
Посмотреть сообщение
I did have it with some other TextDraws as having under the GameModeINIT still gave erros..
You cannot use that at OnGameModeInit, as playerid isn't defined at that callback. Try use it on OnPlayerConnect callback.
Reply
#7

Can u make it? Im still learning. Example of 1 is fine. Thanks
Reply
#8

pawn Код:
public OnPlayerConnect(playerid)
{
    TextDrawShowForPlayer(playerid, Text:Textdraw0);
    TextDrawShowForPlayer(playerid, Text:Textdraw1);
    TextDrawShowForPlayer(playerid, Text:Textdraw2);
    return 1;
}
Reply
#9

Will the text draw stay on fo every player or just when 1 login?
Reply
#10

It will show it to every player that connects to the server.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)