Estevam2d Posted February 9, 2014 Share Posted February 9, 2014 How do I get the window does not open when a vehicle over to the cylinder ? GUIEditor = { window = {}, staticimage = {}, label = {}, button = {}, progressbar = {} } ar = guiCreateWindow(290, 135, 446, 140, "Area de mineiraçao", false) guiSetAlpha(ar, 500.0) guiWindowSetSizable(ar, false) guiSetVisible(ar, false) GUIEditor.staticimage[1] = guiCreateStaticImage(17, 47, 64, 64, "images/Argila.png", false, ar) GUIEditor.label[1] = guiCreateLabel(123, 65, 313, 32, "<---= Clique na imagem ao lado para mineirar.", false, ar) GUIEditor.label[4] = guiCreateLabel(213, 113, 253, 32, "Minerio de Argila +$2x100", false, ar) GUIEditor.label[7] = guiCreateLabel(59, 378, 383, 36, "ATENÇÃO: Evento de mineiraçao X2 Valido até dia 05/01/2014 !", false, ar) GUIEditor.progressbar = guiCreateProgressBar(319, 285, 410, 59, false) GUIEditor.button[1] = guiCreateButton(404, 27, 22, 20, "Sair", true, ar) guiSetVisible(GUIEditor.progressbar, false) wepMarker1 = createMarker(460.407, 889.158, -28.695, "cylinder", 1.9, 251, 230, 0,100) function Towjob(hitElement) if getElementType(hitElement) == "player" and (hitElement == localPlayer) then if not guiGetVisible(ar) then local team = getPlayerTeam(hitElement) local theTeamName = getTeamName(team) if ( theTeamName == "Mineiro" )then guiSetVisible(ar, true) showCursor(true) else triggerServerEvent("Box11", hitElement) guiSetVisible(ar, false) showCursor(false) end end end end addEventHandler("onClientMarkerHit", wepMarker1, Towjob) function Towjobleave(leaveElement) if getElementType(leaveElement) == "player" and (leaveElement == localPlayer) then if guiGetVisible(ar) then guiSetVisible(ar, false) showCursor(false) end end end addEventHandler("onClientMarkerLeave", wepMarker1, Towjobleave) addEventHandler("onClientGUIClick", GUIEditor.staticimage[1], function () progress = guiProgressBarGetProgress() guiSetVisible(ar, false) guiSetVisible(GUIEditor.progressbar, true) local lol = guiProgressBarGetProgress(GUIEditor.progressbar) setTimer( guiProgressBarSetProgress, 5000, 1,GUIEditor.progressbar,lol+10 ) setTimer( guiProgressBarSetProgress, 10000, 1,GUIEditor.progressbar,lol+20 ) setTimer( guiProgressBarSetProgress, 15000, 1,GUIEditor.progressbar,lol+30 ) setTimer( guiProgressBarSetProgress, 20000, 1,GUIEditor.progressbar,lol+40 ) setTimer( guiProgressBarSetProgress, 25000, 1,GUIEditor.progressbar,lol+50 ) setTimer( guiProgressBarSetProgress, 30000, 1,GUIEditor.progressbar,lol+60 ) setTimer( guiProgressBarSetProgress, 35000, 1,GUIEditor.progressbar,lol+70 ) setTimer( guiProgressBarSetProgress, 40000, 1,GUIEditor.progressbar,lol+80 ) setTimer( guiProgressBarSetProgress, 45000, 1,GUIEditor.progressbar,lol+90 ) setTimer( guiProgressBarSetProgress, 50000, 1,GUIEditor.progressbar,lol+100 ) triggerServerEvent("Box", localPlayer) timer = setTimer( function () triggerServerEvent("Argila", localPlayer) guiSetVisible(GUIEditor.progressbar, false) showCursor(false) guiProgressBarSetProgress(GUIEditor.progressbar, 0) end, 50000,1) end) addEventHandler("onClientGUIClick", GUIEditor.button[1], function () getPropagated(ar, true) guiSetVisible(ar, false) showCursor(false) end) --// Setting local g_screenX, g_screenY = guiGetScreenSize(); local gScale = 0.3; local gAlphaDistance = 25; local gMaxDistance = 50; -- Max Distance local gTextAlpha = 120; local gTextSize = 1; local gAlphaDiff = gMaxDistance - gAlphaDistance; gScale = 1 / gScale * 800 / g_screenY; local gMaxScaleCurve = { { 0, 0 }, { 3, 3 }, { 13, 5 } }; local gTextScaleCurve = { { 0, 0.8 }, { 0.8, 1.2 }, { 99, 99 } }; local gTextAlphaCurve = { { 0, 0 }, { 25, 100 }, { 120, 190 }, { 255, 190 } }; addEventHandler ( 'onClientRender', root, function ( ) -- local x, y, z = getCameraMatrix(); local x1, y1, z1 = getElementPosition ( wepMarker1 ); local distance_1 = getDistanceBetweenPoints3D( x, y, z, x1, y1, z1 ); -- Marker #1 if distance_1 <= gMaxDistance then local x1_, y1_ = getScreenFromWorldPosition( x1, y1, z1 + 0.95, 0.06 ); if x1_ and y1_ then -- local scale = 1 / ( gScale * ( distance_1 / gMaxDistance ) ); local alpha = ( ( distance_1 - gAlphaDistance ) / gAlphaDiff ); alpha = ( alpha < 0 ) and gTextAlpha or gTextAlpha - ( alpha * gTextAlpha ); scale = math.evalCurve( gMaxScaleCurve, scale ); local textscale = math.evalCurve( gTextScaleCurve, scale ); local textalpha = math.evalCurve( gTextAlphaCurve, alpha ); -- dxDrawText( "Mineirar Argila", x1_, y1_, x1_, y1_, tocolor ( 255, 0, 0, textalpha ), textscale * gTextSize, "arial", "center", "bottom", false, false, false, true ); end end end ); -- ////////////////////////////////// -- // MATH FUNCTIONS // -- ////////////////////////////////// function math.evalCurve( curve, input ) if input < curve[ 1 ][ 1 ] then return curve[ 1 ][ 2 ]; end for idx = 2, #curve do if input < curve[ idx ][ 1 ] then local x1 = curve[ idx - 1 ][ 1 ]; local y1 = curve[ idx - 1 ][ 2 ]; local x2 = curve[ idx ][ 1 ]; local y2 = curve[ idx ][ 2 ]; local alpha = ( input - x1 ) / ( x2 - x1 ); return math.lerp( y1, y2, alpha ); end end return curve[ #curve ][ 2 ]; end function math.lerp( from, to, alpha ) return from + ( to-from ) * alpha; end Link to comment
Estevam2d Posted February 9, 2014 Author Share Posted February 9, 2014 I do not want the window displays when I'm with a car how do I prevent the window to appear when I am inside a vehicle? Link to comment
Estevam2d Posted February 9, 2014 Author Share Posted February 9, 2014 When the player passes the cylinder with the car I do not want the window open. Link to comment
myonlake Posted February 9, 2014 Share Posted February 9, 2014 You should use the function MADEX linked you. Also, is this your code or is it leaked or stolen? Seems as if you can't script and ask for help with code that you don't necessarily have anything to do with. Link to comment
Estevam2d Posted February 9, 2014 Author Share Posted February 9, 2014 is mine, I'm just confused because every time I think a different bug, not knowing I'm connecting script Link to comment
Moderators IIYAMA Posted February 10, 2014 Moderators Share Posted February 10, 2014 setTimer( guiProgressBarSetProgress, 5000, 1,GUIEditor.progressbar,lol+10 ) setTimer( guiProgressBarSetProgress, 10000, 1,GUIEditor.progressbar,lol+20 ) setTimer( guiProgressBarSetProgress, 15000, 1,GUIEditor.progressbar,lol+30 ) setTimer( guiProgressBarSetProgress, 20000, 1,GUIEditor.progressbar,lol+40 ) setTimer( guiProgressBarSetProgress, 25000, 1,GUIEditor.progressbar,lol+50 ) setTimer( guiProgressBarSetProgress, 30000, 1,GUIEditor.progressbar,lol+60 ) setTimer( guiProgressBarSetProgress, 35000, 1,GUIEditor.progressbar,lol+70 ) setTimer( guiProgressBarSetProgress, 40000, 1,GUIEditor.progressbar,lol+80 ) setTimer( guiProgressBarSetProgress, 45000, 1,GUIEditor.progressbar,lol+90 ) setTimer( guiProgressBarSetProgress, 50000, 1,GUIEditor.progressbar,lol+100 ) How many timers are you going to set? Jesus! You have no idea how many lagg that will cause, when you write every script like that. Or do you ? setTimer(function() lol = lol+10 guiProgressBarSetProgress(GUIEditor.progressbar,lol) end,5000, 10) Link to comment
Estevam2d Posted February 10, 2014 Author Share Posted February 10, 2014 This is true also wanted to reduce the timers ... but my problem is that when this resource taken by a player if he gets on top of a moving vehicle opens the window several times and tuck my money Link to comment
Moderators IIYAMA Posted February 10, 2014 Moderators Share Posted February 10, 2014 I only read that the resource has been taken by some player when he gets on the top of a vehicle? Are you talking about a car window or about a gui window? Is this google translator? Link to comment
Estevam2d Posted February 11, 2014 Author Share Posted February 11, 2014 I'm talking about the gui window yes i am using google translate I do not know English and this is not my script to the author, and have modified the script and when it is very well created I'll post it in community this resource is not mine I just modified and kept the altor Link to comment
Damien_Teh_Demon Posted February 11, 2014 Share Posted February 11, 2014 Here, i think this is what you want, to have it so player must be out of the vehicle inorder to trigger whatever the marker does. function Towjob(hitElement) if getElementType(hitElement) == "player" and hitElement == localPlayer and not isPedInVehicle(hitElement) then if not guiGetVisible(ar) then local team = getPlayerTeam(hitElement) local theTeamName = getTeamName(team) if ( theTeamName == "Mineiro" )then guiSetVisible(ar, true) showCursor(true) else triggerServerEvent("Box11", hitElement) guiSetVisible(ar, false) showCursor(false) end end end end addEventHandler("onClientMarkerHit", wepMarker1, Towjob) I havent tested but should be somewhere along those lines, if doesnt work add a if statement after first one to see if the player is in a vehicle and if he is then dont do anything. https://wiki.multitheftauto.com/wiki/IsPedInVehicle 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