Dazee Posted July 2, 2014 Share Posted July 2, 2014 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
Et-win Posted July 2, 2014 Share Posted July 2, 2014 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
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