Jump to content

Open a map from .zip file ?


Guest Guest26901

Recommended Posts

Posted

Hey all !

How to open map from .zip file ? I did something like this:

  
local files = { "maps/edos.zip", "maps/shootermcqueen.zip" } 
  
function openNextMap() 
    local randomFile = files[math.random(#files)] 
    --local hFile = fileOpen(randomFile, true) 
    if randomFile then 
        outputDebugString("File opened! //random_maps.lua") 
        startResource(randomFile) 
    else 
        outputDebugString("Unable to open files - maps! //random_maps.lua") 
    end 
end 
addEventHandler("onResourceStart", getRootElement(), openNextMap) 
  

Posted

You don't need to define the folder, nor the .zip, also, these are resource names or file names? because you need to specify the file name to open.

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

Are you sure about that? because that looks like they are resources.

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

These are resources.

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

So I made ​​a mistake. Honestly, I did not know that. ;d So, what i must do now ?

Posted

I'm not really sure what are you trying to do.

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

Use:

getResourceFromName 
startResource 

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

Ehh, i know that, but what i have to enter between the ( ) ? ;d

getResourceFromName( ??? )

Posted
local resources = { "edos", "shootermcqueen" } 
  
function openNextMap ( ) 
    local randomResource = resources [ math.random ( #resources ) ] 
    if ( randomResource ) then 
        outputDebugString ( "File opened! //random_maps.lua" ) 
        startResource ( getResourceFromName ( randomResource ) ) 
    else 
        outputDebugString ( "Unable to open files - maps! //random_maps.lua" ) 
    end 
end 
addEventHandler ( "onResourceStart", resourceRoot, openNextMap ) 

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

I have a zip files in the same directory as the resource. Error: Bad argument @ 'startResource'.

Posted

I don't understand, if these two are resource files, it should work.

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

Hold on, these .zip files are inside another resource? if so, then you can't load them.

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

These .zip files are inside in the same resource as function openNextMap().

Posted

You can't load them, you can maybe decompress the files and load them, but you can't load a .zip file.

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.

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