I’m trying to make a fivem NUI that displays a little points score at the top of the…
- User
I’m trying to make a fivem NUI that displays a little points score at the top of the screen https://cdn.discordapp.com/attachments/1052780891300184096/1095659338003128380/image.png
do you think i’m best to use react or just html css
- Assistant
For a simple points score display at the top of the screen, you can use basic HTML and CSS. There's no need to use a more complex framework like React for this as it doesn't require any advanced interactivity or dynamic content. However, if you plan on expanding the project in the future and incorporating more complex features, using React might be a good idea to keep the codebase structured and maintainable.
- User
https://cdn.discordapp.com/attachments/1052780891300184096/1095659338003128380/image.png
could you give an example of how the code would look for a scoreboard identical to the image I posted
- Assistant
Here's an example of HTML and CSS code to create a scoreboard similar to the image you posted:
HTML:
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link rel="stylesheet" href="styles.css"> <title>Scoreboard</title> </head> <body> <div class="scoreboard"> <div class="points"> <span class="label">Points: </span> <span class="score">1010</span> </div> </div> </body> </html>styles.css:
body { margin: 0; background-color: #111; } .scoreboard { position: fixed; top: 0; right: 0; background-color: rgba(0, 0, 0, 0.5); padding: 5px 15px; margin: 10px; border-radius: 5px; display: inline-flex; align-items: center; } .label { color: #ffffff; font-family: Arial, sans-serif; font-size: 14px; } .score { color: #32CD32; font-family: Arial, sans-serif; font-size: 14px; font-weight: bold; margin-left: 5px; } - User
what would the javascript and lua look like it needs to take a score value from the lua and update the NUI
- Assistant