Valli Posted September 19, 2008 Share Posted September 19, 2008 (edited) I finally figured out that having the GUI and broph running at the same time was causing people's chat in console to show twice in a row. Is there anyway to disable that part in one of the scripts (that displays chat in console when entered)? Would really appreciate it! Here is the script, if someone could copy the part that controls chat in the console, paste it, and tell me what to change, or if I need to delete it. Thanks. root = getRootElement () players = getElementsByType ( "player" ) connected = 0 function resourceStart ( name ) if ( name == getThisResource() ) then local allMessages = getElementsByType ( "welcome" ) local randomMessage = randInt(1,#allMessages) local varMessageFind = allMessages[randomMessage] local varMessage = getElementData ( varMessageFind, "message" ) outputChatBox ( "" ..varMessage.. "", root, 0, 255, 100 ) setWeather ( 14 ) setTime ( 5, 30 ) for k,v in ipairs(players) do spawn_me( v, 2500 ) end end end function destroyBlipsAttachedTo(player) local attached = getAttachedElements ( player ) if ( attached ) then for k,element in ipairs(attached) do if getElementType ( element ) == "blip" then destroyElement ( element ) end end end end function elementAlpha ( source, command, level ) if ( level ) then if ( source ) then setElementAlpha ( source, tonumber(level) ) end else local alphaLevel = getElementAlpha ( source ) local player = getClientName ( source ) outputChatBox ( "* " ..player.. "'s Alpha Level: " ..alphalevel ) end end function vehicleExplode () setTimer ( respawnVehicle, 2500, 1, source ) end -- addCommandHandler ( "output", "outputOnLoad" ) -- function outputOnLoad ( name ) -- for k,v in getElementsByType ( "vehicle" ) do -- local model = getVehicleID ( v ) -- local id = getVehicleNameFromID ( model ) -- local x, y, z = getElementPosition ( v ) -- local rx, ry, rz = getVehicleRotation ( v ) -- local c1, c2, c3, c4 = getVehicleColor ( v ) -- outputConsole ( "<vehicle id=\"" .. id .. "\" model=\"" .. model .. "\" posX=\"" .. x .. "\" posY=\"" .. y .. "\" posZ=\"" .. z .. "\" rotX=\"" .. rx .. "\" rotY=\"" .. ry .. "\" rotZ=\"" .. rz .. "\" colors=\"" .. c1 .. "," .. c2 .. "," .. c3 .. "," .. c4 .. "\"/>" ) -- outputDebugString ( "<vehicle id=\"" .. id .. "\" model=\"" .. model .. "\" posX=\"" .. x .. "\" posY=\"" .. y .. "\" posZ=\"" .. z .. "\" rotX=\"" .. rx .. "\" rotY=\"" .. ry .. "\" rotZ=\"" .. rz .. "\" colors=\"" .. c1 .. "," .. c2 .. "," .. c3 .. "," .. c4 .. "\"/>" ) -- end -- end function playerSpawn ( spawnpoint ) --TALIDAN STUFFZOR local rand1 = randInt(50,255) local rand2 = randInt(50,255) local rand3 = randInt(50,255) blip = createBlipAttachedTo ( source, 0, 2, rand1, rand2, rand3, 90 ) setPlayerNametagColor ( source, rand1, rand2, rand3 ) setElementData ( source, "colour_r", rand1 ) setElementData ( source, "colour_g", rand2 ) setElementData ( source, "colour_b", rand3 ) end function broph_Chat ( message, theType ) if theType == 0 then cancelEvent() message = string.gsub(message, "#%x%x%x%x%x%x", "") local r = getElementData ( source, "colour_r" ) local g = getElementData ( source, "colour_g" ) local b = getElementData ( source, "colour_b" ) local bastidName = getClientName ( source ) outputChatBox ( bastidName..":#FFFFFF "..message, getRootElement(), r, g, b, true ) end end function setWaveLevel ( source, command, height ) if ( height ) then setWaveHeight ( height ) else wavelevel = getWaveHeight () outputConsole ( "Wave Height: " ..wavelevel ) end end function setLevel ( source, command, levelplayer, level ) if ( getClientName ( source ) == "BrophY" ) then local player = getPlayerFromNick ( levelplayer ) setClientLevel ( player , tonumber ( level ) ) end end function kickPlayer ( player, commandname, kickedname, reason ) local kicked = getPlayerFromNick ( kickedname ) if ( getClientName ( source ) == "BrophY" ) then kickPlayer ( kicked, player, reason ) end end function playerWasted () destroyBlipsAttachedTo ( source ) spawn_me ( source, 2500 ) end function playerJoin () spawn_me( source, 1500 ) end function playerQuit () destroyBlipsAttachedTo ( source ) end function spawn_me( player, timer ) setTimer ( spawnThePlayer, timer, 1, player ) end function spawnThePlayer ( player ) local b = spawnPlayer ( player, -711+randInt(1,5), 957+randInt(5,9), 12.4, 90, randInt(9,288) ) if not b then spawnThePlayer ( player ) return end fadeCamera(player,true) end function veh ( source, command, vehid ) local x,y,z = getElementPosition ( source ) local car = createVehicle ( tonumber(vehid), tonumber(x), tonumber(y), tonumber(z) ) warpPlayerIntoVehicle ( source, car ) end function pass ( source, command, player, seat ) local name = getPlayerFromNick ( player ) local car = getPlayerOccupiedVehicle ( name ) warpPlayerIntoVehicle ( source, car, seat ) end function distance ( source, command, player1, player2 ) if ( not player1 ) then outputChatBox ( "You need to select someone to check your distance!", source, 255, 255, 0 ) end if ( player1 and not player2 ) then local player1id = getPlayerFromNick ( player1 ) if ( player1id ) then local player1name = getClientName ( player1id ) local player2name = getClientName ( source ) local x1, y1, z1 = getElementPosition ( player1id ) local x2, y2, z2 = getElementPosition ( source ) local distance = getDistanceBetweenPoints2D ( x1, y1, x2, y2 ) / 2 local distresult = math.ceil ( distance ) if ( distance >= 402.25 ) then local totaldistance = distance / 402.25 local resultx = math.ceil( totaldistance ) outputChatBox ( "The Distance between " ..player1name.. " and " ..player2name.. " is " ..resultx.. " Miles", root, 255, 255, 0 ) else outputChatBox ( "The Distance between " ..player1name.. " and " ..player2name.. " is " ..distresult.. " Meters", root, 255, 255, 0 ) end elseif ( player1id == false ) then outputChatBox ( "Player not found!", source, 255, 255, 0 ) end end if ( player2 ) then local player1id = getPlayerFromNick ( player1 ) local player2id = getPlayerFromNick ( player2 ) if ( player1id and player2id ) then local player1name = getClientName ( player1id ) local player2name = getClientName ( player2id ) local x1, y1, z1 = getElementPosition ( player1id ) local x2, y2, z2 = getElementPosition ( player2id ) local distance = getDistanceBetweenPoints2D ( x1, y1, x2, y2 ) / 2 local distresult = math.ceil ( distance ) if ( distance >= 402.25 ) then local totaldistance = distance / 402.25 local resultx = math.ceil( totaldistance ) outputChatBox ( "The Distance between " ..player1name.. " and " ..player2name.. " is " ..resultx.. " Miles", root, 255, 255, 0 ) else outputChatBox ( "The Distance between " ..player1name.. " and " ..player2name.. " is " ..distresult.. " Meters", root, 255, 255, 0 ) end elseif ( player1id == false or player2id == false ) then outputChatBox ( "Player not found!", source, 255, 255, 0 ) end end end function grav ( source, command, gravid ) setGravity ( gravid ) for k,v in ipairs(players) do setPlayerGravity ( v, gravid ) end end function gravlevel () local gravity = getGravity () outputConsole ( "Gravity is currently set to " ..gravity.. "" ) end function setgamespeed ( player, command, value ) setGameSpeed ( tonumber ( value ) ) end function gamespeed ( player, command, value ) local speed = getGameSpeed () outputConsole ( "GameSpeed is currently set to " ..speed.. "" ) end function consoleKill ( player, commandName ) if ( player ) then killPlayer ( player ) end end function testSound ( source, command, ids ) local players = getElementsByType( "player" ) local idsx = tonumber ( ids ) for k,v in ipairs(players) do playSoundFrontEnd ( v, idsx ) end end function armor ( source ) setPlayerArmor ( source, 100 ) end function testSound2 ( source, command, ids ) preloadMissionAudio ( source, ids, 1 ) local x,y,z = getElementPosition ( source ) playMissionAudio ( source, 1, x, y, z ) end function playslot () playMissionAudio ( source, 1, x, y, z ) end function style ( player, command, ids ) setPlayerFightingStyle ( player, tonumber(ids) ) end ----TALIDAN ADDED THIS CRAP, <3 BROPHY --[[Vehicle pos/rot: -721.44641113281 1014.2721557617 11.814476966858, 186.75370788574 357.12237548828 189.90641784668]] function flipVehicle ( source, cmd ) if ( isPlayerInVehicle ( source ) == true ) then local theVehicle = getPlayerOccupiedVehicle ( source ) local x,y,z = getElementPosition ( theVehicle ) local rx,ry,rz = getVehicleRotation ( theVehicle ) if rx > 180 then rz = rz - 180 end Edited September 19, 2008 by Guest Link to comment
Gamesnert Posted September 19, 2008 Share Posted September 19, 2008 Simple I guess, go into one of the resources, find "onPlayerChat" event somewhere in one of them, and type "cancelEvent()" there. It might help. Link to comment
Valli Posted September 19, 2008 Author Share Posted September 19, 2008 Don't see it there, I'll check the GUI file. Thanks for the quick response btw Link to comment
Gamesnert Posted September 19, 2008 Share Posted September 19, 2008 Don't see it there, I'll check the GUI file. Thanks for the quick response btw Do -- in front of line 268. (addEventHandler ( "onPlayerChat", root, broph_Chat )) I guess that's even more effective. And if you don't know it, -- == comment, skip. Link to comment
Valli Posted September 19, 2008 Author Share Posted September 19, 2008 kk done, gonna log on the server and see if it worked, if not I'll try a restart. But ty for the quick help Link to comment
Valli Posted September 19, 2008 Author Share Posted September 19, 2008 Hmm, it didn't work instantly. I will try a server restart. Here is what it looks like when I put in the code, just to double check it's correct.... cancelEvent()addEventHandler (onPlayerChat", root, broph_Chat ) Link to comment
Gamesnert Posted September 19, 2008 Share Posted September 19, 2008 --addEventHandler (onPlayerChat", root, broph_Chat ) Try this Link to comment
Valli Posted September 19, 2008 Author Share Posted September 19, 2008 --addEventHandler (onPlayerChat", root, broph_Chat ) Try this Ohh okay, gotta wait for my host to take the server offline. Since I have to go to the dentist now then the movies, I wont be able to until tomorrow. But I will send you a PM when it's done to let you know if it worked. And thanks a bunch Link to comment
Scarface Posted September 19, 2008 Share Posted September 19, 2008 Why the hell would you want two freeroam scripts on your server, no wonder they are conflicting! Link to comment
Michael_Sund Posted September 19, 2008 Share Posted September 19, 2008 Why the hell would you want two freeroam scripts on your server, no wonder they are conflicting! LOL freeroam is better if you want cool stuff like maptp and stuff like that lights... but broph is easier to just put in because it's almost empty but it got all stuff that is needed like spawnpoints... My rp script is started on this but there is no code from the broph script left anymore Link to comment
Valli Posted September 20, 2008 Author Share Posted September 20, 2008 I want the menu of the GUI, and the spawnpoint of the broph. If I can disable the chat in one, they can work with oneanother. Link to comment
Ace_Gambit Posted September 20, 2008 Share Posted September 20, 2008 But the point is that both resources are game modes. And the idea behind game modes is that you don't run multiple at the same time. Link to comment
norby89 Posted September 20, 2008 Share Posted September 20, 2008 But the point is that both resources are game modes. And the idea behind game modes is that you don't run multiple at the same time. broph is just a resource Link to comment
Ace_Gambit Posted September 20, 2008 Share Posted September 20, 2008 broph is just a resource I see. I didn't know that. I thought it was game mode as it handles mode specific tasks like spawning. Link to comment
Valli Posted September 20, 2008 Author Share Posted September 20, 2008 broph is just a resource I see. I didn't know that. I thought it was game mode as it handles mode specific tasks like spawning. When Freeroam is run, broph spawns you at a little cabin somewhere, there is a selection of pre-spawned cars people can roam in. Link to comment
Gamesnert Posted September 20, 2008 Share Posted September 20, 2008 I want the menu of the GUI, and the spawnpoint of the broph. If I can disable the chat in one, they can work with oneanother. Do I understand this right? The only reason you run broph is for the spawnpoint? Link to comment
Michael_Sund Posted September 20, 2008 Share Posted September 20, 2008 I want the menu of the GUI, and the spawnpoint of the broph. If I can disable the chat in one, they can work with oneanother. Do I understand this right? The only reason you run broph is for the spawnpoint? Seems like that Why not copy the map file from broph and add the meta string? Link to comment
Valli Posted September 20, 2008 Author Share Posted September 20, 2008 Because I have no clue on how scripts work. Link to comment
Ace_Gambit Posted September 20, 2008 Share Posted September 20, 2008 You can try to read the wiki and learn how to do it. It's probably even faster in the long run instead of asking people for ready to copy-paste solutions. Link to comment
Gamesnert Posted September 20, 2008 Share Posted September 20, 2008 You can try to read the wiki and learn how to do it. It's probably even faster in the long run instead of asking people for ready to copy-paste solutions. Yup, that's the truth. And usually when you learn how to script, and you can finally do it, they're adapted better to your server and your needs too. Link to comment
Valli Posted September 20, 2008 Author Share Posted September 20, 2008 https://www.youtube.com/watch?v=GzjNHq-X6P0 Link to comment
Gamesnert Posted September 20, 2008 Share Posted September 20, 2008 https://www.youtube.com/watch?v=GzjNHq-X6P0 But seriously now... How is that related to MTA? >.< Link to comment
Valli Posted September 23, 2008 Author Share Posted September 23, 2008 --addEventHandler (onPlayerChat", root, broph_Chat ) Try this Darn, did not work. Ohh well I am too lazy to keep trying, will have to do without it I guess. lol. Link to comment
x86 Posted September 23, 2008 Share Posted September 23, 2008 function destroyBlipsAttachedTo(player) local attached = getAttachedElements ( player ) if ( attached ) then for k,element in ipairs(attached) do if getElementType ( element ) == "blip" then destroyElement ( element ) end end end end Why you have that double in script ? 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