SA-MP Forums Archive
[3D Text Labels] How make the code smaller???????????? - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [3D Text Labels] How make the code smaller???????????? (/showthread.php?tid=246928)



[3D Text Labels] How make the code smaller???????????? - vakhtang - 06.04.2011

So I wanna get this smaller. Any Ideas?
pawn Код:
#include <a_samp>

public OnPlayerConnect(playerid)
{
    //SF:
    //--------------------------------------------------------------------------
    //Hotel_N1:
    CreatePlayer3DTextLabel(playerid,"Door:\nClick Alt To Enter/Exit",0x008080FF,2265.4721679688,1647.5310058594,1084.234375,10.0);

    CreatePlayer3DTextLabel(playerid,"Door:\nClick Alt To Enter/Exit",0x008080FF,-2423.5212402344,343.27597045898,36.997596740723,10.0);
    CreatePlayer3DTextLabel(playerid,"Door:\nClick Alt To Enter/Exit",0x008080FF,-2429.4436035156,332.94711303711,36.997116088867,10.0);
    CreatePlayer3DTextLabel(playerid,"Door:\nClick Alt To Enter/Exit",0x008080FF,-2426.5302734375,338.21185302734,36.998634338379,10.0);

    CreatePlayer3DTextLabel(playerid,"Door:\nClick Alt To Enter/Exit",0x008080FF,2265.6059570313,1662.5732421875,1084.234375,10.0);
    CreatePlayer3DTextLabel(playerid,"Door:\nClick Alt To Enter/Exit",0x008080FF,2271.7614746094,1662.5856933594,1084.234375,10.0);
    CreatePlayer3DTextLabel(playerid,"Door:\nClick Alt To Enter/Exit",0x008080FF,2271.7614746094,1652.5855712891,1084.234375,10.0);
    CreatePlayer3DTextLabel(playerid,"Door:\nClick Alt To Enter/Exit",0x008080FF,2265.7097167969,1652.5864257813,1084.234375,10.0);
    CreatePlayer3DTextLabel(playerid,"Door:\nClick Alt To Enter/Exit",0x008080FF,2271.7614746094,1642.1823730469,1084.234375,10.0);
    CreatePlayer3DTextLabel(playerid,"Door:\nClick Alt To Enter/Exit",0x008080FF,2265.697265625,1642.1745605469,1084.234375,10.0);
    CreatePlayer3DTextLabel(playerid,"Door:\nClick Alt To Enter/Exit",0x008080FF,2265.6848144531,1633.4891357422,1084.234375,10.0);
    CreatePlayer3DTextLabel(playerid,"Door:\nClick Alt To Enter/Exit",0x008080FF,2271.7614746094,1633.5145263672,1084.234375,10.0);
   
    CreatePlayer3DTextLabel(playerid,"Door:\nClick Alt To Enter/Exit",0x008080FF,2264.6059570313,1662.5732421875,1084.234375,10.0);
    CreatePlayer3DTextLabel(playerid,"Door:\nClick Alt To Enter/Exit",0x008080FF,2272.7614746094,1662.5856933594,1084.234375,10.0);
    CreatePlayer3DTextLabel(playerid,"Door:\nClick Alt To Enter/Exit",0x008080FF,2272.7614746094,1652.5855712891,1084.234375,10.0);
    CreatePlayer3DTextLabel(playerid,"Door:\nClick Alt To Enter/Exit",0x008080FF,2264.7097167969,1652.5864257813,1084.234375,10.0);
    CreatePlayer3DTextLabel(playerid,"Door:\nClick Alt To Enter/Exit",0x008080FF,2272.7614746094,1642.1823730469,1084.234375,10.0);
    CreatePlayer3DTextLabel(playerid,"Door:\nClick Alt To Enter/Exit",0x008080FF,2264.697265625,1642.1745605469,1084.234375,10.0);
    CreatePlayer3DTextLabel(playerid,"Door:\nClick Alt To Enter/Exit",0x008080FF,2264.6848144531,1633.4891357422,1084.234375,10.0);
    CreatePlayer3DTextLabel(playerid,"Door:\nClick Alt To Enter/Exit",0x008080FF,2272.7614746094,1633.5145263672,1084.234375,10.0);

    //--------------------------------------------------------------------------/1
    return 1;
}



Re: [3D Text Labels] How make the code smaller???????????? - Elka_Blazer - 06.04.2011

what do you mean smaller


Re: [3D Text Labels] How make the code smaller???????????? - Mauzen - 06.04.2011

Put all the coordinates into an array and loop through it:

pawn Код:
// At the top of your script if you can need it more than once
new Float:textcoords[][3] =
{
    {2265.4721679688, 1647.5310058594, 1084.234375},
    { ... },
    ...
}

// In the callback
for(new i = 0; i < sizeof(textcoords); i ++)
    CreatePlayer3DTextLabel(playerid,"Door:\nClick Alt To Enter/Exit",0x008080FF,textcoords[i][0],textcoords[i][1],textcoords[i][2],10.0);
Total lines will be the same, but it makes your code look cleaner.


Re: [3D Text Labels] How make the code smaller???????????? - vakhtang - 07.04.2011

Thanks


Re: [3D Text Labels] How make the code smaller???????????? - Macluawn - 07.04.2011

Note that amx size won't be smaller, and it wont affect compiling speed.