Fabioxps Posted September 17, 2013 Share Posted September 17, 2013 if the name of the map and [old] to rename [OLDS] function ismapDM(isim) if string.find(isim, "[old]", 1, true) then return string.find(isim, "[OLDS]", 1, true) end end ? Link to comment
Blaawee Posted September 17, 2013 Share Posted September 17, 2013 Are you mean renaming the resource name ? if so renameResource If you are trying find [ old school map ] use this function function ismapNameOLDS( mapName ) return mapName:find( '[old]', 1, true ) or mapName:find( '[OLDS]', 1, true ) end Link to comment
qaisjp Posted September 17, 2013 Share Posted September 17, 2013 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
Fabioxps Posted September 17, 2013 Author Share Posted September 17, 2013 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
Fabioxps Posted September 18, 2013 Author Share Posted September 18, 2013 test it does not work Link to comment
xXMADEXx Posted September 18, 2013 Share Posted September 18, 2013 test it does not work Read /debugscript 3. Link to comment
bandi94 Posted September 18, 2013 Share Posted September 18, 2013 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
Fabioxps Posted September 18, 2013 Author Share Posted September 18, 2013 fixed ty "puma" and all Link to comment
qaisjp Posted September 18, 2013 Share Posted September 18, 2013 no problem. also they're not called magic characters, they're called special characters Link to comment
bandi94 Posted September 19, 2013 Share Posted September 19, 2013 no problem.also they're not called magic characters, they're called special characters Then please go and tell to the LUA dev's that they write it wrong on the lua.org http://www.lua.org/pil/20.2.html Some characters, called magic characters, have special meanings when used in a pattern. The magic characters are ( ) . % + - * ? [ ^ $ Link to comment
qaisjp Posted September 19, 2013 Share Posted September 19, 2013 Whoah, keep your offense down! By the way, the Lua dev's didn't create the PIL, iirc. still called special characters, magic characters are for the stupid Link to comment
bandi94 Posted September 19, 2013 Share Posted September 19, 2013 A Concerned Citizen , KK you are good , lua.org is bad . Link to comment
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