SA-MP Forums Archive
Inserting Text Draws in GameMod? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Inserting Text Draws in GameMod? (/showthread.php?tid=159069)



Inserting Text Draws in GameMode? - Jackster - 12.07.2010

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


Re: Inserting Text Draws in GameMod? - TheInnocentOne - 12.07.2010

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);



Re: Inserting Text Draws in GameMod? - Jackster - 12.07.2010

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


Re: Inserting Text Draws in GameMod? - MikkelGutten - 12.07.2010

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


Re: Inserting Text Draws in GameMod? - Jackster - 12.07.2010

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


Re: Inserting Text Draws in GameMod? - MikkelGutten - 12.07.2010

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.


Re: Inserting Text Draws in GameMod? - Jackster - 12.07.2010

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


Re: Inserting Text Draws in GameMod? - MikkelGutten - 12.07.2010

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



Re: Inserting Text Draws in GameMod? - Jackster - 12.07.2010

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


Re: Inserting Text Draws in GameMod? - MikkelGutten - 12.07.2010

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