Jump to content

How can i animate a gui?


Recommended Posts

  • Replies 52
  • Created
  • Last Reply

Top Posters In This Topic

Posted

this is my sample. Just edit guiSetAlphat to guiSetPosition.

bindKey("F3","down",function() 
     guiSetVisible(window,not guiGetVisible(window)) 
     guiSetAlpha( window, 0) 
     setTimer( 
     function() 
     guiSetAlpha( window, 0.1 ) 
     end 
     , 100, 1) 
     setTimer( 
     function() 
     guiSetAlpha( window, 0.2 ) 
     end 
     , 2000, 1) 
     setTimer( 
     function() 
     guiSetAlpha( window, 0.3 ) 
     end 
     , 300, 1) 
     setTimer( 
     function() 
     guiSetAlpha( window, 0.4 ) 
     end 
     , 400, 1) 
     setTimer( 
     function() 
     guiSetAlpha( window, 0.5 ) 
     end 
     , 500, 1) 
     setTimer( 
     function() 
     guiSetAlpha( window, 0.6 ) 
     end 
     , 600, 1) 
     setTimer( 
     function() 
     guiSetAlpha( window, 0.7 ) 
     end 
     , 700, 1) 
     setTimer( 
     function() 
     guiSetAlpha( window, 0.8 ) 
     end 
     , 800, 1) 
     setTimer( 
     function() 
     guiSetAlpha( window, 0.9 ) 
     end 
     , 900, 1) 
     setTimer( 
     function() 
     guiSetAlpha( window, 1 ) 
     end 
     , 1000, 0) 
     showCursor(guiGetVisible(window)) 
end) 

Diet with russian vodka, lose 3 days in one week !

Posted

Thanks for that, Im using it differently for a spawn GUI though but thanks :)

Another question, How can i check if a gridlist already has a row with the same name? Like say i make a command /addrow [ROWNAME]

And then i type /addrow FWCentral then again i type /addrow FWCentral how can i check if there is already one to stop it?

3677124c9d4d768da64a55d5bebf578e.png
Posted
I want a GUI to slide in from the side how can i do it?

Take a look at arc_'s client_anim library, it is located in the "race" resource.

Example of usage:

Animation.createAndPlay(pict, { from = 0, to = 100, time = 2000, fn = guiMove }) 

Where the 'pict' is an GUI element.

Posted

I don't need help with the sliding anymore thanks CapY, I need to know how to check if a gridlist row already contains the same text how can i do that??

3677124c9d4d768da64a55d5bebf578e.png
Posted
I don't need help with the sliding anymore thanks CapY, I need to know how to check if a gridlist row already contains the same text how can i do that??

Why would you check if there is already an equal row, just clear the gridlist and load the information again.

guiGridListClear 

Posted
Because im getting the data for the list from a DB and it creates the row even if its got the same names
guiGridListGetItemText 

An example:

if guiGridListGetItemText ( gridlist element, row, column ) == 'yourtext' then 
-- do stuff 

' == ' checks is it equal or not.

Posted
for index, value in ipairs ( yourTable ) do 
     --Code 
end 

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
for row = 1, guiGridListGetRowCount ( theGridList ) do 
     -- Code here. 
end 

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
Thanks Solidsnake i know that but how do i get the rows into a table?

Maybe you mean gridlist?

http://vk.com/the_kenix

Вопросы задавайте на форуме, не пишите мне в личку.

Please don't pm me.

Posted

Ok that would work but when the gridlist first comes up its empty so i tried doing it like this;

  
addEvent("UpdateLocation",true) 
function updateLocations(location) 
local amount = guiGridListGetRowCount ( locationsList ) or 1 
for row = 1, amount do 
if guiGridListGetItemText ( locationsList, row, 1 ) == location then 
else 
local row = guiGridListAddRow(locationsList) 
guiGridListSetItemText ( locationsList, row, 1, location, false, false ) 
end 
end 
end 
addEventHandler("UpdateLocation", getLocalPlayer(),updateLocations) 
  

It doesn't give an error and doesn't show any rows :P

And Kenix i meant how could i make a table out of all the rows in the gridlist

3677124c9d4d768da64a55d5bebf578e.png
Posted
addEvent ( "UpdateLocation", true ) 
function updateLocations ( location ) 
    local amount = guiGridListGetRowCount ( locationsList ) or 1 
    for row = 1, amount do 
        if ( guiGridListGetItemText ( locationsList, row, 1 ) ~= location ) then 
            local row = guiGridListAddRow ( locationsList ) 
            guiGridListSetItemText ( locationsList, row, 1, location, false, false ) 
        end 
    end 
end 
addEventHandler ( "UpdateLocation", localPlayer, updateLocations ) 

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

That still doesn't create any rows, It created them before i added the 3 lines under function but there was copies of the same location in the gridlist.

3677124c9d4d768da64a55d5bebf578e.png
Posted

What is "location" argument? a string?

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
addEvent ( "UpdateLocation", true ) 
function updateLocations ( location ) 
    outputChatBox ( type ( location ) ..": ".. tostring ( location ) ) 
    local amount = guiGridListGetRowCount ( locationsList ) or 1 
    for row = 1, amount do 
        if ( guiGridListGetItemText ( locationsList, row, 1 ) ~= location ) then 
            local row = guiGridListAddRow ( locationsList ) 
            guiGridListSetItemText ( locationsList, row, 1, location, false, false ) 
        end 
    end 
end 
addEventHandler ( "UpdateLocation", localPlayer, updateLocations ) 

Tell me what does it output in the chat.

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 (edited)

maybe here's the problem

 addEventHandler ( "UpdateLocation", localPlayer, updateLocations ) 

shouldn't it be like this?

 addEventHandler ( "UpdateLocation", getRootElement(), updateLocations )  

Edited by Guest

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...