SA-MP Forums Archive
[Tutorial] Creating a simple 3DText - 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: Tutorials (https://sampforum.blast.hk/forumdisplay.php?fid=70)
+---- Thread: [Tutorial] Creating a simple 3DText (/showthread.php?tid=377432)



Creating a simple 3DText - yLuSsSIoN - 14.09.2012

Function is:
pawn Code:
Create3DTextLabel (text [], color, Float: X, Float: Y, Float: Z, Float: DrawDistance, virtualworld, testLOS)
text [] - You type text that you want ...;
color - text color;
Float: X - X coordinate;
Float: Y - Y coordinate;
Float: Z - coordinate Z;
Float: DrawDistance - Distance from where you can see the 3D text;
virtualworld - virtual world that appear 3D text (-1 to appear in all virtual worlds);
testLOS - This tests the line of sight so as not to see through objects (use 0 or 1).

EXAMPLE
Create3DTextLabel ("Example", 0xFFFFFFFF, 372.6514, 2474.6919, 16.4844, 50, 0);

TIP 1: If you want to pick up this text to add a + Z coordinate followed by the desired height.
TIP 2: If you want to add a newline character this text use \ n.


Re: Creating a simple 3DText - Sniper Kitty - 14.09.2012

Very general, but

You do not need to add the function under the OnGameModeInit() callback


Re: Creating a simple 3DText - yLuSsSIoN - 14.09.2012

Uh.. sry .. my mistake theen


Re: Creating a simple 3DText - Sniper Kitty - 14.09.2012

I made this real quick for example purposes.

pawn Code:
new Text3D: TextID[MAX_PLAYERS];
   
public OnPlayerConnect(playerid) {
    new Float: X,
        Float: Y,
        Float: Z;
       
    GetPlayerPos(playerid, X, Y, Z);
    TextID[playerid] = Create3DTextLabel("X: 0000.000000\nY: 0000.000000\nZ: 0000.000000\nA: 0000.000000", 0x008080FF, X, Y, Z);
    return true;
}
   
public OnPlayerDisconnect(playerid, reason) {
    Delete3DTextLabel(TextID[playerid]);
    return true;
}
   
public OnPlayerUpdate(playerid) {
    new Float: X,
        Float: Y,
        Float: Z,
        Float: A,
        String[100];
       
    GetPlayerPos(playerid, X, Y, Z);
    GetPlayerFacingAngle(playerid, A);
    format(String, 100, "X: %f\nY: %f\nZ: %f\nA: %f", X, Y, Z, A);
    Update3DTextLabelText(TextID[playerid], 0x008080FF, String);
    Attach3DTextLabelToPlayer(TextID[playerid], playerid, 0.0, 0.0, 1.0);
    return true;
}
It simply follows the player around, wherever the player goes, and other players can see their position.


Re: Creating a simple 3DText - Max_Coldheart - 14.09.2012

I don't see this as a tutorial. You're just providing them one function and info how to use the parameters. To me atleast, tutorial would be longer and use more functions and give examples.


Re: Creating a simple 3DText - MarTaTa - 14.09.2012

Looks like copy / paste from SAMP Wiki(found it the same there), if you gonna copy, atleast copy and examples


Re: Creating a simple 3DText - yLuSsSIoN - 14.09.2012

Quote:
Originally Posted by MarTaTa
View Post
Looks like copy / paste from SAMP Wiki(found it the same there), if you gonna copy, atleast copy and examples
No i didn't copy from sa-mp wiki .. maybe i dont know scripting too much , but not so dump to copy from wiki


Re: Creating a simple 3DText - kaisersouse - 14.09.2012

Quote:

maybe i dont know scripting too much

Typically people who make tutorials know more about scripting than the people reading them...