Jump to content

Problem with dxDrawText


Dazee

Recommended Posts

Hi all im a new scripter and i have been having problems with a script for trouble in terrorist town i've got it to get a random player now i need it to draw traitor text to that random player how am i going to do that ( im scripting like 3,4 days ) here is what i tried and does not work

function sendTraitor() 
    local gRandomPlayer = getRandomPlayer() 
    local traitor = outputChatBox("You are the traitor, "..getPlayerName(gRandomPlayer).."!", gRandomPlayer, 255, 255, 255, true) 
    local gPlayers = getElementsByType("player") 
    for placeNumber, playerData in ipairs(gPlayers) do 
        if (playerData ~= gRandomPlayer) then 
            outputChatBox("You are innocent! "..getPlayerName(gRandomPlayer).." is the traitor!", playerData, 255, 255, 255, true) 
function drawTraitor() 
    if traitor then dxDrawText("TRAITOR", 1399, 929, 1796, 1024, tocolor(255, 255, 255, 255), 3.00, "pricedown", "left", "top", false, false, true, false, false)          
    end 
function handleTheRendering  
    addEventHandler ( "onClientRender", root, drawTraitor )   
        end 
    end 
  end 
end 
addCommandHandler( "ttt", sendTraitor ) 
addCommandHandler( "ttt", resourceRoot, handleTheRendering ) 

Link to comment

getRandomPlayer it a serverside function and dxDrawText is a clientside function.

I thought your friend was already asking about this here.

Anyway, I told your friend to use triggerClientEvent to trigger to the client's for dxDrawText.

Example:

--Server 
function lol(thePlayer, theCommand, word) 
    local gRandomPlayer = getRandomPlayer() 
    triggerClientEvent(gRandomPlayer, "sendText", getRootElement(), word) 
end 
  
addCommandHandler("ttt", lol) 
  
--Client 
function output(word) 
    outputChatBox(text, 255, 255, 255, true) 
end 
  
addEvent("sendText", true) 
addEventHandler("sendText", getRootElement(), output) 

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...