Liberty Unleashed
Scripting => Script Help => Topic started by: xxxMDjxxx on October 16, 2011, 09:21:23 am
-
Hm, how could i make a object, lets say a fence and put it in front a driveway of a house, and make it dissapear with a command like /open and when i send /close the fence will apear again?
I would put a gate at the enterance to a mansion..
-
Make a global var that holds the fence:
[code]
oFence <- CreateObject( ModelID, Vector );
You can add that to onScriptLoad();
Then when you use the open command:
else if ( cmd == "open" )
{
oFence.VirtualWorld = 2;
return 1;
}
Then with the close command it will be:
else if ( cmd == "close" )
{
oFence.VirtualWorld = 0;
return 1;
}
You could add some more protection, like checking if you are really standing near the fence etc.[/code]
-
hmm.. not realy working...
-
"not really working..." wtf does that support to mean?
Give us some more details! Does it give any error, what did you try to fix it.
With a reply "its not working" we can't do much..
-
"not really working..." wtf does that support to mean?
Give us some more details! Does it give any error, what did you try to fix it.
With a reply "its not working" we can't do much..
Hehe, sorry...
Well the object is shown, but it doesent "dissapear"...
There are no errors in the server window.
the code is:
function onScriptLoad()
{
CreateSphere( Vector( 194.33, -1195.3, 26.16 ), 3.0, Colour( 0, 136, 255 ) )
oFence <- CreateObject( 1281, Vector( 844.1, -419.5, 14.97 ) )
return 1;
}
function onPlayerEnterSphere( player, sphere )
if ( sphere.ID == 12 )
{
MessagePlayer( "Anticefur CENTER:", player, 0, 136, 255 );
MessagePlayer( "Owner: xXxMDjxXx", player, 0, 136, 255 );
MessagePlayer( "Odkup: NONE", player, 0, 136, 255 );
MessagePlayer( "Najem: NONE", player, 0, 136, 255 );
MessagePlayer( "Vsebuje: orozja, vozila, parkirna hisa, ograja", player, 0, 136, 255 );
return 1;
}
else if ( cmd == "accso" )
{
oFence.VirtualWorld = 2;
return 1;
}
else if ( cmd == "accsz" )
{
oFence.VirtualWorld = 0;
return 1;
}
I made a property on my server, so when someone walks over the sphere they see the text (owner, cost, cars etc...)
And to prevent my cars from being stolen i wanted to make a gate, which would be "remote controled" so only people with the code could open the gates and dive with my cars...
-
Those commands should be in the event onPlayerCommand.
-
try this:
Nope, now the fence doesent even isnt showing up, no sphere too... Idk. what the hell is wrong with this script, i thought it could be done... No errors in the conslole eather...
-
try this:
function onScriptLoad()
{
CreateSphere( Vector( 194.33, -1195.3, 26.16 ), 3.0, Colour( 0, 136, 255 ) )
oFence <- CreateObject( 1281, Vector( 844.1, -419.5, 14.97 ) )
return 1;
}
function onPlayerEnterSphere( player, sphere )
if ( sphere.ID == 12 )
{
MessagePlayer( "Anticefur CENTER:", player, 0, 136, 255 );
MessagePlayer( "Owner: xXxMDjxXx", player, 0, 136, 255 );
MessagePlayer( "Odkup: NONE", player, 0, 136, 255 );
MessagePlayer( "Najem: NONE", player, 0, 136, 255 );
MessagePlayer( "Vsebuje: orozja, vozila, parkirna hisa, ograja", player, 0, 136, 255 );
return 1;
}
function onPlayerCommand( player, cmd )
{
if ( cmd == "accso" )
{
oFence.VirtualWorld = 2;
return 1;
}
else if ( cmd == "accsz" )
{
oFence.VirtualWorld = 0;
return 1;
}
Actualy now i get an error ...:
COMMAND: xxxmdjxxx: accso
AN ERROR HAS OCCURED [wrong number of parameters]
CALLSTACK
LOCALS
COMMAND: xxxmdjxxx: accsz
AN ERROR HAS OCCURED [wrong number of parameters]
CALLSTACK
LOCALS
the script
function onScriptLoad()
{
CreateSphere( Vector( 194.33, -1195.3, 26.16 ), 3.0, Colour( 0, 136, 255 ) )
oFence <- CreateObject( 1289, Vector( 844.1, -419.5, 14.97 ) )
return 1;
}
function onPlayerEnterSphere( player, sphere )
if ( sphere.ID == 12 )
{
MessagePlayer( "Anticefur CENTER:", player, 0, 136, 255 );
MessagePlayer( "Owner: xXxMDjxXx", player, 0, 136, 255 );
MessagePlayer( "Odkup: 100€", player, 0, 136, 255 );
MessagePlayer( "Najem: 1€", player, 0, 136, 255 );
MessagePlayer( "Vsebuje: orozja, vozila, parkirna hisa, ograja", player, 0, 136, 255 );
return 1;
}
function onPlayerCommand( player, cmd )
{
if ( cmd == "accso" )
{
oFence.VirtualWorld = 2;
return 1;
}
else if ( cmd == "accsz" )
{
oFence.VirtualWorld = 1;
return 1;
}}
PS. Ja sam iz SLO, lijep pozdrav D.Mandi?
-
function onScriptLoad()
{
CreateSphere( Vector( 194.33, -1195.3, 26.16 ), 3.0, Colour( 0, 136, 255 ) );
oFence <- CreateObject( 1289, Vector( 844.1, -419.5, 14.97 ) );
return 1;
}
function onPlayerEnterSphere( player, sphere )
{
if ( sphere.ID == 12 )
{
MessagePlayer( "Anticefur CENTER:", player, 0, 136, 255 );
MessagePlayer( "Owner: xXxMDjxXx", player, 0, 136, 255 );
MessagePlayer( "Odkup: 100€", player, 0, 136, 255 );
MessagePlayer( "Najem: 1€", player, 0, 136, 255 );
MessagePlayer( "Vsebuje: orozja, vozila, parkirna hisa, ograja", player, 0, 136, 255 );
}
return 1;
}
function onPlayerCommand( player, command, params )
{
local cmd = command.tolower();
if ( cmd == "accso" )
{
if ( oFence ) oFence.VirtualWorld = 2;
}
else if ( cmd == "accsz" )
{
if ( oFence ) oFence.VirtualWorld = 0;
}
return 1;
}
-
If you assign the object an ID # and stored it in a database, you could use the functions to remove it after via that same ID. Stormeus did that as a test on a server we are developing and it seems to work well.