//_Dragon Posted December 20, 2015 Share Posted December 20, 2015 (edited) Code Has Removed By Me Edited December 22, 2015 by Guest Link to comment
Addlibs Posted December 20, 2015 Share Posted December 20, 2015 Line 4-5 — You're just collecting the Hex of the sender, never the recipient's Line 17 — May I know what that is for? Line 28 — How do you even want to use hex on the name of a player who doesn't exist when a non-existent player doesn't have name colour. Here's the corrected code: function privateMessage(thePlayer,commandName,sendToName,...) local pmWords = { ... } local pmMessage = table.concat( pmWords, " " ) local r, g, b = getPlayerNametagColor(thePlayer) local fromHex = string.format("#%.2X%.2X%.2X", r, g, b) -- converts R, G, B to HEX value if sendToName then if (getPlayerFromParticalName (sendToName)) then toPlayer = (getPlayerFromParticalName (sendToName)) local tr, tg, tb = getPlayerNametagColor(thePlayer) local toHex = string.format("#%.2X%.2X%.2X", tr, tg, tb) -- converts R, G, B to HEX value if not (toPlayer == thePlayer) then if not (pmMessage == "") then outputChatBox("(WHISPER) To " ..toHex.. getPlayerName(toPlayer) .. ":#FFFFFF " .. pmMessage, thePlayer, 255, 0, 90, true) outputChatBox("(WHISPER) From " ..fromHex.. getPlayerName(thePlayer) .. ":#FFFFFF " .. pmMessage, toPlayer, 255, 0, 90, true) setElementData(thePlayer,"pmPartner",toPlayer) triggerClientEvent(toPlayer,"onBeep",getRootElement ()) setElementData(toPlayer,"pmPartner",thePlayer) outputServerLog("(WHISPER) From " ..fromHex.. getPlayerName(thePlayer) .. ":#FFFFFF " .. pmMessage, toPlayer, 255, 0, 90, true) -- outputServerLog("(WHISPER) From " ..fromHex.. getPlayerName(thePlayer) .. " To " ..toHex.. getPlayerName(toPlayer) .. ":#FFFFFF " .. pmMessage, thePlayer, 255, 0, 90, true) -- what even is this? else outputChatBox("#E8037E(WHISPER)#FFFFFF Invalid syntax! Usage:#FFFFFF /w [player name] [message]", thePlayer, 255, 255, 255, true) return false end else outputChatBox("#E8037E(WHISPER)#FFFFFF You cannot whisper yourself", thePlayer, 255, 255, 255, true) return false end else outputChatBox("(WHISPER) Player not found "..sendToName, thePlayer, 255, 0, 90, true) return false end else outputChatBox("#E8037E(WHISPER)#FFFFFF Invalid syntax! Usage:#FFFFFF /w [player name] [message]", thePlayer, 255, 255, 255, true) return false end end addCommandHandler("w", privateMessage) function getPlayerFromParticalName(thePlayerName) local thePlayer = getPlayerFromName(thePlayerName) if thePlayer then return thePlayer end for _,thePlayer in ipairs(getElementsByType("player")) do if string.find(string.gsub(getPlayerName(thePlayer):lower(),"#%x%x%x%x%x%x", ""), thePlayerName:lower(), 1, true) then return thePlayer end end return false end Link to comment
//_Dragon Posted December 20, 2015 Author Share Posted December 20, 2015 Come to my server for test the mod because i need some one to send to him message I send u IP in PM Link to comment
//_Dragon Posted December 20, 2015 Author Share Posted December 20, 2015 What about this line ? u forget it i think l28 outputChatBox("(WHISPER) Player not found "..hex..sendToName.."", thePlayer, 255, 0, 90, true) Link to comment
//_Dragon Posted December 20, 2015 Author Share Posted December 20, 2015 A little problem When i send to player message my nametagcolor is added to his nametag i want his nametagcolor dont changed my nametagcolor when i send to him message check the pic for see the problem http://imgur.com/F5hQBzu Link to comment
Addlibs Posted December 21, 2015 Share Posted December 21, 2015 function privateMessage(thePlayer,commandName,sendToName,...) local pmWords = { ... } local pmMessage = table.concat( pmWords, " " ) local r, g, b = getPlayerNametagColor(thePlayer) local fromHex = string.format("#%.2X%.2X%.2X", r, g, b) -- converts R, G, B to HEX value if sendToName then if (getPlayerFromParticalName (sendToName)) then toPlayer = (getPlayerFromParticalName (sendToName)) local tr, tg, tb = getPlayerNametagColor(toPlayer) local toHex = string.format("#%.2X%.2X%.2X", tr, tg, tb) -- converts R, G, B to HEX value if not (toPlayer == thePlayer) then if not (pmMessage == "") then outputChatBox("(WHISPER) To " ..toHex.. getPlayerName(toPlayer) .. ":#FFFFFF " .. pmMessage, thePlayer, 255, 0, 90, true) outputChatBox("(WHISPER) From " ..fromHex.. getPlayerName(thePlayer) .. ":#FFFFFF " .. pmMessage, toPlayer, 255, 0, 90, true) setElementData(thePlayer,"pmPartner",toPlayer) triggerClientEvent(toPlayer,"onBeep",getRootElement ()) setElementData(toPlayer,"pmPartner",thePlayer) outputServerLog("(WHISPER) From " ..fromHex.. getPlayerName(thePlayer) .. ":#FFFFFF " .. pmMessage, toPlayer, 255, 0, 90, true) -- outputServerLog("(WHISPER) From " ..fromHex.. getPlayerName(thePlayer) .. " To " ..toHex.. getPlayerName(toPlayer) .. ":#FFFFFF " .. pmMessage, thePlayer, 255, 0, 90, true) -- what even is this? else outputChatBox("#E8037E(WHISPER)#FFFFFF Invalid syntax! Usage:#FFFFFF /w [player name] [message]", thePlayer, 255, 255, 255, true) return false end else outputChatBox("#E8037E(WHISPER)#FFFFFF You cannot whisper yourself", thePlayer, 255, 255, 255, true) return false end else outputChatBox("(WHISPER) Player not found "..sendToName, thePlayer, 255, 0, 90, true) return false end else outputChatBox("#E8037E(WHISPER)#FFFFFF Invalid syntax! Usage:#FFFFFF /w [player name] [message]", thePlayer, 255, 255, 255, true) return false end end addCommandHandler("w", privateMessage) function getPlayerFromParticalName(thePlayerName) local thePlayer = getPlayerFromName(thePlayerName) if thePlayer then return thePlayer end for _,thePlayer in ipairs(getElementsByType("player")) do if string.find(string.gsub(getPlayerName(thePlayer):lower(),"#%x%x%x%x%x%x", ""), thePlayerName:lower(), 1, true) then return thePlayer end end return false end Link to comment
-Doc- Posted December 22, 2015 Share Posted December 22, 2015 Is something wrong with this guy? I thing yes! http://imgur.com/C6USU94 Copying my scripts. My sentences. Nothing original Fk off Link to comment
Captain Cody Posted December 22, 2015 Share Posted December 22, 2015 Is something wrong with this guy? I thing yes! http://imgur.com/C6USU94 Copying my scripts. My sentences. Nothing original Fk off *Grabs popcorn 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