skybad Posted March 7, 2013 Share Posted March 7, 2013 Basically I need help making a script that just want people to write an abbreviation but it appears more text in chat. I want something like this: function outputChatBox("You have the right to remain silent. Anything you say or do may be used against you in a court of law. You have the right to consult an attorney before speaking to the police and to have an attorney present during questioning now or in the future. If you cannot afford an attorney, one will be appointed for you before any questioning, if you wish. If you decide to answer any questions now, without an attorney present, you will still have the right to stop answering at any time until you talk to an attorney. Knowing and understanding your rights as I have explained them to you, are you willing to answer my questions without an attorney present? ") addCommandHandler("mir") end For player write /mir or /miranda and then appear this text: You have the right to remain silent. Anything you say or do may be used against you in a court of law. You have the right to consult an attorney before speaking to the police and to have an attorney present during questioning now or in the future. If you cannot afford an attorney, one will be appointed for you before any questioning, if you wish. If you decide to answer any questions now, without an attorney present, you will still have the right to stop answering at any time until you talk to an attorney. Knowing and understanding your rights as I have explained them to you, are you willing to answer my questions without an attorney present? Maybe if you guys can help post here some links for i see or something cuz i cant found on wiki, thanks. Link to comment
iPrestege Posted March 7, 2013 Share Posted March 7, 2013 text: The text string that you wish to send to the chat window. If more than 128 characters it will not be showed in chat. and you're script make no sense at all ) = Link to comment
Adde Posted March 7, 2013 Share Posted March 7, 2013 Client side function yourRights() outputChatBox("text", 220, 0, 50) end addCommandHandler("mir", outputChatBox) and as he said, you can only have 128 characters. Link to comment
iPrestege Posted March 7, 2013 Share Posted March 7, 2013 Client side function yourRights() outputChatBox("text", 220, 0, 50) end addCommandHandler("mir", outputChatBox) and as he said, you can only have 128 characters. function yourRights() outputChatBox("text", 220, 0, 50) end addCommandHandler("mir", yourRights) Link to comment
skybad Posted March 7, 2013 Author Share Posted March 7, 2013 Yes but how i made it for all can see? cuz only i can see other people cant Link to comment
iPrestege Posted March 7, 2013 Share Posted March 7, 2013 (edited) addCommandHandler("mir", function (source) name = getPlayerName (source) outputChatBox(" [ "..name.." ] text",root,255,0,0) end ) server side Edited March 7, 2013 by Guest Link to comment
skybad Posted March 7, 2013 Author Share Posted March 7, 2013 I want to appear like someone talking, /say, /me, /do i want it for /say Link to comment
skybad Posted March 7, 2013 Author Share Posted March 7, 2013 like this - [English] Mario Correia says: text i cant see the name of the person i only see the text Link to comment
iPrestege Posted March 7, 2013 Share Posted March 7, 2013 function yourRights() outputChatBox(" [ "..getPlayerName(source).." ]text",root,220, 0, 50,true) end addCommandHandler("mir", yourRights) Link to comment
skybad Posted March 7, 2013 Author Share Posted March 7, 2013 outputChatBox( " [" .. languagename .. "] " .. playerName .. " says: " .. function yourRights() outputChatBox( " [" .. languagename .. "] " .. playerName .. " says: " ..text",root,220, 0, 50,true) end addCommandHandler("mir", yourRights) i think its something like this Link to comment
skybad Posted March 7, 2013 Author Share Posted March 7, 2013 Sim eu sei que nao Yeah i know Link to comment
skybad Posted March 7, 2013 Author Share Posted March 7, 2013 This is my Server side of chat-system mysql = exports.mysql MTAoutputChatBox = outputChatBox function outputChatBox( text, visibleTo, r, g, b, colorCoded ) if string.len(text) > 128 then -- MTA Chatbox size limit MTAoutputChatBox( string.sub(text, 1, 127), visibleTo, r, g, b, colorCoded ) outputChatBox( string.sub(text, 128), visibleTo, r, g, b, colorCoded ) else MTAoutputChatBox( text, visibleTo, r, g, b, colorCoded ) end end function trunklateText(thePlayer, text, factor) if getElementData(thePlayer,"alcohollevel") and getElementData(thePlayer,"alcohollevel") > 0 then local level = math.ceil( getElementData(thePlayer,"alcohollevel") * #text / ( factor or 15 ) ) for i = 1, level do x = math.random( 1, #text ) -- dont replace spaces if text.sub( x, x ) == ' ' then i = i - 1 else local a, b = text:sub( 1, x - 1 ) or "", text:sub( x + 1 ) or "" local c = "" if math.random( 1, 6 ) == 1 then c = string.char(math.random(65,90)) else c = string.char(math.random(97,122)) end text = a .. c .. b end end end return text end function getElementDistance( a, b ) if not isElement(a) or not isElement(b) or getElementDimension(a) ~= getElementDimension(b) then return math.huge else local x, y, z = getElementPosition( a ) return getDistanceBetweenPoints3D( x, y, z, getElementPosition( b ) ) end end local gpn = getPlayerName function getPlayerName(p) local name = gpn(p) or getElementData(p, "ped:name") return string.gsub(name, "_", " ") end -- Main chat: Local IC, Me Actions & Faction IC Radio function localIC(source, message, language) if exports['freecam-tv']:isPlayerFreecamEnabled(source) then return end local affectedElements = { } table.insert(affectedElements, source) local x, y, z = getElementPosition(source) local playerName = getPlayerName(source) message = string.gsub(message, "#%x%x%x%x%x%x", "") -- Remove colour codes local languagename = call(getResourceFromName("language-system"), "getLanguageName", language) message = trunklateText( source, message ) local color = {0xEE,0xEE,0xEE} local focus = getElementData(source, "focus") local focusColor = false if type(focus) == "table" then for player, color2 in pairs(focus) do if player == source then color = color2 end end end local playerVehicle = getPedOccupiedVehicle(source) if playerVehicle then if (exports['vehicle-system']:isVehicleWindowUp(playerVehicle)) then table.insert(affectedElements, playerVehicle) outputChatBox( " [" .. languagename .. "] " .. playerName .. " ((In Car)) says: " .. message, source, unpack(color)) else outputChatBox( " [" .. languagename .. "] " .. playerName .. " says: " .. message, source, unpack(color)) end else outputChatBox( " [" .. languagename .. "] " .. playerName .. " says: " .. message, source, unpack(color)) end local dimension = getElementDimension(source) local interior = getElementInterior(source) local shownto = 1 if dimension ~= 0 then table.insert(affectedElements, "in"..tostring(dimension)) end -- Chat Commands tooltip if(getResourceFromName("tooltips-system"))then triggerClientEvent(source,"tooltips:showHelp", source,17) end for key, nearbyPlayer in ipairs(getElementsByType( "player" )) do local dist = getElementDistance( source, nearbyPlayer ) if dist < 20 then local nearbyPlayerDimension = getElementDimension(nearbyPlayer) local nearbyPlayerInterior = getElementInterior(nearbyPlayer) if (nearbyPlayerDimension==dimension) and (nearbyPlayerInterior==interior) then local logged = tonumber(getElementData(nearbyPlayer, "loggedin")) if not (isPedDead(nearbyPlayer)) and (logged==1) and (nearbyPlayer~=source) then local message2 = call(getResourceFromName("language-system"), "applyLanguage", source, nearbyPlayer, message, language) message2 = trunklateText( nearbyPlayer, message2 ) local pveh = getPedOccupiedVehicle(source) local nbpveh = getPedOccupiedVehicle(nearbyPlayer) local color = {0xEE,0xEE,0xEE} local focus = getElementData(nearbyPlayer, "focus") local focusColor = false if type(focus) == "table" then for player, color2 in pairs(focus) do if player == source then focusColor = true color = color2 end end end if pveh then if (exports['vehicle-system']:isVehicleWindowUp(pveh)) then for i = 0, getVehicleMaxPassengers(pveh) do local lp = getVehicleOccupant(pveh, i) if (lp) and (lp~=source) then outputChatBox(" [" .. languagename .. "] " .. playerName .. " ((In Car)) says: " .. message2, lp, unpack(color)) table.insert(affectedElements, lp) end end if (getElementData(nearbyPlayer, "adminduty") == 1) and (getPedOccupiedVehicle(nearbyPlayer) ~= pveh) then outputChatBox(" [" .. languagename .. "] " .. playerName .. " ((In Car)) says: " .. message2, nearbyPlayer, unpack(color)) end table.insert(affectedElements, pveh) exports.logs:dbLog(source, 7, affectedElements, languagename.." INCAR: ".. message) return end end if nbpveh and exports['vehicle-system']:isVehicleWindowUp(nbpveh) then if not focusColor then if dist < 3 then elseif dist < 6 then color = {0xDD,0xDD,0xDD} elseif dist < 9 then color = {0xCC,0xCC,0xCC} elseif dist < 12 then color = {0xBB,0xBB,0xBB} else color = {0xAA,0xAA,0xAA} end end outputChatBox(" [" .. languagename .. "] " .. playerName .. " says: " .. message2, nearbyPlayer, unpack(color)) table.insert(affectedElements, nearbyPlayer) else if not focusColor then if dist < 4 then elseif dist < 8 then color = {0xDD,0xDD,0xDD} elseif dist < 12 then color = {0xCC,0xCC,0xCC} elseif dist < 16 then color = {0xBB,0xBB,0xBB} else color = {0xAA,0xAA,0xAA} end end outputChatBox(" [" .. languagename .. "] " .. playerName .. " says: " .. message2, nearbyPlayer, unpack(color)) table.insert(affectedElements, nearbyPlayer) end shownto = shownto + 1 end end end end exports.logs:dbLog(source, 7, affectedElements, languagename..": ".. message) exports['freecam-tv']:add(shownto, playerName .. " says: " .. message, source) end for i = 1, 3 do addCommandHandler( tostring( i ), function( thePlayer, commandName, ... ) local lang = tonumber( getElementData( thePlayer, "languages.lang" .. i ) ) if lang ~= 0 then localIC( thePlayer, table.concat({...}, " "), lang ) end end ) end function meEmote(source, cmd, ...) local logged = getElementData(source, "loggedin") if not(isPedDead(source) and (logged == 1)) then local message = table.concat({...}, " ") if not (...) then outputChatBox("SYNTAX: /me [Action]", source, 255, 194, 14) else local result, affectedPlayers = exports.global:sendLocalMeAction(source, message) exports.logs:dbLog(source, 12, affectedPlayers, message) end end end addCommandHandler("ME", meEmote, false, true) addCommandHandler("Me", meEmote, false, true) function outputChatBoxCar( vehicle, target, text1, text2, color ) if vehicle and exports['vehicle-system']:isVehicleWindowUp( vehicle ) then if getPedOccupiedVehicle( target ) == vehicle then outputChatBox( text1 .. " ((In Car))" .. text2, target, unpack(color)) return true else return false end end outputChatBox( text1 .. text2, target, unpack(color)) return true end function radio(source, radioID, message) local affectedElements = { } local indirectlyAffectedElements = { } table.insert(affectedElements, source) radioID = tonumber(radioID) or 1 local hasRadio, itemKey, itemValue, itemID = exports.global:hasItem(source, 6) if hasRadio or getElementType(source) == "ped" or radioID == -2 then local theChannel = itemValue if radioID < 0 then theChannel = radioID elseif radioID == 1 and exports.global:isPlayerAdmin(source) and tonumber(message) and tonumber(message) >= 1 and tonumber(message) <= 10 then return elseif radioID ~= 1 then local count = 0 local items = exports['item-system']:getItems(source) for k, v in ipairs(items) do if v[1] == 6 then count = count + 1 if count == radioID then theChannel = v[2] break Link to comment
DNL291 Posted March 7, 2013 Share Posted March 7, 2013 like this - [English] Mario Correia says: texti cant see the name of the person i only see the text You must create your system language to get the player's country. Link to comment
skybad Posted March 7, 2013 Author Share Posted March 7, 2013 I have but i want the name too Link to comment
Anderl Posted March 7, 2013 Share Posted March 7, 2013 This is my Server side of chat-system mysql = exports.mysql MTAoutputChatBox = outputChatBox function outputChatBox( text, visibleTo, r, g, b, colorCoded ) if string.len(text) > 128 then -- MTA Chatbox size limit MTAoutputChatBox( string.sub(text, 1, 127), visibleTo, r, g, b, colorCoded ) outputChatBox( string.sub(text, 128), visibleTo, r, g, b, colorCoded ) else MTAoutputChatBox( text, visibleTo, r, g, b, colorCoded ) end end function trunklateText(thePlayer, text, factor) if getElementData(thePlayer,"alcohollevel") and getElementData(thePlayer,"alcohollevel") > 0 then local level = math.ceil( getElementData(thePlayer,"alcohollevel") * #text / ( factor or 15 ) ) for i = 1, level do x = math.random( 1, #text ) -- dont replace spaces if text.sub( x, x ) == ' ' then i = i - 1 else local a, b = text:sub( 1, x - 1 ) or "", text:sub( x + 1 ) or "" local c = "" if math.random( 1, 6 ) == 1 then c = string.char(math.random(65,90)) else c = string.char(math.random(97,122)) end text = a .. c .. b end end end return text end function getElementDistance( a, b ) if not isElement(a) or not isElement(b) or getElementDimension(a) ~= getElementDimension(b) then return math.huge else local x, y, z = getElementPosition( a ) return getDistanceBetweenPoints3D( x, y, z, getElementPosition( b ) ) end end local gpn = getPlayerName function getPlayerName(p) local name = gpn(p) or getElementData(p, "ped:name") return string.gsub(name, "_", " ") end -- Main chat: Local IC, Me Actions & Faction IC Radio function localIC(source, message, language) if exports['freecam-tv']:isPlayerFreecamEnabled(source) then return end local affectedElements = { } table.insert(affectedElements, source) local x, y, z = getElementPosition(source) local playerName = getPlayerName(source) message = string.gsub(message, "#%x%x%x%x%x%x", "") -- Remove colour codes local languagename = call(getResourceFromName("language-system"), "getLanguageName", language) message = trunklateText( source, message ) local color = {0xEE,0xEE,0xEE} local focus = getElementData(source, "focus") local focusColor = false if type(focus) == "table" then for player, color2 in pairs(focus) do if player == source then color = color2 end end end local playerVehicle = getPedOccupiedVehicle(source) if playerVehicle then if (exports['vehicle-system']:isVehicleWindowUp(playerVehicle)) then table.insert(affectedElements, playerVehicle) outputChatBox( " [" .. languagename .. "] " .. playerName .. " ((In Car)) says: " .. message, source, unpack(color)) else outputChatBox( " [" .. languagename .. "] " .. playerName .. " says: " .. message, source, unpack(color)) end else outputChatBox( " [" .. languagename .. "] " .. playerName .. " says: " .. message, source, unpack(color)) end local dimension = getElementDimension(source) local interior = getElementInterior(source) local shownto = 1 if dimension ~= 0 then table.insert(affectedElements, "in"..tostring(dimension)) end -- Chat Commands tooltip if(getResourceFromName("tooltips-system"))then triggerClientEvent(source,"tooltips:showHelp", source,17) end for key, nearbyPlayer in ipairs(getElementsByType( "player" )) do local dist = getElementDistance( source, nearbyPlayer ) if dist < 20 then local nearbyPlayerDimension = getElementDimension(nearbyPlayer) local nearbyPlayerInterior = getElementInterior(nearbyPlayer) if (nearbyPlayerDimension==dimension) and (nearbyPlayerInterior==interior) then local logged = tonumber(getElementData(nearbyPlayer, "loggedin")) if not (isPedDead(nearbyPlayer)) and (logged==1) and (nearbyPlayer~=source) then local message2 = call(getResourceFromName("language-system"), "applyLanguage", source, nearbyPlayer, message, language) message2 = trunklateText( nearbyPlayer, message2 ) local pveh = getPedOccupiedVehicle(source) local nbpveh = getPedOccupiedVehicle(nearbyPlayer) local color = {0xEE,0xEE,0xEE} local focus = getElementData(nearbyPlayer, "focus") local focusColor = false if type(focus) == "table" then for player, color2 in pairs(focus) do if player == source then focusColor = true color = color2 end end end if pveh then if (exports['vehicle-system']:isVehicleWindowUp(pveh)) then for i = 0, getVehicleMaxPassengers(pveh) do local lp = getVehicleOccupant(pveh, i) if (lp) and (lp~=source) then outputChatBox(" [" .. languagename .. "] " .. playerName .. " ((In Car)) says: " .. message2, lp, unpack(color)) table.insert(affectedElements, lp) end end if (getElementData(nearbyPlayer, "adminduty") == 1) and (getPedOccupiedVehicle(nearbyPlayer) ~= pveh) then outputChatBox(" [" .. languagename .. "] " .. playerName .. " ((In Car)) says: " .. message2, nearbyPlayer, unpack(color)) end table.insert(affectedElements, pveh) exports.logs:dbLog(source, 7, affectedElements, languagename.." INCAR: ".. message) return end end if nbpveh and exports['vehicle-system']:isVehicleWindowUp(nbpveh) then if not focusColor then if dist < 3 then elseif dist < 6 then color = {0xDD,0xDD,0xDD} elseif dist < 9 then color = {0xCC,0xCC,0xCC} elseif dist < 12 then color = {0xBB,0xBB,0xBB} else color = {0xAA,0xAA,0xAA} end end outputChatBox(" [" .. languagename .. "] " .. playerName .. " says: " .. message2, nearbyPlayer, unpack(color)) table.insert(affectedElements, nearbyPlayer) else if not focusColor then if dist < 4 then elseif dist < 8 then color = {0xDD,0xDD,0xDD} elseif dist < 12 then color = {0xCC,0xCC,0xCC} elseif dist < 16 then color = {0xBB,0xBB,0xBB} else color = {0xAA,0xAA,0xAA} end end outputChatBox(" [" .. languagename .. "] " .. playerName .. " says: " .. message2, nearbyPlayer, unpack(color)) table.insert(affectedElements, nearbyPlayer) end shownto = shownto + 1 end end end end exports.logs:dbLog(source, 7, affectedElements, languagename..": ".. message) exports['freecam-tv']:add(shownto, playerName .. " says: " .. message, source) end for i = 1, 3 do addCommandHandler( tostring( i ), function( thePlayer, commandName, ... ) local lang = tonumber( getElementData( thePlayer, "languages.lang" .. i ) ) if lang ~= 0 then localIC( thePlayer, table.concat({...}, " "), lang ) end end ) end function meEmote(source, cmd, ...) local logged = getElementData(source, "loggedin") if not(isPedDead(source) and (logged == 1)) then local message = table.concat({...}, " ") if not (...) then outputChatBox("SYNTAX: /me [Action]", source, 255, 194, 14) else local result, affectedPlayers = exports.global:sendLocalMeAction(source, message) exports.logs:dbLog(source, 12, affectedPlayers, message) end end end addCommandHandler("ME", meEmote, false, true) addCommandHandler("Me", meEmote, false, true) function outputChatBoxCar( vehicle, target, text1, text2, color ) if vehicle and exports['vehicle-system']:isVehicleWindowUp( vehicle ) then if getPedOccupiedVehicle( target ) == vehicle then outputChatBox( text1 .. " ((In Car))" .. text2, target, unpack(color)) return true else return false end end outputChatBox( text1 .. text2, target, unpack(color)) return true end function radio(source, radioID, message) local affectedElements = { } local indirectlyAffectedElements = { } table.insert(affectedElements, source) radioID = tonumber(radioID) or 1 local hasRadio, itemKey, itemValue, itemID = exports.global:hasItem(source, 6) if hasRadio or getElementType(source) == "ped" or radioID == -2 then local theChannel = itemValue if radioID < 0 then theChannel = radioID elseif radioID == 1 and exports.global:isPlayerAdmin(source) and tonumber(message) and tonumber(message) >= 1 and tonumber(message) <= 10 then return elseif radioID ~= 1 then local count = 0 local items = exports['item-system']:getItems(source) for k, v in ipairs(items) do if v[1] == 6 then count = count + 1 if count == radioID then theChannel = v Link to comment
Anderl Posted March 7, 2013 Share Posted March 7, 2013 These resource and exported function names makes me remember of Valhalla gamemode.. Link to comment
skybad Posted March 7, 2013 Author Share Posted March 7, 2013 Maybe but now have more things... is no more one valhalla gamemode Link to comment
Anderl Posted March 7, 2013 Share Posted March 7, 2013 Still, it's based on Valhalla gamemode (if I understood your Google Translate's text correctly), and we don't give support with these scripts - even if someone tries to help you, a moderator will come and lock the thread soon. Link to comment
Castillo Posted March 8, 2013 Share Posted March 8, 2013 We don't give support with leaked scripts. Topic locked. Link to comment
Recommended Posts