SA-MP Forums Archive
Textdraw Command - 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: Textdraw Command (/showthread.php?tid=528069)



Textdraw Command - mohdapiz - 26.07.2014

Hello all i want to make recent command use textdraw for example :

when player use /smoke

textdraw on screen show Player Name used /smoke in textdraw

how to make it? please help

sorry for my bad english


Re: Textdraw Command - Blademaster680 - 26.07.2014

What player must see the textdraw? the player who used /smoke or all the players?


Re: Textdraw Command - mohdapiz - 26.07.2014

all player see it.. how to make it??

can u help me


Re: Textdraw Command - Affan - 26.07.2014

pawn Код:
#include <a_samp>
#include <foreach> // We need this for looping

new Text:DescriptionText[MAX_PLAYERS];
new DescriptionTimer[MAX_PLAYERS];

public OnPlayerConnect(playerid)
{
    DescriptionText[playerid] = TextDrawCreate(320.0, 380.0, " ");
    TextDrawAlignment(DescriptionText[playerid], 2);
    TextDrawFont(DescriptionText[playerid], 1);
    TextDrawLetterSize(DescriptionText[playerid], 0.320000, 1.700000);
    TextDrawSetOutline(DescriptionText[playerid], 1);
    TextDrawHideForPlayer(playerid, DescriptionText[playerid]);
    return 1;
}

forward HideDescriptionText(playerid);
public HideDescriptionText(playerid)
{
    TextDrawHideForPlayer(playerid, DescriptionText[playerid]);
    return 1;
}

CMD:smoke(playerid, params[])
{
    foreach(new i : Player)
    {
        new string[128], sName[24];
        GetPlayerName(playerid, sName, sizeof(sName));
        format(string, sizeof(string), "~r~%s ~w~has used the command ~b~/smoke", sName);
        ShowDescriptionText(i, string);
    }
    return 1;
}

stock ShowDescriptionText(playerid, string[])
{
    KillTimer(DescriptionTimer[playerid]);
    TextDrawSetString(DescriptionText[playerid], string);
    TextDrawShowForPlayer(playerid, DescriptionText[playerid]);
    DescriptionTimer[playerid] = SetTimerEx("HideDescriptionText", 5000, 0, "i", playerid);
    return 1;
}
You can set it to a different position if you want. I just used this tutorial to make the textdraws.


Re: Textdraw Command - mohdapiz - 26.07.2014

thank you i try it now


Re: Textdraw Command - mohdapiz - 26.07.2014

nice but.. i want to make when another player used it show like chat

example

Player 1 has used /smoke
Player 2 has used /weed

like this i show example

http://oi62.tinypic.com/oft2ir.jpg

please help me


Re: Textdraw Command - Affan - 26.07.2014

Edit this to your preference
pawn Код:
DescriptionText[playerid] = TextDrawCreate(320.0, 380.0, " ");
    TextDrawAlignment(DescriptionText[playerid], 2);
    TextDrawFont(DescriptionText[playerid], 1);
    TextDrawLetterSize(DescriptionText[playerid], 0.320000, 1.700000);
    TextDrawSetOutline(DescriptionText[playerid], 1);
    TextDrawHideForPlayer(playerid, DescriptionText[playerid]);
And change the command to
pawn Код:
CMD:smoke(playerid, params[])
{
    foreach(new i : Player)
    {
        new string[128], sName[24];
        GetPlayerName(playerid, sName, sizeof(sName));
        format(string, sizeof(string), "~r~[DM] ~w~%s(%d) has joined /smoke", sName, playerid);
        ShowDescriptionText(i, string);
    }
    return 1;
}
I see you like xSF very much.


Re: Textdraw Command - mohdapiz - 26.07.2014

i dont know to edit i newbie.


Re: Textdraw Command - mohdapiz - 26.07.2014

i want to make when other player use command textdraw show bottom after else used..

example

i use /smoke
when other player used /smoke it show

player 1 used /smoke
player 2 used /smoke

and when 4 textdraw show it loop