Creating a simple 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: Creating a simple textdraw (
/showthread.php?tid=640371)
Textdraw does not appear -
adamslj - 01.09.2017
I am trying to learn how to use textdraws, and I am trying to create a simple one which shows a player a list of text when he types a command.
So, for example, it could be a list of colours. He types /textdraw and one appears, with a list such as --
- Blue
- Red
- Orange
- Green
and then there is a button which he can click to get rid of it.
So far, I've got this...
PHP код:
CMD:textdraw(playerid, params[])
{
ShowTextdraw(playerid);
return 1;
}
ShowTextdraw(playerid);
{
new
string[128];
format(string, sizeof(string), "Blue\nRed\nOrange\nGreen");
PlayerTextDrawSetString(playerid, PlayerData[playerid][pTextdraws][0], string);
return 1;
}
public OnPlayerConnect(playerid)
{
CreateTextDraws(playerid);
return 1;
}
CreateTextDraws(playerid) {
PlayerData[playerid][pTextdraws][0] = CreatePlayerTextDraw(playerid, 199.000000, 174.000000, "Colours");
PlayerTextDrawBackgroundColor(playerid, PlayerData[playerid][pTextdraws][0], 255);
PlayerTextDrawFont(playerid, PlayerData[playerid][pTextdraws][0], 1);
PlayerTextDrawLetterSize(playerid, PlayerData[playerid][pTextdraws][0], 0.310000, 1.100000);
PlayerTextDrawColor(playerid, PlayerData[playerid][pTextdraws][0], -1);
PlayerTextDrawSetOutline(playerid, PlayerData[playerid][pTextdraws][0], 0);
PlayerTextDrawSetProportional(playerid, PlayerData[playerid][pTextdraws][0], 1);
PlayerTextDrawSetShadow(playerid, PlayerData[playerid][pTextdraws][0], 1);
PlayerTextDrawSetSelectable(playerid, PlayerData[playerid][pTextdraws][0], 0);
}
But when I type the command in-game, nothing appears. I get no warnings when compiling.
Re: Creating a simple textdraw -
FuNkYTheGreat - 01.09.2017
Код:
ShowTextdraw(playerid);
{
new
string[128];
PlayerTextDrawShowForPlayer(playerid, PlayerData[playerid][pTextdraws][0]);
format(string, sizeof(string), "Blue\nRed\nOrange\nGreen");
PlayerTextDrawSetString(playerid, PlayerData[playerid][pTextdraws][0], string);
return 1;
}
You were not showing the TextDraw thats why the command wasn't even showing anything.