Advertisement
Humour

Untitled

Apr 15th, 2015
216
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.57 KB | None | 0 0
  1. -- Jelle
  2. function vctChat(thePlayer, commandName, ...)
  3. local logged = getElementData(thePlayer, "loggedin")
  4.  
  5. if(logged==1) and exports.integration:isPlayerVCTMember(thePlayer) then
  6. if not (...) then
  7. outputChatBox("SYNTAX: /".. commandName .. " [Message]", thePlayer, 255, 194, 14)
  8. else
  9. if getElementData(thePlayer, "hideVCTChat") then
  10. setElementData(thePlayer, "hideVCTChat", false)
  11. outputChatBox("VCT Chat - SHOWING",thePlayer)
  12. end
  13. local affectedElements = { }
  14. local message = table.concat({...}, " ")
  15. local players = exports.pool:getPoolElementsByType("player")
  16. local adminTitle = exports.global:getPlayerAdminTitle(thePlayer)
  17. local playerid = getElementData(thePlayer, "playerid")
  18. local accountName = getElementData(thePlayer, "account:username")
  19. for k, arrayPlayer in ipairs(players) do
  20. local logged = getElementData(arrayPlayer, "loggedin")
  21. if logged==1 and exports.integration:isPlayerVCTMember(thePlayer) then
  22. local hideVCTChat = getElementData(arrayPlayer, "hideVCTChat")
  23. if hideVCTChat then
  24. local string = string.lower(message)
  25. local account = string.lower(getElementData(arrayPlayer, "account:username"))
  26. if string.find(string, account) then
  27. table.insert(affectedElements, arrayPlayer)
  28. triggerClientEvent ( "playNudgeSound", arrayPlayer)
  29. outputChatBox("Mentioned in /v chat - "..accountName..": "..message, arrayPlayer)
  30. end
  31. else
  32. table.insert(affectedElements, arrayPlayer)
  33. outputChatBox("[VCT] ("..getElementData(thePlayer, "playerid")..") "..(exports.integration:isPlayerVehicleConsultant(thePlayer) and "Leader" or "Member" ).." " .. accountName .. " : " .. message, arrayPlayer, 222, 222, 31)
  34. end
  35. end
  36. end
  37. exports.logs:dbLog(thePlayer, 4, affectedElements, "VCT chat - Msg: "..message)
  38. end
  39. end
  40. end
  41. addCommandHandler( "v", vctChat, false, false)
  42. addCommandHandler( "vct", vctChat, false, false)
  43.  
  44. -- Jelle
  45. function toggleVCTChat(thePlayer, commandName)
  46. local logged = getElementData(thePlayer, "loggedin")
  47. if logged==1 and isPlayerStaff(thePlayer) then
  48. local hideVCTChat = getElementData(thePlayer, "hideVCTChat") or false
  49. setElementData(thePlayer, "hideVCTChat", not hideVCTChat)
  50. outputChatBox("VCT Chat - "..(hideVCTChat and "SHOWING" or "HIDDEN").." /"..commandName.." to toggle it.",thePlayer)
  51. end
  52. end
  53. addCommandHandler("togglevct", toggleVCTChat, false, false)
  54. addCommandHandler("togv", toggleVCTChat, false, false)
  55. addCommandHandler("togglev", toggleVCTChat, false, false)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement