<settings> <!-- ***************************************************** All these settings are adjustable in the Admin Panel: 1. start admin 2. press 'p' 3. select Resources tab 4. double click on resource name ***************************************************** -->
<setting name="*presetID" value="2" friendlyname="Preset ID" group="Display" accept="1-4" examples="1" desc="ID of the preset to use, between 1 and 4" />
<setting name="*admingroup" value="Admin,SuperModerator" friendlyname="Admin group list" group="_Advanced" accept="*" examples="Admin,Moderator,SuperModerator" desc="To issue certain commands, the player must belong to one of the groups listed." /> </settings> </meta>
2) Создаём "help.xml", и в него вставляем код:
Код
<help> Admins ---------- /skidmarks 1 - Thick dark /skidmarks 2 - Subtle dark colored /skidmarks 3 - Bright /skidmarks 4 - Too bright
Change other settings in the Admin panel 'Resources' tab. (Double click on 'skidmarks') </help>
3) Создаём "c_skidmarks.lua", и в него вставляем код:
Код
-- -- c_skidmarks.lua --
g_Settings = {}
local myShader local Settings = {} Settings.var = {}
-- Version check if getVersion ().sortable < "1.1.0" then if verbose then outputChatBox( "Resource is not compatible with this client." ) end return end
if not myShader then if verbose then outputChatBox( "Could not create shader. Please use debugscript 3" ) end else if verbose then outputChatBox( "Using technique " .. tec ) end
engineApplyShaderToWorldTexture ( myShader, "particleskid" ) selectPreset(g_Settings.presetID) end end )
----------------------------------------------------------------------------- -- Settings from server ----------------------------------------------------------------------------- addEvent( "onClientUpdateSettings", true ) addEventHandler( "onClientUpdateSettings", resourceRoot, function(settings) g_Settings = settings selectPreset(g_Settings.presetID) end )
----------------------------------------------------------------------------- -- Select preset ----------------------------------------------------------------------------- function selectPreset(id) if id==1 then setTypeBlack() elseif id==2 then setTypeSubtle() elseif id==3 then setTypeBright() elseif id==4 then setTypeTooBright() end applySettings() end
----------------------------------------------------------------------------- -- Presets ----------------------------------------------------------------------------- function setTypeBlack() local v = Settings.var v.hue1=0.00 v.hue2=0.00 v.hue3=0.00 v.hue4=0.00 v.alpha1=1.00 v.alpha2=0.84 v.alpha3=0.71 v.alpha4=0.55 v.saturation=1.00 v.lightness=0.00 v.pos_changes_hue=0.00 v.time_changes_hue=0.00 v.filth=1.00 end
function setTypeSubtle() local v = Settings.var v.hue1=0.00 v.hue2=0.00 v.hue3=0.00 v.hue4=0.00 v.alpha1=1.00 v.alpha2=0.83 v.alpha3=0.63 v.alpha4=0.40 v.saturation=1.00 v.lightness=0.070 v.pos_changes_hue=0.21 v.time_changes_hue=0.02 v.filth=1.00 end
function setTypeBright() local v = Settings.var v.hue1=0.00 v.hue2=0.00 v.hue3=0.00 v.hue4=0.00 v.alpha1=1.00 v.alpha2=0.84 v.alpha3=0.71 v.alpha4=0.55 v.saturation=1.00 v.lightness=0.66 v.pos_changes_hue=0.06 v.time_changes_hue=0.06 v.filth=1.00 end
function setTypeTooBright() local v = Settings.var v.hue1=0.00 v.hue2=0.02 v.hue3=0.06 v.hue4=0.11 v.alpha1=1.00 v.alpha2=0.84 v.alpha3=0.71 v.alpha4=0.55 v.saturation=1.00 v.lightness=0.66 v.pos_changes_hue=0.39 v.time_changes_hue=0.13 v.filth=0.06 end
----------------------------------------------------------------------------- -- Apply settings ----------------------------------------------------------------------------- function applySettings() if not myShader then return end local v = Settings.var dxSetShaderValue( myShader, "sHSVa1", v.hue1, v.saturation, v.lightness, v.alpha1 ) dxSetShaderValue( myShader, "sHSVa2", v.hue2, v.saturation, v.lightness, v.alpha2 ) dxSetShaderValue( myShader, "sHSVa3", v.hue3, v.saturation, v.lightness, v.alpha3 ) dxSetShaderValue( myShader, "sHSVa4", v.hue4, v.saturation, v.lightness, v.alpha4 ) dxSetShaderValue( myShader, "sPosAmount", v.pos_changes_hue ) dxSetShaderValue( myShader, "sSpeed", v.time_changes_hue ) dxSetShaderValue( myShader, "sFilth", v.filth ) end
4) Создаём "s_skidmarks.lua", и в него вставляем код:
Код
-- -- s_skidmarks.lua --
g_Settings = {}
----------------------------------------------------------------------------- -- onClientReady ----------------------------------------------------------------------------- addEvent( "onClientReady", true ) addEventHandler( "onClientReady", resourceRoot, function() -- Send initial settings to player sendSettings( client ) end )
----------------------------------------------------------------------------- -- Command ----------------------------------------------------------------------------- addCommandHandler( "skidmarks", function ( player, command, arg1, arg2 ) if isPlayerInACLGroup(player, g_Settings.admingroup ) then if selectPreset(arg1) then outputChatBox( "Setting changed to " .. tostring(arg1), player ) else outputChatBox( "Incorrect input for command", player ) end else outputChatBox( "You are not in the correct ACL group", player ) end end )
----------------------------------------------------------------------------- -- Change preset ----------------------------------------------------------------------------- function selectPreset( id ) local id = tonumber(id) if id and id >= 1 and id <= 4 then set('presetID',id) -- Send updated settings to all players cacheSettings () sendSettings () return true end return false end
--------------------------------------------------------------------------- -- -- Settings -- --------------------------------------------------------------------------- function cacheSettings() g_Settings = {} g_Settings.presetID = getNumber('presetID',1) g_Settings.admingroup = getString('admingroup','Admin') end
-- Send initial settings to player addEvent( "onClientReady", true ) addEventHandler( "onClientReady", resourceRoot, function() sendSettings( client ) -- Turn shader on at client now local verbose = getTickCount() - resourceStartTime < 5000 triggerClientEvent ( client, "onClientStartShader", resourceRoot, verbose ) end )
-- React to admin panel changes addEventHandler('onSettingChange', resourceRoot, function(name, oldvalue, value) cacheSettings() sendSettings() end )
-- Send settings to one client or all of them function sendSettings( target ) triggerClientEvent ( target or root, "onClientUpdateSettings", resourceRoot, g_Settings ) end
5) Создаём "util.lua", и в него вставляем код:
Код
-- -- util.lua -- client and server file --
----------------------------------------------------------------------------- -- Util ----------------------------------------------------------------------------- function isPlayerInACLGroup(player, groupName) local account = getPlayerAccount(player) if not account then return false end local accountName = getAccountName(account) for _,name in ipairs( split(groupName,string.byte(',')) ) do local group = aclGetGroup(name) if group then for i,obj in ipairs(aclGroupListObjects(group)) do if obj == 'user.' .. accountName or obj == 'user.*' then return true end end end end return false end
-- get string or default function getString(var,default) local result = get(var) if not result then return default end return tostring(result) end
-- get number or default function getNumber(var,default) local result = get(var) if not result then return default end return tonumber(result) end
-- get true or false or default function getBool(var,default) local result = get(var) if not result then return default end return result == 'true' end
6) Создаём "mta-helper.fx", отвкрываем любым текстовым редактирором, и вставляем в него код:
Код
// // mta-helper.fx // // File version: 0.0.1 // Date updated: 2011-09-26 // // Big file of doom containg most of the stuff you need to get shaders working with MTA //
// // This file has 4 sections: // 1. Variables // 2. Renders states (parital - includes only those that are used the most) // 3. Helper functions // 4. Normal generation //
//--------------------------------------------------------------------- // These parameters are set by MTA whenever a shader is drawn //---------------------------------------------------------------------
//--------------------------------------------------------------------- // The parameters below mirror the contents of the D3D registers. // They are only relevant when using engineApplyShaderToWorldTexture. //---------------------------------------------------------------------
//------------------------------------------------------------------------------------------ // renderState (partial) - String value should be one of D3DRENDERSTATETYPE without the D3DRS_ http://msdn.microsoft.com/en-us/library/bb172599%28v=vs.85%29.aspx //------------------------------------------------------------------------------------------
int gLighting < string renderState="LIGHTING"; >; // = 137,
int gDiffuseMaterialSource < string renderState="DIFFUSEMATERIALSOURCE"; >; // = 145, int gSpecularMaterialSource < string renderState="SPECULARMATERIALSOURCE"; >; // = 146, int gAmbientMaterialSource < string renderState="AMBIENTMATERIALSOURCE"; >; // = 147, int gEmissiveMaterialSource < string renderState="EMISSIVEMATERIALSOURCE"; >; // = 148,
//------------------------------------------------------------------------------------------ // materialState - String value should be one of the members from D3DMATERIAL9 http://msdn.microsoft.com/en-us/library/bb172571%28v=VS.85%29.aspx //------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------ // textureState (partial) - String value should be a texture number followed by 'Texture' //------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------ // MTAUnlerp // - Find a the relative position between 2 values //------------------------------------------------------------------------------------------ float MTAUnlerp( float from, float to, float pos ) { if ( from == to ) return 1.0; else return ( pos - from ) / ( to - from ); }
//------------------------------------------------------------------------------------------ // MTACalcScreenPosition // - Transform vertex position for the camera //------------------------------------------------------------------------------------------ float4 MTACalcScreenPosition( float3 InPosition ) { float4 posWorld = mul(float4(InPosition,1), gWorld); float4 posWorldView = mul(posWorld, gView); return mul(posWorldView, gProjection); }
//------------------------------------------------------------------------------------------ // MTACalcWorldPosition // - Transform position by current world matix //------------------------------------------------------------------------------------------ float3 MTACalcWorldPosition( float3 InPosition ) { return mul(float4(InPosition,1), gWorld).xyz; }
//------------------------------------------------------------------------------------------ // MTACalcWorldNormal // - Rotate normal by current world matix //------------------------------------------------------------------------------------------ float3 MTACalcWorldNormal( float3 InNormal ) { return mul(InNormal, (float3x3)gWorld); }
//------------------------------------------------------------------------------------------ // MTACalculateCameraDirection // - Get camera direction to a world point //------------------------------------------------------------------------------------------ float3 MTACalculateCameraDirection( float3 CamPos, float3 InWorldPos ) { return normalize( InWorldPos - CamPos ); }
//------------------------------------------------------------------------------------------ // CalcCameraDistance // - Get camera distance from a world point //------------------------------------------------------------------------------------------ float MTACalcCameraDistance( float3 CamPos, float3 InWorldPos ) { return distance( InWorldPos, CamPos ); }
// // Declare '#define GENERATE_NORMALS' before this file is included to tell MTA to generate vertex normals if required //
//--------------------------------------------------------------------- // Flags for MTA to do something about //--------------------------------------------------------------------- int CUSTOMFLAGS < #ifdef GENERATE_NORMALS string createNormals = "yes"; // Some models do not have normals by default. Setting this to 'yes' will add them to the VertexShaderInput as NORMAL0 #endif string skipUnusedParameters = "yes"; // This will make the shader a bit faster >;
//------------------------------------------------------------------------------------------ // MTAFixUpNormal // - Make sure the normal is valid //------------------------------------------------------------------------------------------ void MTAFixUpNormal( in out float3 OutNormal ) { // Incase we have no normal inputted if ( OutNormal.x == 0 && OutNormal.y == 0 && OutNormal.z == 0 ) OutNormal = float3(0,0,1); // Default to up }
7) Создаём "skidmarks.fx", отвкрываем любым текстовым редактирором, и вставляем в него код:
Код
// // skidmarks.fx //
//--------------------------------------------------------------------- // Skidmarks settings //--------------------------------------------------------------------- float4 sHSVA1 = float4( 0, 1, 1, 1); // HSV + Alpha for each of the 4 layers float4 sHSVA2 = float4( 0.25, 1, 1, 0.75); float4 sHSVA3 = float4( 0.5, 1, 1, 0.5); float4 sHSVA4 = float4( 0.75, 1, 1, 0.25); float sPosAmount = 0; // How much the position changes the color float sSpeed = 0; // How much the time changes the color float sFilth = 0; // Amount of random black patches
//--------------------------------------------------------------------- // Include some common stuff //--------------------------------------------------------------------- #include "mta-helper.fx"
//--------------------------------------------------------------------- // Sampler for the main texture //--------------------------------------------------------------------- sampler Sampler0 = sampler_state { Texture = (gTexture0); };
//--------------------------------------------------------------------- // Structure of data sent to the vertex shader //--------------------------------------------------------------------- struct VSInput { float3 Position : POSITION0; float4 Diffuse : COLOR0; float2 TexCoord : TEXCOORD0; };
//--------------------------------------------------------------------- // Structure of data sent to the pixel shader ( from the vertex shader ) //--------------------------------------------------------------------- struct PSInput { float4 Position : POSITION0; float4 Diffuse : COLOR0; float2 TexCoord : TEXCOORD0; };
Почему у меня такие блеклые следы ? Как обычные тормозные пути, только с фиолетовым оттенком(( Посоветуйте, что делать. Все команды пробовал что в моде, но почти ничего не поменялось...
Почему у меня такие блеклые следы ? Как обычные тормозные пути, только с фиолетовым оттенком(( Посоветуйте, что делать. Все команды пробовал что в моде, но почти ничего не поменялось...