Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- this script will fix all MTA:SA race maps which contain the respawn node.
- function fixRespawnMaps( )
- local count = 0
- for _, v in pairs( exports.mapmanager:getMapsCompatibleWithGamemode( exports.mapmanager:getRunningGamemode( ) ) ) do
- local main = xmlLoadFile( ":"..getResourceName( v ).."/meta.xml" )
- if main then
- settings = xmlFindChild( main,"settings",0 )
- local node = xmlFindChild( settings, "setting", 0 )
- local i = 1
- while node do
- if (xmlNodeGetAttribute( node, "value" ) ~= "none") then
- xmlNodeSetAttribute( node,"value","none" )
- xmlSaveFile(main)
- end
- node = xmlFindChild( v, "setting", i )
- i = i + 1
- end
- count = count + 1
- xmlUnloadFile(main)
- end
- end
- return count
- end
- Example:
- addCommandHandler( "fixAllMaps",
- function( player )
- if hasObjectPermissionTo( player,"function.setServerPassword",true ) then
- outputChatBox( "(MAPFIX) You have fixed #FFFFFF"..tostring( fixRespawnMaps( ) ).."#FF6464 maps!",player,255,100,100,true )
- else
- outputChatBox( "(MAPFIX) You don't have the required rights to perform this action!",player,255,100,100 )
- end
- end
- )
Advertisement
Add Comment
Please, Sign In to add comment