Jump to content

setElementData problem


-Doc-

Recommended Posts

Hey i've made this script and i want to set element data to receiver and the sender and after 7 seconds remove data. Here's the code.

function privateMessage(thePlayer,commandName,sendToName,...) 
  
if isPlayerMuted(thePlayer) then return outputChatBox("• You're muted",thePlayer,255,0,0) end 
    local pmWords = { ... } 
    local pmMessage = table.concat( pmWords, " " ):gsub("#%x%x%x%x%x%x","") 
    if sendToName then 
        if (getPlayerFromParticalName (sendToName)) then 
            local toPlayer = (getPlayerFromParticalName (sendToName)) 
            local toPlayerTeam = getPlayerNametagColor(toPlayer) 
            if toPlayerTeam then 
                local toRed, toGreen, toBlue = getPlayerNametagColor(toPlayer) 
                local red, green, blue = getPlayerNametagColor ( thePlayer ) 
                toColor = RGBToHex ( toRed, toGreen, toBlue ) 
            else 
                toColor = '#ffffff' 
            end 
  
            local fromPlayerTeam = getPlayerNametagColor(thePlayer) 
            if fromPlayerTeam then 
                local fromRed, fromGreen, fromBlue = getPlayerNametagColor(thePlayer) 
                fromColor = RGBToHex ( fromRed, fromGreen, fromBlue ) 
            else 
                fromColor = '#ffffff' 
            end 
            if not (toPlayer == thePlayer) then 
                if not (pmMessage == "") then 
                    outputChatBox("#0ECBF1(Whisper) to ".. toColor .. getPlayerName(toPlayer) .. ":#FFFFFF " .. pmMessage, thePlayer, 255, 255, 255, true) 
                    outputChatBox("#0ECBF1(Whisper) from " .. fromColor .. getPlayerName(thePlayer) .. ":#FFFFFF " .. pmMessage, toPlayer, 255, 255, 255, true) 
                    exports["chatbubbles"]:displayChatBubble( pmMessage,4,thePlayer ) 
                    setElementData(thePlayer,"sender",true) 
                    setElementData(toPlayer,"receiver",true) 
                                        pm_lol() 
                    triggerClientEvent (toPlayer,  "pm", toPlayer ) 
            outputServerLog("(WHISPER) From "..getPlayerName(thePlayer).." To ".. getPlayerName(toPlayer)..": " .. pmMessage) 
            
                else 
                    outputChatBox("#ff0000• Syntax: /w [partial player name] [message]", thePlayer, 255, 255, 255, true) 
                    return false 
                end 
            else 
                outputChatBox("#ff0000• You cannot whisper to yourself.", thePlayer, 255, 255, 255, true) 
                return false 
            end 
        else 
            outputChatBox("#ff0000• Player not found. #FF0000(#FFFFFF"..sendToName.."#FF0000)", thePlayer, 255, 255, 255, true) 
            return false 
        end 
    else 
        outputChatBox("#ff0000• Syntax: /w [partial player name] [message]", thePlayer, 255, 255, 255, true) 
        return false 
    end 
    -- Check if is player muted! 
    if isPlayerMuted(thePlayer) then 
        outputChatBox("• You are muted!", thePlayer, 255, 0, 0, true) 
        return true  
    end 
end 
addCommandHandler("pm", privateMessage) 
addCommandHandler("w", privateMessage) 
  
function pm_lol (  ) 
        
        setTimer(setElementData,7000,1,source,'receiver',false) 
       setTimer(setElementData,7000,1,source,'sender',false) 
    end 

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...