SA-MP Forums Archive
How to change gametext into 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: How to change gametext into textdraw? (/showthread.php?tid=503010)



How to change gametext into textdraw? - ice2k1 - 27.03.2014

Hey.

How to change this gametext into textdraw?

Gametext:

pawn Код:
format(string, sizeof(string), "~g~Name:~w~%s~n~~g~Owner:~w~%s~n~~g~BizType:~w~%s ~n~~g~BizID:~w~%i", BusinessInfo[b][bName], BusinessInfo[b][bOwner], BusinessType(b), b);//Formats a string with all the info.
GameTextForPlayer(playerid, string, 3000, 3);
Textdraw:

pawn Код:
Textdraw0 = TextDrawCreate(446.000000, 366.000000, "Info~n~Owner: name_name~n~Business type~n~Status:~n~~r~Closed / Open");
TextDrawBackgroundColor(Textdraw0, 255);
TextDrawFont(Textdraw0, 1);
TextDrawLetterSize(Textdraw0, 0.500000, 1.000000);
TextDrawColor(Textdraw0, -1);
TextDrawSetOutline(Textdraw0, 0);
TextDrawSetProportional(Textdraw0, 1);
TextDrawSetShadow(Textdraw0, 1);
TextDrawUseBox(Textdraw0, 1);
TextDrawBoxColor(Textdraw0, 255);
TextDrawTextSize(Textdraw0, 612.000000, -9.000000);
Function:

pawn Код:
public OnPlayerPickUpDynamicPickup(playerid, pickupid)
{
    new string[256];
    for(new b = 1;b < sizeof(BusinessInfo);b++)// Loopd through all the businesses again.
    {
        if(pickupid == BusinessInfo[b][bOutsideIcon])//Checks if it's a biz pickup.
        {
           if(BusinessInfo[b][bOwned] == 0)//Checks if it is owned.
           {
                format(string, sizeof(string), "~g~Name:~w~%s~n~~w~This business is ~g~for sale!~n~~r~Price:~g~%i~n~BizType:~w~%s~n~~g~BizID:~w~%i", BusinessInfo[b][bName], BusinessInfo[b][bPrice], BusinessType(b), b);//Formats a string with all the info.
                GameTextForPlayer(playerid, string, 3000, 3);
           }
           if(BusinessInfo[b][bOwned] == 1)//Checks if it owned.
           {
                format(string, sizeof(string), "~g~Name:~w~%s~n~~g~Owner:~w~%s~n~~g~BizType:~w~%s ~n~~g~BizID:~w~%i", BusinessInfo[b][bName], BusinessInfo[b][bOwner], BusinessType(b), b);//Formats a string with all the info.
                GameTextForPlayer(playerid, string, 3000, 3);
           }
        }
    }
    return 1;
}



Re: How to change gametext into textdraw? - iThePunisher - 27.03.2014

Removed


Re: How to change gametext into textdraw? - [HK]Ryder[AN] - 27.03.2014

Use this code

pawn Код:
//Put this under OnGameModeInit
Textdraw0 = TextDrawCreate(446.000000, 366.000000, "Info~n~Owner: name_name~n~Business type~n~Status:~n~~r~Closed / Open");
TextDrawBackgroundColor(Textdraw0, 255);
TextDrawFont(Textdraw0, 1);
TextDrawLetterSize(Textdraw0, 0.500000, 1.000000);
TextDrawColor(Textdraw0, -1);
TextDrawSetOutline(Textdraw0, 0);
TextDrawSetProportional(Textdraw0, 1);
TextDrawSetShadow(Textdraw0, 1);
TextDrawUseBox(Textdraw0, 1);
TextDrawBoxColor(Textdraw0, 255);
TextDrawTextSize(Textdraw0, 612.000000, -9.000000);

//Replace your current function with this
public OnPlayerPickUpDynamicPickup(playerid, pickupid)
{
    new string[256];
    for(new b = 1;b < sizeof(BusinessInfo);b++)// Loopd through all the businesses again.
    {
        if(pickupid == BusinessInfo[b][bOutsideIcon])//Checks if it's a biz pickup.
        {
           if(BusinessInfo[b][bOwned] == 0)//Checks if it is owned.
           {
                format(string, sizeof(string), "~g~Name:~w~%s~n~~w~This business is ~g~for sale!~n~~r~Price:~g~%i~n~BizType:~w~%s~n~~g~BizID:~w~%i", BusinessInfo[b][bName], BusinessInfo[b][bPrice], BusinessType(b), b);//Formats a string with all the info.
                TextDrawSetString(Textdraw0, string);
                TextDrawShowForPlayer(playerid, Textdraw0);
           }
           if(BusinessInfo[b][bOwned] == 1)//Checks if it owned.
           {
                format(string, sizeof(string), "~g~Name:~w~%s~n~~g~Owner:~w~%s~n~~g~BizType:~w~%s ~n~~g~BizID:~w~%i", BusinessInfo[b][bName], BusinessInfo[b][bOwner], BusinessType(b), b);//Formats a string with all the info.
                TextDrawSetString(Textdraw0, string);
                TextDrawShowForPlayer(playerid, Textdraw0);
           }
        }
    }
    return 1;
}



Re: How to change gametext into textdraw? - ice2k1 - 27.03.2014

And how to set it to hide after 5 sec?


Re: How to change gametext into textdraw? - TLN - 27.03.2014

pawn Код:
SetTimerEx("HideTD", 5000, false, "i", playerid);
pawn Код:
forward HideTD(playerid);
public HideTD(playerid)
{
    TextDrawHideForPlayer(playerid, Textdraw0);
    return 1;
}