SA-MP Forums Archive
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(playeridparams[])
{
    
ShowTextdraw(playerid);
    return 
1;
}
ShowTextdraw(playerid);
{
    new
        
string[128];
    
format(stringsizeof(string), "Blue\nRed\nOrange\nGreen");
    
PlayerTextDrawSetString(playeridPlayerData[playerid][pTextdraws][0], string);
    return 
1;
}
public 
OnPlayerConnect(playerid)
{
    
CreateTextDraws(playerid);
    return 
1;
}
CreateTextDraws(playerid) {    
    
PlayerData[playerid][pTextdraws][0] = CreatePlayerTextDraw(playerid199.000000174.000000"Colours");
    
PlayerTextDrawBackgroundColor(playeridPlayerData[playerid][pTextdraws][0], 255);
    
PlayerTextDrawFont(playeridPlayerData[playerid][pTextdraws][0], 1);
    
PlayerTextDrawLetterSize(playeridPlayerData[playerid][pTextdraws][0], 0.3100001.100000);
    
PlayerTextDrawColor(playeridPlayerData[playerid][pTextdraws][0], -1);
    
PlayerTextDrawSetOutline(playeridPlayerData[playerid][pTextdraws][0], 0);
    
PlayerTextDrawSetProportional(playeridPlayerData[playerid][pTextdraws][0], 1);
    
PlayerTextDrawSetShadow(playeridPlayerData[playerid][pTextdraws][0], 1);
    
PlayerTextDrawSetSelectable(playeridPlayerData[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.