Help with TextDraw? - 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)
+--- Thread: Help with TextDraw? (
/showthread.php?tid=359290)
Help with TextDraw? -
jNkk - 13.07.2012
I just got back in scripting, and I need some help.
I wanna make so when I type a command, a textdraw box with some text in it appears.
And then, when the player presses "LMB" ( left mouse button ) the box, text closes.
Here is my script that I done , and doesn't work. If you can please fix it for me.
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/rules", cmdtext, true, 10) == 0)
{
TextDrawCreate(320, 240, "xD");
TextDrawFont(rules, 2);
TextDrawLetterSize(rules, 0.7, 4.9);
TextDrawColor(rules, 0xB90000FF);
TextDrawSetOutline(rules , 0);
TextDrawSetProportional(rules , 1);
TextDrawSetShadow(rules , 1);
TextDrawUseBox(rules,1);
TextDrawBoxColor(rules, 0x000000FF);
TextDrawTextSize(rules, 0, 0);
return 1;
}
return 0;
}
Thank you.
Re: Help with TextDraw? -
jNkk - 13.07.2012
God, I'm such a big idiot.
I got it. I just had to put the script in OnGamemodeInit, and then on Cmd with TextDrawShowForPlayer.
For those who had the same problem , here is the solution :
Код:
public OnGameModeInit()
{
rules =TextDrawCreate(320, 240, "xD");
TextDrawFont(rules, 2);
TextDrawLetterSize(rules, 0.7, 4.9);
TextDrawColor(rules, 0xB90000FF);
TextDrawSetOutline(rules , 0);
TextDrawSetProportional(rules , 1);
TextDrawSetShadow(rules , 1);
TextDrawUseBox(rules,1);
TextDrawBoxColor(rules, 0x000000FF);
TextDrawTextSize(rules, 0, 0);
return 1;
}
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/rules", cmdtext, true, 10) == 0)
{
TextDrawShowForPlayer(playerid, rules);
return 1;
}
return 0;
}
But I still have one problem. How do I make it so when player clicks (LMB) it closes?