SpoC^ Posted November 12, 2014 Posted November 12, 2014 Hello, I'm new here, I'm trying to get the name of the area down after appearing on my screen want that it to delete after appearing can someone help me? my script alpha = 255 setTimer( function () if (dx ) then destroyElement(dx) end local playerX, playerY, playerZ = getElementPosition( getLocalPlayer()) local playerZoneName = getZoneName( playerX, playerY, playerZ ) local dx = dxDrawRectangle(sW*70, sH*1355/2, sW*150, sH*35/2, tocolor(0, 0, 0, 100/alpha), false) dxDrawBorderedText(playerZoneName,sW*75, sH*1360/2, sW*515/2, sH*30/2,tocolor(255,255,255,alpha - 50),1.0,"default-bold","left","top",false,false,false) alpha = alpha - 50 end,3,5000) My second attempt function show(type) a = 100 aR = 255 rendered = true addEventHandler("onClientRender", root, NameArea) addEventHandler("onClientRender", root, startAlpha) end addEvent("output", true) addEventHandler('output', root, show) local playerX, playerY, playerZ = getElementPosition( getLocalPlayer()) local playerZoneName = getZoneName( playerX, playerY, playerZ ) function NameArea dxDrawRectangle(sW*70, sH*1355/2, sW*150, sH*35/2, tocolor(0, 0, 0, a), true) dxDrawBorderedText(playerZoneName,sW*75, sH*1360/2, sW*515/2, sH*30/2,tocolor(255,255,255,aR),1.0,"default-bold","left","top",false,false,false) end function startAlpha() if aR > 0 then aR = aR - 1 end if a > 0 then a = a - 1 end if a == 0 then removeEventHandler("onClientRender", root, NameArea) removeEventHandler("onClientRender", root, startAlpha) end end function original of GTA:SA
Feche1320 Posted November 12, 2014 Posted November 12, 2014 On client-side script: setPlayerHudComponentVisible("area_name", true)
SpoC^ Posted November 12, 2014 Author Posted November 12, 2014 On client-side script: setPlayerHudComponentVisible("area_name", true) I am already using this function you not helped in nothing
Feche1320 Posted November 12, 2014 Posted November 12, 2014 On client-side script: setPlayerHudComponentVisible("area_name", true) I am already using this function you not helped in nothing You don't deserve any help with that english.
SpoC^ Posted November 12, 2014 Author Posted November 12, 2014 You don't deserve any help with that english. Sorry my english more his attempt did not help me
SkatCh Posted November 12, 2014 Posted November 12, 2014 local alpha = 150 setTimer( function () if (dx ) then destroyElement(dx) end local playerX, playerY, playerZ = getElementPosition( getLocalPlayer()) local playerZoneName = getZoneName( playerX, playerY, playerZ ) local dx = dxDrawRectangle(sW*70, sH*1355/2, sW*150, sH*35/2, tocolor(0, 0, 0, alpha), false) dxDrawBorderedText(playerZoneName,sW*75, sH*1360/2, sW*515/2, sH*30/2,tocolor(255,255,255,alpha),1.0,"default-bold","left","top",false,false,false) alpha = alpha + 1 if ( alpha >= 254 ) then alpha = 0 end end,10000,0)
StreetSaintz Posted November 12, 2014 Posted November 12, 2014 Can you explain better what you exactly want to do?
SpoC^ Posted November 12, 2014 Author Posted November 12, 2014 my script no function local playerX, playerY, playerZ = getElementPosition( getLocalPlayer()) local playerZoneName = getZoneName( playerX, playerY, playerZ ) dxDrawRectangle(sW*70, sH*1355/2, sW*150, sH*35/2, tocolor(0, 0, 0, 100), false) dxDrawBorderedText(playerZoneName,sW*75, sH*1360/2, sW*515/2, sH*30/2,tocolor(255,255,255,255),1.0,"default-bold","left","top",false,false,false)
SpoC^ Posted November 13, 2014 Author Posted November 13, 2014 My God, nobody do know how to help me, what are here? is just a calculation in alpha to solve
Woovie Posted November 13, 2014 Posted November 13, 2014 My God, nobody do know how to help me, what are here? is just a calculation in alpha to solve If it's such a simple issue, why can't you do it yourself?
AJXB Posted November 13, 2014 Posted November 13, 2014 @Woovie is right, you're impolite. being rude won't get you answers, if you can't solve your own problem, don't be rude to others to solve it for you. Anyhow, there is no event to be triggered when player changes zones, I believe you should add a timer, to trigger addEventHandler ("onClientRender",root,drawDXElements) and setTimer to removeEventHandler I won't write the code for you, if you have any coding experience you'll know how to write this "simple" code. Hope it works for you.
Dealman Posted November 14, 2014 Posted November 14, 2014 Wrote this code as an example whilst on my laptop, so don't expect miracles. This was thrown together in ~15 minutes, so no, it doesn't look good. But the purpose of it is for it to work as an example to you. I decided to use timers for this example, but it's possible to do it with less timers(Timers really aren't as bad as some people on these forums claim them to be). There's probably a few resources like these up on the community, I'd suggest you check those out. local sW, sH = guiGetScreenSize(); local lastZone = nil; local currentZone = ""; local fadingAlpha = 255; -- Set this to the value where you want it to start fading from. local fadingAlphaFrom = fadingAlpha; local fadingDuration = 4000; -- Set this for how long you want it to go from fully visible to not visible (255 -> 0). Milliseconds. local fadingInterval = 50; -- Set this for how often it should detract the increments. 50 ms minimum. Less = Smoother local timesToRun = (fadingDuration/fadingInterval); -- This is just to make the code below somewhat auto, so you don't have to change values everywhere. local fadeIncremental = (fadingAlphaFrom/timesToRun); -- This is just to make the code below somewhat auto, so you don't have to change values everywhere. function startCheckZoneTimer_Handler() setTimer(function() if(isPedDead(localPlayer) ~= true) then local pX, pY, pZ = getElementPosition(localPlayer) currentZone = getZoneName(pX, pY, pZ) if(currentZone ~= lastZone) then removeEventHandler("onClientRender", root, theStuffToDraw_Handler) addEventHandler("onClientRender", root, theStuffToDraw_Handler) fadingAlpha_Handler() lastZone = currentZone setTimer(function() removeEventHandler("onClientRender", root, theStuffToDraw_Handler) end, fadingDuration, 1); end end end, 250, 0); end addEventHandler("onClientResourceStart", resourceRoot, startCheckZoneTimer_Handler); function theStuffToDraw_Handler() dxDrawRectangle((10/1366)*sW, (715/768)*sH, (301/1366)*sW, (43/768)*sH, tocolor(0, 0, 0, fadingAlpha), true) dxDrawText(currentZone, (38/1366)*sW, (720/768)*sH, (321/1366)*sW, (748/768)*sH, tocolor(255, 255, 255, fadingAlpha), 1.00, "pricedown", "left", "top", false, false, true, false, false) end function fadingAlpha_Handler() fadingAlpha = 255; setTimer(function() fadingAlpha = fadingAlpha-fadeIncremental end, fadingInterval, timesToRun); end
SpoC^ Posted November 14, 2014 Author Posted November 14, 2014 (edited) .! Edited November 14, 2014 by Guest
WASSIm. Posted November 14, 2014 Posted November 14, 2014 you looks talking like you paid for fix script
AJXB Posted November 14, 2014 Posted November 14, 2014 Lol, this is just simply rude, respect others! Woovie is a respectful person, don't dare talk to him like that. If you don't like our answers, look someplace else, we're just being polite :3 we don't work for you mate.
Feche1320 Posted November 14, 2014 Posted November 14, 2014 Woovie ...... If you do not know how to solve, please do not reply you is just another useless! What a dumbass you are.
Dealman Posted November 14, 2014 Posted November 14, 2014 You do indeed need to change your attitude in case you'd like further assistance. I gave you some working code above, use it and try to understand it. Copy and pasting won't get you anywhere - neither will being disrespectful.
SpoC^ Posted November 14, 2014 Author Posted November 14, 2014 Dealman, thanks for your help! you're a good person.
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