Creating a simple textdraw
#1

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.
Reply
#2

Код:
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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)