SA-MP Forums Archive
textdraw bugged - 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 bugged (/showthread.php?tid=582675)



textdraw bugged - Antoniohl - 22.07.2015

it's all working but it doesn't update the area name it's stuck with Los Santos City Hall

and it's made in a timer, so it should work.
it was working before i make it for PlayerTextDraw, it was global
Код:
	PlayerData[playerid][pTextdraws][85] = CreatePlayerTextDraw(playerid, 87.598846, 320.083374, "Los Santos City Hall");
	PlayerTextDrawLetterSize(playerid, PlayerData[playerid][pTextdraws][85], 0.269282, 1.845000);
	PlayerTextDrawAlignment(playerid, PlayerData[playerid][pTextdraws][85], 2);
	PlayerTextDrawColor(playerid, PlayerData[playerid][pTextdraws][85], -1);
	PlayerTextDrawSetShadow(playerid, PlayerData[playerid][pTextdraws][85], 0);
	PlayerTextDrawSetOutline(playerid, PlayerData[playerid][pTextdraws][85], 0);
	PlayerTextDrawBackgroundColor(playerid, PlayerData[playerid][pTextdraws][85], 255);
	PlayerTextDrawFont(playerid, PlayerData[playerid][pTextdraws][85], 1);
	PlayerTextDrawSetProportional(playerid, PlayerData[playerid][pTextdraws][85], 1);
	PlayerTextDrawSetShadow(playerid, PlayerData[playerid][pTextdraws][85], 0);
Код:
		format(str, sizeof(str), "%s", GetPlayerLocation(i), '%');
		PlayerTextDrawSetString(1, PlayerData[i][pTextdraws][85], str);
Код:
stock GetPlayerLocation(playerid)
{
	new
	    Float:fX,
	    Float:fY,
		Float:fZ,
		string[32],
		id = -1;

	if ((id = House_Inside(playerid)) != -1)
	{
		fX = HouseData[id][housePos][0];
		fY = HouseData[id][housePos][1];
		fZ = HouseData[id][housePos][2];
	}
	else if ((id = Business_Inside(playerid)) != -1)
	{
		fX = BusinessData[id][bizPos][0];
		fY = BusinessData[id][bizPos][1];
		fZ = BusinessData[id][bizPos][2];
	}
	else if ((id = Entrance_Inside(playerid)) != -1)
	{
		fX = EntranceData[id][entrancePos][0];
		fY = EntranceData[id][entrancePos][1];
		fZ = EntranceData[id][entrancePos][2];
	}
	else GetPlayerPos(playerid, fX, fY, fZ);

	format(string, 32, GetLocation(fX, fY, fZ));
	return string;
}
Код:
stock GetLocation(Float:fX, Float:fY, Float:fZ)
{
    enum e_ZoneData
	{
     	e_ZoneName[32 char],
     	Float:e_ZoneArea[6]
	};
	new const g_arrZoneData[][e_ZoneData] =
	{
		{!"The Big Ear", 	              {-410.00, 1403.30, -3.00, -137.90, 1681.20, 200.00}},
		{!"Aldea Malvada",                {-1372.10, 2498.50, 0.00, -1277.50, 2615.30, 200.00}},
		{!"Angel Pine",                   {-2324.90, -2584.20, -6.10, -1964.20, -2212.10, 200.00}},
		{!"Arco del Oeste",               {-901.10, 2221.80, 0.00, -592.00, 2571.90, 200.00}},
		{!"Avispa Country Club",          {-2646.40, -355.40, 0.00, -2270.00, -222.50, 200.00}},
		{!"Avispa Country Club",          {-2831.80, -430.20, -6.10, -2646.40, -222.50, 200.00}},
		{!"Avispa Country Club",          {-2361.50, -417.10, 0.00, -2270.00, -355.40, 200.00}},
		{!"Avispa Country Club",          {-2667.80, -302.10, -28.80, -2646.40, -262.30, 71.10}},
		{!"Avispa Country Club",          {-2470.00, -355.40, 0.00, -2270.00, -318.40, 46.10}},
		{!"Avispa Country Club",          {-2550.00, -355.40, 0.00, -2470.00, -318.40, 39.70}},
		{!"Back o Beyond",                {-1166.90, -2641.10, 0.00, -321.70, -1856.00, 200.00}},
		{!"Battery Point",                {-2741.00, 1268.40, -4.50, -2533.00, 1490.40, 200.00}},
		{!"Bayside",                      {-2741.00, 2175.10, 0.00, -2353.10, 2722.70, 200.00}},
		{!"Bayside Marina",               {-2353.10, 2275.70, 0.00, -2153.10, 2475.70, 200.00}},
		{!"Beacon Hill",                  {-399.60, -1075.50, -1.40, -319.00, -977.50, 198.50}},
		{!"Blackfield",                   {964.30, 1203.20, -89.00, 1197.30, 1403.20, 110.90}},
		{!"Blackfield",                   {964.30, 1403.20, -89.00, 1197.30, 1726.20, 110.90}},
		{!"Blackfield Chapel",            {1375.60, 596.30, -89.00, 1558.00, 823.20, 110.90}},
		{!"Blackfield Chapel",            {1325.60, 596.30, -89.00, 1375.60, 795.00, 110.90}},
		{!"Blackfield Intersection",      {1197.30, 1044.60, -89.00, 1277.00, 1163.30, 110.90}},
		{!"Blackfield Intersection",      {1166.50, 795.00, -89.00, 1375.60, 1044.60, 110.90}},
		{!"Blackfield Intersection",      {1277.00, 1044.60, -89.00, 1315.30, 1087.60, 110.90}},
		{!"Blackfield Intersection",      {1375.60, 823.20, -89.00, 1457.30, 919.40, 110.90}},
		{!"Blueberry",                    {104.50, -220.10, 2.30, 349.60, 152.20, 200.00}},
		{!"Blueberry",                    {19.60, -404.10, 3.80, 349.60, -220.10, 200.00}},
		{!"Blueberry Acres",              {-319.60, -220.10, 0.00, 104.50, 293.30, 200.00}},
		{!"Caligula's Palace",            {2087.30, 1543.20, -89.00, 2437.30, 1703.20, 110.90}},
		{!"Caligula's Palace",            {2137.40, 1703.20, -89.00, 2437.30, 1783.20, 110.90}},
		{!"Calton Heights",               {-2274.10, 744.10, -6.10, -1982.30, 1358.90, 200.00}},
		{!"Chinatown",                    {-2274.10, 578.30, -7.60, -2078.60, 744.10, 200.00}},
		{!"City Hall",                    {-2867.80, 277.40, -9.10, -2593.40, 458.40, 200.00}},
		{!"Come-A-Lot",                   {2087.30, 943.20, -89.00, 2623.10, 1203.20, 110.90}},
		{!"Commerce",                     {1323.90, -1842.20, -89.00, 1701.90, -1722.20, 110.90}},
		{!"Commerce",                     {1323.90, -1722.20, -89.00, 1440.90, -1577.50, 110.90}},
		{!"Commerce",                     {1370.80, -1577.50, -89.00, 1463.90, -1384.90, 110.90}},
		{!"Commerce",                     {1463.90, -1577.50, -89.00, 1667.90, -1430.80, 110.90}},
		{!"Commerce",                     {1583.50, -1722.20, -89.00, 1758.90, -1577.50, 110.90}},
		{!"Commerce",                     {1667.90, -1577.50, -89.00, 1812.60, -1430.80, 110.90}},
		{!"Conference Center",            {1046.10, -1804.20, -89.00, 1323.90, -1722.20, 110.90}},
		{!"Conference Center",            {1073.20, -1842.20, -89.00, 1323.90, -1804.20, 110.90}},
		{!"Cranberry Station",            {-2007.80, 56.30, 0.00, -1922.00, 224.70, 100.00}},
		{!"Creek",                        {2749.90, 1937.20, -89.00, 2921.60, 2669.70, 110.90}},
		{!"Dillimore",                    {580.70, -674.80, -9.50, 861.00, -404.70, 200.00}},
		{!"Doherty",                      {-2270.00, -324.10, -0.00, -1794.90, -222.50, 200.00}},
		{!"Doherty",                      {-2173.00, -222.50, -0.00, -1794.90, 265.20, 200.00}},
		{!"Downtown",                     {-1982.30, 744.10, -6.10, -1871.70, 1274.20, 200.00}},
		{!"Downtown",                     {-1871.70, 1176.40, -4.50, -1620.30, 1274.20, 200.00}},
		{!"Downtown",                     {-1700.00, 744.20, -6.10, -1580.00, 1176.50, 200.00}},
		{!"Downtown",                     {-1580.00, 744.20, -6.10, -1499.80, 1025.90, 200.00}},
		{!"Downtown",                     {-2078.60, 578.30, -7.60, -1499.80, 744.20, 200.00}},
		{!"Downtown",                     {-1993.20, 265.20, -9.10, -1794.90, 578.30, 200.00}},
		{!"Downtown Los Santos",          {1463.90, -1430.80, -89.00, 1724.70, -1290.80, 110.90}},
		{!"Downtown Los Santos",          {1724.70, -1430.80, -89.00, 1812.60, -1250.90, 110.90}},
		{!"Downtown Los Santos",          {1463.90, -1290.80, -89.00, 1724.70, -1150.80, 110.90}},
		{!"Downtown Los Santos",          {1370.80, -1384.90, -89.00, 1463.90, -1170.80, 110.90}},
		{!"Downtown Los Santos",          {1724.70, -1250.90, -89.00, 1812.60, -1150.80, 110.90}},
		{!"Downtown Los Santos",          {1370.80, -1170.80, -89.00, 1463.90, -1130.80, 110.90}},
		{!"Downtown Los Santos",          {1378.30, -1130.80, -89.00, 1463.90, -1026.30, 110.90}},
		{!"Downtown Los Santos",          {1391.00, -1026.30, -89.00, 1463.90, -926.90, 110.90}},
		{!"Downtown Los Santos",          {1507.50, -1385.20, 110.90, 1582.50, -1325.30, 335.90}},
		{!"East Beach",                   {2632.80, -1852.80, -89.00, 2959.30, -1668.10, 110.90}},
		{!"East Beach",                   {2632.80, -1668.10, -89.00, 2747.70, -1393.40, 110.90}},
		{!"East Beach",                   {2747.70, -1668.10, -89.00, 2959.30, -1498.60, 110.90}},
		{!"East Beach",                   {2747.70, -1498.60, -89.00, 2959.30, -1120.00, 110.90}},
		{!"East Los Santos",              {2421.00, -1628.50, -89.00, 2632.80, -1454.30, 110.90}},
		{!"East Los Santos",              {2222.50, -1628.50, -89.00, 2421.00, -1494.00, 110.90}},
		{!"East Los Santos",              {2266.20, -1494.00, -89.00, 2381.60, -1372.00, 110.90}},
		{!"East Los Santos",              {2381.60, -1494.00, -89.00, 2421.00, -1454.30, 110.90}},
		{!"East Los Santos",              {2281.40, -1372.00, -89.00, 2381.60, -1135.00, 110.90}},
		{!"East Los Santos",              {2381.60, -1454.30, -89.00, 2462.10, -1135.00, 110.90}},
		{!"East Los Santos",              {2462.10, -1454.30, -89.00, 2581.70, -1135.00, 110.90}},
		{!"Easter Basin",                 {-1794.90, 249.90, -9.10, -1242.90, 578.30, 200.00}},
		{!"Easter Basin",                 {-1794.90, -50.00, -0.00, -1499.80, 249.90, 200.00}},
		{!"Easter Bay Airport",           {-1499.80, -50.00, -0.00, -1242.90, 249.90, 200.00}},
		{!"Easter Bay Airport",           {-1794.90, -730.10, -3.00, -1213.90, -50.00, 200.00}},
		{!"Easter Bay Airport",           {-1213.90, -730.10, 0.00, -1132.80, -50.00, 200.00}},
		{!"Easter Bay Airport",           {-1242.90, -50.00, 0.00, -1213.90, 578.30, 200.00}},
		{!"Easter Bay Airport",           {-1213.90, -50.00, -4.50, -947.90, 578.30, 200.00}},
		{!"Easter Bay Airport",           {-1315.40, -405.30, 15.40, -1264.40, -209.50, 25.40}},
		{!"Easter Bay Airport",           {-1354.30, -287.30, 15.40, -1315.40, -209.50, 25.40}},
		{!"Easter Bay Airport",           {-1490.30, -209.50, 15.40, -1264.40, -148.30, 25.40}},
		{!"Easter Bay Chemicals",         {-1132.80, -768.00, 0.00, -956.40, -578.10, 200.00}},
		{!"Easter Bay Chemicals",         {-1132.80, -787.30, 0.00, -956.40, -768.00, 200.00}},
		{!"El Castillo del Diablo",       {-464.50, 2217.60, 0.00, -208.50, 2580.30, 200.00}},
		{!"El Castillo del Diablo",       {-208.50, 2123.00, -7.60, 114.00, 2337.10, 200.00}},
		{!"El Castillo del Diablo",       {-208.50, 2337.10, 0.00, 8.40, 2487.10, 200.00}},

bla bla bla bla



Re: textdraw bugged - Igarashi - 22.07.2015

Yeah because u are using textdraw only for Los Santos City Hall

Код:
PlayerData[playerid][pTextdraws][85] = CreatePlayerTextDraw(playerid, 87.598846, 320.083374, "Los Santos City Hall");



Re: textdraw bugged - Antoniohl - 22.07.2015

No? Los Santos City hall is just hidden, that's why i made it will update it..
Quote:

format(str, sizeof(str), "%s", GetPlayerLocation(i), '%');
PlayerTextDrawSetString(1, PlayerData[i][pTextdraws][85], str);?




Re: textdraw bugged - Antoniohl - 22.07.2015

Ah..?Bump


Re: textdraw bugged - xVIP3Rx - 22.07.2015

I don't understand this part, can you explain it to me ?

Quote:
Originally Posted by Antoniohl
Посмотреть сообщение
pawn Код:
if ((id = House_Inside(playerid)) != -1)
does it mean if id = house_inside and doesn't equal -1 ? or it equals id to house_inside then check ?

also since you didn't post the rest of "GetPos", Let's try two things
pawn Код:
stock GetPlayerLocation(playerid)
{
    new
        Float:fX,
        Float:fY,
        Float:fZ,
        string[32],
        id = -1;

    if ((id = House_Inside(playerid)) != -1)
    {
        fX = HouseData[id][housePos][0];
        fY = HouseData[id][housePos][1];
        fZ = HouseData[id][housePos][2];
    }
    else if ((id = Business_Inside(playerid)) != -1)
    {
        fX = BusinessData[id][bizPos][0];
        fY = BusinessData[id][bizPos][1];
        fZ = BusinessData[id][bizPos][2];
    }
    else if ((id = Entrance_Inside(playerid)) != -1)
    {
        fX = EntranceData[id][entrancePos][0];
        fY = EntranceData[id][entrancePos][1];
        fZ = EntranceData[id][entrancePos][2];
    }
    else GetPlayerPos(playerid, fX, fY, fZ);

    format(string, 32, GetLocation(fX, fY, fZ));
        SendClientMessage(playerid, -1, string");//Just to make sure it's correct
    return string;
}
and
pawn Код:
format(str, sizeof(str), "%s", random(10), '%');//Just to make sure the textdraw updates with no problems
PlayerTextDrawSetString(1, PlayerData[i][pTextdraws][85], str);



Re: textdraw bugged - Antoniohl - 22.07.2015

Lol i'm so fucking dumb, there was no problem it's just with PlayerTextDrawSetString(1 Have a look here, it's 1 it should be i stand for player -__- ahhaaha okay thank for replying...

happy eid sa3ed


Re: textdraw bugged - xVIP3Rx - 22.07.2015

That's why you should always debug to figure out those mistakes.

Happy eid.