Jump to content

Alpha Set :D


#Paper

Recommended Posts

Posted

I want to make a funny window:

function setMajorAlpha () 
local getAlpha = guiGetAlpha(wndShop) 
guiSetAlpha(wndShop, tonumber(getAlpha + 0.1)) 
end 
  
function setMinorAlpha () 
local getAlpha = guiGetAlpha(wndShop) 
guiSetAlpha(wndShop, tonumber(getAlpha - 0.1)) 
end 
  
function ShowHide (key, keyState) 
local getAlpha = guiGetAlpha(wndShop) 
if getAlpha == 0.1 then 
setTimer(setMajorAlpha, 500, 6) 
elseif getAlpha == 0.6 then 
setTimer(setMinorAlpha, 500, 6) 
end 
end 
bindKey("F10", "down", ShowHide) 

When i press F10 the Alpha doesn't changes it's the same: 0.1

mtaubluascripter.png

My skype: skiper964

I helped you? Help me! ^^

Help me bro! ^^

Posted

Any errors? i'm lazy right now.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

What's the problem excatly, is the window opening? Do /debugscript 3 in your server, and post the errors there.

SinCity Gaming 2.0

- New owner

- New servers

- More updates

http://sincitygaming.net

SinCity Gaming - The new generation of gaming!

  • Moderators
Posted
Did you set the default alpha?
guiSetAlpha(wndShop, 0.6)) 

after wndShop cteation

also try to secure the condition more

if getAlpha <= 0.1 then 
setTimer(setMajorAlpha, 500, 6) 
elseif getAlpha >= 0.6 then 
setTimer(setMinorAlpha, 500, 6) 
 end 

I'm agree, if you put an outputChatBox( "Alpha: "..getAlpha ), you will can noticed that it's not exactly 0.6 or 0.1 but something like 0.599863 or IDK

So the Alpha is never exactly 0.6 or 0.1

Wojak is right, but change a little thing:

if getAlpha <= 0.13 then 
setTimer(setMajorAlpha, 500, 6) 
elseif getAlpha >= 0.57 then 
setTimer(setMinorAlpha, 500, 6) 
 end 

It's more secure like that :wink:

The rEvolution is coming ...

Posted
if getAlpha <= 0.13 then 
setTimer(function () guiSetAlpha(wndShop, getAlpha + 0.1) end, 500, 6) 
elseif getAlpha >= 0.57 then 
setTimer(function () guiSetAlpha(wndShop, getAlpha - 0.1) end, 500, 6) 
end 

This can works?

mtaubluascripter.png

My skype: skiper964

I helped you? Help me! ^^

Help me bro! ^^

  • Moderators
Posted

I don't know I never this kind of script.

but I think that you ave to put a ; after your guiSetAlpha

But why you can't test it yourself ??

The rEvolution is coming ...

Posted
I don't know I never this kind of script.

but I think that you ave to put a ; after your guiSetAlpha

But why you can't test it yourself ??

I have some problems whit my Video Card... T_T

mtaubluascripter.png

My skype: skiper964

I helped you? Help me! ^^

Help me bro! ^^

  • Moderators
Posted

So I test it and it works but I changed 2 things ( and we don't need the ; ^^ ):

You have to get the Alpha each time instead of the variable getAlpha because if the getAlpha value is ( for exemple ) 0.3, the server gona make guiSetAlpha(wndShop, 0.3+ 0.1)

So the Alpha is always 0.4 do you understand ? I'm sure that you understand :mrgreen:

And it was not rather fluid so a modified it for you :D :

setTimer(function () guiSetAlpha(wndShop, guiGetAlpha( wndShop )+0.02) end, 100, 30) 

and

setTimer(function () guiSetAlpha(wndShop, guiGetAlpha( wndShop )-0.02) end, 100, 30) 

It works perfectly on my own server

The rEvolution is coming ...

Posted
So I test it and it works but I changed 2 things ( and we don't need the ; ^^ ):

You have to get the Alpha each time instead of the variable getAlpha because if the getAlpha value is ( for exemple ) 0.3, the server gona make guiSetAlpha(wndShop, 0.3+ 0.1)

So the Alpha is always 0.4 do you understand ? I'm sure that you understand :mrgreen:

And it was not rather fluid so a modified it for you :D :

setTimer(function () guiSetAlpha(wndShop, guiGetAlpha( wndShop )+0.02) end, 100, 30) 

and

setTimer(function () guiSetAlpha(wndShop, guiGetAlpha( wndShop )-0.02) end, 100, 30) 

It works perfectly on my own server

ye i understand and i fixxed it, but, why i can't set the time of the timer under "50"? xD

mtaubluascripter.png

My skype: skiper964

I helped you? Help me! ^^

Help me bro! ^^

  • Moderators
Posted

have you see this on the wiki ?

I think it's because the internal clock of the server is maybe 50 ms ?

So 1 cycle = 50 ms

But I'm not sure ^^

The rEvolution is coming ...

Posted
have you see this on the wiki ?

I think it's because the internal clock of the server is maybe 50 ms ?

So 1 cycle = 50 ms

But I'm not sure ^^

Ty :D

P.S: Have you skype?

mtaubluascripter.png

My skype: skiper964

I helped you? Help me! ^^

Help me bro! ^^

  • Moderators
Posted

No I don't have skype because I have some problems with my Network when I call a guy.

But I have mumble with a local server ( if you want to speak in your mic ) and msn ( see my profile )

The rEvolution is coming ...

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...