Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Flockshot

Pages: [1] 2
1
Script Discussion / Re: Can we use XML for 0.4?
« on: October 13, 2014, 05:56:16 pm »
I dont know about XML but you can use .ini file if you want to save location

save by
Code: [Select]
WriteIniString( "yourfile.ini", "Position", "Pos", format( "%.4f %.4f %.4f", player.Pos.x, player.Pos.y, player.Pos.z ) );
and get by
Code: [Select]
local coord = ReadIniString( "yourfile.ini", "Position", "Pos" );

They are from Warcheif.

If you want a timer that save the pos automaticly than you also have to make a integer outside the timer and add 1 to it at the end of timer.

Code: [Select]
local i=0;

function mytimer(player)
{
WriteIniString( "yourfile.ini", "Position" + i, "Pos" + i , format( "%.4f %.4f %.4f", player.Pos.x, player.Pos.y, player.Pos.z ) );
i++
}
dont forget to add i in the Position and Pos.we add it so the name dont match with any previous save as it will replace the previous other than making a new.
For reading u will use a for loop and u will ++ the number and get the positon.
also dont forget to split it in x,y,z
by
Code: [Select]
local splitpos = split( coord, " " );
local pos = Vector(split[0].tofloat(), split[1].tofloat(), split[2].tofloat());

2
Script Releases / Re: Mansion Gate
« on: October 12, 2014, 08:41:25 am »
By releasing this script to the public, you will help many newbies. :)
(I would use a class to create these gates, to make it easier, instead of this way)
But...  there is a problem. What happens if the gate is not id 0 ?Another object will move instead of the gate.

To fix that, note the object with an word like "mansiongate".
How you do that ? Like this:
Code: [Select]
mansiongate <- CreateObject(6000,0,Vector(-277, -495, 10),255);
Then you simply move it using:
Code: [Select]
mansiongate.MoveBy(Vector(-8,0,0), 2800);


By the way, it's good that it uses a global function as "MoveGate", for closing/opening the gate.
I suggest you to add one more parameter that will represent the gate (object), so you can use the same function for any gate you want. :P
Like this:
Code: [Select]
function MoveGate(player,gate,status)
{
   if(status="open")
   {
         obj.MoveBy(Vector(8,0,0), 2800);
   }
}


Hmm.
I have chnaged it now the function will work for any object and also i have created class for mansion gate.
player can add multiple gates in game and can only use one function.

3
Script Releases / Mansion Gate
« on: October 11, 2014, 07:38:51 pm »
Today i release a simple function
What it do is add a gate ,at the entrance of Mansion,which can open and close by hotkeys.

OnPlayerStart function.
we bind the key and create the gate here.Also we will make a global variable that tell us is gate open or close.
Code: [Select]
OnServerStart()
{
open <- false;
mansiongate <- CreateObject(6000,0,Vector(-277, -495, 10),255);

opengate <- BindKey(true,0x104F ,0,0); //The Key IS "O"
closegate <- BindKey(true,0x205A,0,0); //The Key IS "Z"
}

OnKeyDown function
where we will add our function.
Code: [Select]
function onKeyDown(player, bindid)
{
if(bindid==opengate)
{
if(open==false) MoveGate(player,mansiongate.ID,"open");
else MessagePlayer("Gate is already open.",player);
}

else if(bindid==closegate)
{
if(open==true) MoveGate(player,mansiongate.ID,"close");
else MessagePlayer("Gate is already closed.",player);
}
}

MoveGate function
we will open or close the gate here.
Code: [Select]
function MoveGate(player,gate, status)
{
local obj=FindObject(gate);
if(obj)
{
if(status=="open")
{


MessagePlayer("Opening Gate",player);
obj.MoveBy(Vector(8,0,0), 2800);
open=true;
}
else if(status=="close")
{

MessagePlayer("Closing Gate",player);
obj.MoveBy(Vector(-8,0,0), 2800);
open=false;

}
}
else MessagePlayer("Object could not be found.",player);
}

This is it for this function or
If you want to only use 1 key for both opening and closing then use this.

OnPlayerStart function.
Same just we dont bind the key "Z".
Code: [Select]
OnServerStart()
{
open <- false;
mansiongate <- CreateObject(6000,0,Vector(-277, -495, 10),255);

gate <- BindKey(true,0x104F ,0,0); //The Key IS "O"
}

OnKeyDown function
we will only use one key here.
Code: [Select]
function onKeyDown(player, bindid)
{
if(bindid==gate)
{
if(open==false) MoveGate(player,masiongate.ID,"open");
else MoveGate(player,mansiongate.ID,"close");
}

}


MoveGate function
Same func
Code: [Select]
function MoveGate(player,gate, status)
{
local obj=FindObject(gate);
if(obj)
{
if(status=="open")
{


MessagePlayer("Opening Gate",player);
obj.MoveBy(Vector(8,0,0), 2800);
open=true;
}
else if(status=="close")
{

MessagePlayer("Closing Gate",player);
obj.MoveBy(Vector(-8,0,0), 2800);
open=false;

}
}
else MessagePlayer("Object could not be found.",player);
}

Screenshots:



4
Bugs and Crashes / [Bug]Walking while driving pcj
« on: October 09, 2014, 03:44:21 pm »
Description:
Player have walking animation when driving pcj(dont know of other vehicles) without turning or stopping(without using right,left,down key).

Reproducible:
Always

What you were doing when the bug happened:
I just got freeze on pcj and then unfreeze.(Picked up a robbing pickup in vccnr)

What you think caused the bug:
Bad sync

Screenshot:


5
Script Releases / Re: Changeskin, paint - commands
« on: October 07, 2014, 08:28:52 pm »
Actually it depend on others, which colour they want to add. So i didn't added any :)
It depend on player when he know about it.These are good but i think player would also need a list of skins/colors according to ids so he can choose the skin/color he really want instead of trying from 0 to end of the ids.

6
Script Releases / Re: Changeskin, paint - commands
« on: October 07, 2014, 04:28:58 pm »
You added

Code: [Select]
text = text.tointeger();

when there is no need for it.
You can just simply do
Code: [Select]
player.Skin = text.tointeger();
veh.Colour1 = text.tointeger();

Also when you are making a variable of player.Vehicle and only using it once in
Code: [Select]
else if ( !veh )
when u dont use it here
Code: [Select]
player.Vehicle.Colour1 = text.tointeger();

Simple errors which make the server do more work.
Other than that its good.

7
Script Discussion / Re: using custom object as bullet
« on: October 03, 2014, 06:06:42 pm »
That's the code I posted.
Then that code should work.

8
Script Discussion / Re: using custom object as bullet
« on: October 03, 2014, 05:14:08 am »
If i remember correctly there was a ramp function in your,stormues test server that make a ramp in front of player
Is it possible to give me that.

9
Script Discussion / Re: using custom object as bullet
« on: October 02, 2014, 04:07:29 pm »
Code: [Select]
// [Ka]Juppi's func from http://forum.liberty-unleashed.co.uk/index.php/topic,398.0.html
function GetForwardPoint( pos, angle ) // you must pass an angle in degrees
{
local rad = angle * PI / 180; // we convert to radians
                local x = pos.x, y = pos.y;
local x2 = x + 1.0 * cos(rad) - 25.0 * sin(rad); // we calculate
local y2 = y + 1.0 * sin(rad) + 25.0 * cos(rad);
                return Vector( x2, y2, pos.z ); // return a vector
}

Object.MoveTo( GetForwardPoint( player.Pos, player.Angle ) )

Not tested, but it should give you an idea.

That just move the object in only 1 place no matter what the angle is.
About u saying that it can give me idea i cant understand it.

I dont know about PI,cos,sin i am just in class 8 and it haven't been taught to us.

10
Script Discussion / Re: Rotating Sprites
« on: October 02, 2014, 03:31:46 pm »
Hmm i also have this error but it shows error in console
Saying that cannot find member variable

11
Script Discussion / Re: using custom object as bullet
« on: October 02, 2014, 12:46:14 pm »
Anyone

12
Script Discussion / Re: using custom object as bullet
« on: September 30, 2014, 04:08:04 am »
I am good at math but dont know the equation to be used for it.


and i dont seem to find any on the forum.

13
Script Discussion / using custom object as bullet
« on: September 29, 2014, 06:35:56 pm »
I have an idea to use a custom object as a bullet but there is a problem.

I can make that object and also move it.But the problem is that how do I figure out in which direction to move.
For Example: I used it but i am pointing it a little away from straight but the object goes straight and missing the player.

Can anyone give any idea so that i can move object to where the player points.
I know its possible.

14
Script Releases / Re: gotoloc system
« on: September 28, 2014, 06:19:27 pm »
2. Don't save positions in a string, save the x y z as floats separately.
I agree with sving the x y z as floats but we can also add them in only one column . and we can use the split function.Saving saperatly will make 3 extra column in database

15
Script Releases / Re: Position System
« on: September 28, 2014, 06:16:07 pm »
Ouch, that will spawn an infinite timer every time a player presses F3 two times.
It's better if you use one, infinite timer that will loop through all the players and update the text if they have the system enabled. That way you'll only end up with one timer overall, instead of a million after your server has run for an hour or two.
In that case i will just make a infinite timer on server start.
Well updated the code

Pages: [1] 2