Ownage Owls
Archive => MTA Development => Tutorials => Topic started by: MxRstyle on Jan 9, 2011, 17:09:57
-
To change the watercolor in a map:
1# Create a .lua file using any kind of program, for example, notepad
2# name it as client.lua
3# in your meta.xml file copy this
<script src="client.lua" type="client" />
so it should be like this:
<meta>
<script src="client.lua" type="client" />
<info gamemodes="race" type="map" name="Your map name" author="your name" version="1.0.0" />
<map src="yourmapname.map" dimension="0" />
<settings>
<setting name="#skins" value='[ "random" ]' />
<setting name="#maxplayers" value="[ 32 ]" />
<setting name="#gamespeed" value="[ 1 ]" />
<setting name="#ghostmode" value='[ "false" ]' />
<setting name="#time" value="12:0" />
<setting name="#vehicleweapons" value='[ "true" ]' />
<setting name="#minplayers" value="[ 0 ]" />
<setting name="#weather" value="[ 0 ]" />
<setting name="#gravity" value="[ 0.008000 ]" />
<setting name="#waveheight" value="[ 0 ]" />
<setting name="#respawntime" value="[ 5 ]" />
<setting name="#locked_time" value="[ false ]" />
<setting name="#duration" value="[ 600 ]" />
<setting name="#respawn" value='[ "none" ]' />
</settings>
</meta>
4# open the client.lua and copy this:
setWaterColor(0,0,0) -- in rgb colours
5# Save it and test the map, it must work!
To change textures:
1# - 3# same as above.
4# open the client.lua and copy this:
function start ()
txd = engineLoadTXD("texturenamegoeshere.txd") -- change texturenamegoeshere for your txd file name
engineImportTXD(txd, 0000 ) -- 0000 represents the object id which you want to replace
end
addEventHandler( "onClientResourceStart", getResourceRootElement(getThisResource()), start )
5# run it
-
Can you make colSphere that works corectly?
what script do, if you goes out of that sphere you die...
henk = createColSphere ( 2613,-4258,3000, 300 )
that is position of sphere X,Y,Z and 300 is size of sphere
whole script:
function start()
henk = createColSphere ( 2613,-4258,3000, 300 )
end
addEventHandler("onClientResourceStart",getRootElement(),start )
function koeksnor ()
setElementHealth ( getLocalPlayer(), 0 )
end
addEventHandler ( "onClientColShapeLeave",getRootElement(), koeksnor )
but everytime you pickup the repair everybody die, wtf
-
guys, you can always ask me if you have any questions about scripting.
The Problem with your code, Mill, is that you attached the 'onClientColShapeLeave'-Event to the root-element, which means that it is triggered for every colshape, not only for the one you just created.
Working way should be:
function start()
local henk = createColSphere( 2613, -4258, 3000, 300 );
addEventHandler( 'onClientColShapeLeave', henk, koeksnor, false );
end;
addEventHandler( 'onClientResourceStart', getResourceRootElement(), start );
function koeksnor ()
setElementHealth(getLocalPlayer(), 0);
end;
-
nice mdbelen it works, tnx alot
-
Try this, works better^^
addEventHandler( 'onClientResourceStart', getResourceRootElement(),
function()
addEventHandler( 'onClientColShapeLeave', createColSphere( 2613, -4258, 3000, 300 ),
function(theElement, matchingDimension)
if (matchingDimension) and (theElement==getLocalPlayer()) then
setElementHealth(theElement, 0);
end;
end, false );
end );