How to change gametext into textdraw?
#1

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;
}
Reply
#2

Removed
Reply
#3

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;
}
Reply
#4

And how to set it to hide after 5 sec?
Reply
#5

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


Forum Jump:


Users browsing this thread: 1 Guest(s)