Tokio Posted April 3, 2018 Posted April 3, 2018 I want create a script, which creates a 3d text with a cmd. For example, when i type "/word asd" then this make a 3d text the player position "#playername : asd", then after elapse 3 hours, the text will hide. How to make this? My servers: Fun: Derby(DD):
Enargy, Posted April 3, 2018 Posted April 3, 2018 You cand find something on DxDrawTextOnElement and use getTickCount or setTimer to hide it. - Inactivo.
Tokio Posted April 3, 2018 Author Posted April 3, 2018 23 minutes ago, Enargy, said: You cand find something on DxDrawTextOnElement and use getTickCount or setTimer to hide it. But the DxDrawTextOnElement attach the text to a object/ped My servers: Fun: Derby(DD):
Moderators Patrick Posted April 3, 2018 Moderators Posted April 3, 2018 (edited) I uploaded script here for you: https://community.multitheftauto.com/index.php?p=resources&s=details&id=15344 Edited April 3, 2018 by Patrick2562 1 community profile | map converters | map images | pDownloader | pAttach | model encrypter
Tokio Posted April 3, 2018 Author Posted April 3, 2018 7 minutes ago, Patrick2562 said: -- CLIENT local textsFromServer = {} -- SETTINGS local showRadius = 10 -- 10 meters addEventHandler("onClientRender", getRootElement(), function() for id, v in pairs(textsFromServer) do local x,y,z = getElementPosition(localPlayer) if getDistanceBetweenPoints3D(v[3],v[4],v[5], x,y,z) <= showRadius then local sx, sy = getScreenFromWorldPosition(v[3],v[4],v[5]) if sx and sy then dxDrawText(v[1]..": "..v[2], sx+1, sy+1, sx+1, sy+1, tocolor(0,0,0,120), 1.5, "default-bold", "center", "center", false, false, false, true) dxDrawText(v[1]..": "..v[2], sx, sy, sx, sy, tocolor(255,255,255,180), 1.5, "default-bold", "center", "center", false, false, false, true) end end end end) addEvent("sendTableToClients", true) addEventHandler("sendTableToClients", getRootElement(), function(tableFromServer) textsFromServer = tableFromServer end) triggerServerEvent("getTextsOnJoin", localPlayer) -- SERVER local texts = {} local currentID = 1 -- SETTINGS local destroyTimer = 180 -- destroy after 180 mins addCommandHandler("3dtext", function(player, cmd, ...) local text = table.concat({...}, " ") if text and #text > 0 then local playername = getPlayerName(player):gsub("#%x%x%x%x%x%x", "") local x,y,z = getElementPosition(player) texts[currentID] = {playername, text, x,y,z} -- save datas setTimer(function(id) texts[id] = nil sendTableToClients() end, 1000*60*destroyTimer, 1, currentID) -- delete after 3 hours currentID = currentID + 1 -- leave alone sendTableToClients() else outputChatBox("USE: /"..cmd.." text", player) end end) function sendTableToClients() triggerClientEvent(getRootElement(), "sendTableToClients", getRootElement(), texts) end addEvent("getTextsOnJoin", true) addEventHandler("getTextsOnJoin", getRootElement(), function() triggerClientEvent(source, "sendTableToClients", source, texts) end) Thank you:D My servers: Fun: Derby(DD):
Moderators Patrick Posted April 3, 2018 Moderators Posted April 3, 2018 You are welcome! 1 community profile | map converters | map images | pDownloader | pAttach | model encrypter
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now