Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- addEventHandler( "onClientFrameRender",
- function (post) {
- if (post) {
- // Text to display
- local label_text = "Hello world! I'm a neat little label :)";
- // Where in the world to display this text
- local label_pos = [733.508911, 884.242554, -11.00];
- // Set the font
- local font = "arial";
- // Set the text size
- local scale = 1.0;
- /**
- * What color it should be
- *Color layout, might not be 100% right, if I remember correctly the Red Green and Blue color orders might be in wrong order
- *0xFF << First two codes set the alpha channel
- *0xFF 33 << Set the red color
- *0xFF33 FF << Set the green color
- *0xFF33FF 99 << And finally set the blue color
- */
- local color = 0xFF33FF99;
- // Get the screen position of a point from the game world
- local screen = getScreenFromWorld(label_pos[0],label_pos[1],label_pos[2]);
- // The the player position
- local position = getPlayerPosition(getLocalPlayer());
- // Get the distance between the player and the label position
- local render_distance = getDistanceBetweenPoints3D(label_pos[0],label_pos[1],label_pos[2], position[0], position[1], position[2]);
- // How near does the player have to be before label is displayed
- if (render_distance <= 15.0) {
- // If the label is infront of the player (if I remember correctly)
- if (screen[2] < 1.0) {
- // Draw the text label, parameters: string text, float x, float y, int color, bool shadow, string font [, float scale = 1.0]
- dxDrawText(label_text, screen[0], screen[1], color, true, font, scale);
- }
- }
- }
- }
- );
Advertisement
Add Comment
Please, Sign In to add comment