Jump to content

find String rename


Fabioxps

Recommended Posts

You cannot rename directories as Multi Theft Auto views all resources in a flat structure and not within directory categories. Although re-reading your post it seems you're modifying the name of the map, and not the folder it resides inside.

Use

string.gsub(mapName, "[old]", "[OLDS]") 

Link to comment

that's right?

function initRace(vehicle, checkpoints, objects, pickups, mapoptions, ranked, duration, gameoptions, mapinfo, playerInfo) 
    outputDebug( 'MISC', 'initRace start' ) 
    unloadAll() 
     
    g_Players = getElementsByType('player') 
    g_MapOptions = mapoptions 
    g_GameOptions = gameoptions 
    g_MapInfo = mapinfo 
    g_PlayerInfo = playerInfo 
    triggerEvent('onClientMapStarting', g_Me, mapinfo ) 
removeEventHandler("onClientPreRender",root, boladona) 
setWaveHeight ( 0 ) 
setHeatHaze ( 0 ) 
    nextMapSet(false) 
    --addEventHandler("onClientRender",getRootElement(),drawRadarS) 
  
                showPlayerHudComponent ("radar",true) 
            showPlayerHudComponent ("crosshair",true) 
    fadeCamera(true) 
    showHUD(false) 
     
    g_Vehicle = vehicle 
    setVehicleDamageProof(g_Vehicle, true) 
    OverrideClient.updateVars(g_Vehicle) 
     
    --local x, y, z = getElementPosition(g_Vehicle) 
    setCameraBehindVehicle(vehicle) 
    --alignVehicleToGround(vehicle) 
    updateVehicleWeapons() 
    setCloudsEnabled(g_GameOptions.cloudsenable) 
    setBlurLevel(g_GameOptions.blurlevel) 
    g_dxGUI.mapdisplay:visible(g_GameOptions.showmapname) 
    if engineSetAsynchronousLoading then 
        engineSetAsynchronousLoading( g_GameOptions.asyncloading ) 
    end 
string.gsub(mapName, "[old]", "[OLDS]") 
    g_dxGUI.mapdisplay:text("#a0ff00Map: #ffffff"..g_MapInfo.name) 
  
  

Link to comment

string library have some special characters call'd "magic characters" : ( ) . % + - * ? [ ^ $

So when you are using "string.gsub(mapName, "[old]", "[OLDS]")" then "[]" are seend as magic characters and not as a character.

To make string.gsub to use this "magic characters" as normal characters you need to put in front of them a "%".

  
string.gsub(mapName, "%[old%]", "[OLDS]") 
  

Link to comment

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