-.Paradox.- Posted July 24, 2013 Posted July 24, 2013 Hello all, i have this pm system and i want use getPlayerNametagColor here is the code: function privateMessage(thePlayer,commandName,sendToName,...) local pmWords = { ... } local pmMessage = table.concat( pmWords, " " ) if sendToName then if (getPlayerFromParticalName (sendToName)) then toPlayer = (getPlayerFromParticalName (sendToName)) if not (toPlayer == thePlayer) then if not (pmMessage == "") then outputChatBox("#0096ff[PM] to #ff0000" .. getPlayerName(toPlayer) .. ":#FFFFFF " .. pmMessage, thePlayer, 255, 255, 255, true) outputChatBox("#0096ff[PM] from #ff0000" .. getPlayerName(thePlayer) .. ":#FFFFFF " .. pmMessage, toPlayer, 255, 255, 255, true) else outputChatBox("#0044FF[PM]#FFFFFF Invalid syntax! Usage:#FFFFFF /pm [player name] [message]", thePlayer, 255, 255, 255, true) return false end else outputChatBox("#0044FF[PM]#FFFFFF You cannot PM yourself#FFFFFF!", thePlayer, 255, 255, 255, true) return false end else outputChatBox("#0044FF[PM]#FFFFFF Player not found! #FFFF00(#FFFFFF"..sendToName.."#FFFF00)", thePlayer, 255, 255, 255, true) return false end else outputChatBox("#0044FF[PM]#FFFFFF Invalid syntax! Usage:#FFFFFF /pm [partical player name] [message]", thePlayer, 255, 255, 255, true) return false end end addCommandHandler("pm", 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 that's the backup, i hope somebody help me. If you're looking for a cheap paid scripter, don't hesitate to contact me. Great minds discuss ideas, Average minds discuss events and small minds discuss people.
Castillo Posted July 24, 2013 Posted July 24, 2013 What do you want to add? San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
-.Paradox.- Posted July 25, 2013 Author Posted July 25, 2013 getPlayerNametagColor I tried it but when i pm some one its how like that, [PM] to 0: or [PM] to nil If you're looking for a cheap paid scripter, don't hesitate to contact me. Great minds discuss ideas, Average minds discuss events and small minds discuss people.
codeluaeveryday Posted July 25, 2013 Posted July 25, 2013 Sorry this took so long, I am at school and I don't have much free time to do this: function privateMessage(thePlayer,commandName,sendToName,...) local pmWords = { ... } local pmMessage = table.concat( pmWords, " " ) if sendToName then if (getPlayerFromParticalName (sendToName)) then local toPlayer = (getPlayerFromParticalName (sendToName)) local toPlayerTeam = getPlayerTeam(toPlayer) if toPlayerTeam then local toRed, toGreen, toBlue = getTeamColor(toPlayerTeam) toColor = string.format("#%02X%02X%02X", toRed, toGreen, toBlue) else toColor = '#ffffff' end local fromPlayerTeam = getPlayerTeam(thePlayer) if fromPlayerTeam then local fromRed, fromGreen, fromBlue = getTeamColor(fromPlayerTeam) fromColor = string.format("#%02X%02X%02X", fromRed, fromGreen, fromBlue) else fromColor = '#ffffff' end if not (toPlayer == thePlayer) then if not (pmMessage == "") then outputChatBox("#0096ff[PM] to ".. toColor .. getPlayerName(toPlayer) .. ":#FFFFFF " .. pmMessage, thePlayer, 255, 255, 255, true) outputChatBox("#0096ff[PM] from " .. fromColor .. getPlayerName(thePlayer) .. ":#FFFFFF " .. pmMessage, toPlayer, 255, 255, 255, true) else outputChatBox("#0044FF[PM]#FFFFFF Invalid syntax! Usage:#FFFFFF /pm [player name] [message]", thePlayer, 255, 255, 255, true) return false end else outputChatBox("#0044FF[PM]#FFFFFF You cannot PM yourself#FFFFFF!", thePlayer, 255, 255, 255, true) return false end else outputChatBox("#0044FF[PM]#FFFFFF Player not found! #FFFF00(#FFFFFF"..sendToName.."#FFFF00)", thePlayer, 255, 255, 255, true) return false end else outputChatBox("#0044FF[PM]#FFFFFF Invalid syntax! Usage:#FFFFFF /pm [partical player name] [message]", thePlayer, 255, 255, 255, true) return false end end addCommandHandler("pm", 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 Tutorials: => getOnlineAdmins() => [TUT] Better Join Country => [TUT] Updating admin countries => [TUT] Updating admin flags Server: K@N Zombies / Freeroam
-.Paradox.- Posted July 25, 2013 Author Posted July 25, 2013 Np and gonna try. If you're looking for a cheap paid scripter, don't hesitate to contact me. Great minds discuss ideas, Average minds discuss events and small minds discuss people.
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