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.


Topics - Flockshot

Pages: [1]
1
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:



2
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:


3
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.

4
Script Releases / Position System
« on: September 27, 2014, 10:12:48 pm »
Hello Guys I present u with m Positioning System.

So what basically it do is that it shows you ur position + angle + district name at will.

Using F3 Key you can enable/disable it.

Images




Global Variable
Code: [Select]
local posofplr = []; //Place it in any file but out of any function because we want it to be a global variable not local.

OnServerStart
Code: [Select]
xyz <- BindKey(true,0x72,0,0); //we will bind key for it to make it easy for player, F3.
showpos <- array( GetMaxPlayers(), false );
NewTimer("PlayerPos", 300, 0); //starts the timer

OnPlayerJoin
Code: [Select]
posofplr.push({Player = player, x = null, y = null, z = null, angle = null, district=null}); //We will push the player in the array we created.

OnKeyDown
Code: [Select]
function onKeyDown(player, bindid)
{
   if(bindid == xyz ) // xyz because we named the binding to this name
   {
      if(!showpos[player.ID]) //player will have it false when it enters the game
      {
         showpos[player.ID] = true; //Means player has the position system on
         MessagePlayer("Showing Coordinates",player);
      }
      else
      {
         showpos[player.ID]= false; //If the positioning system was on and the key was press again it will disable
         
      }
     
   }
}

Timer
Code: [Select]
function PlayerPos()
{
foreach (val in posofplr)
{
local plr = val.Player;

if(plr)
{

if(showpos[plr.ID])
{
if (val.x != null) val.x.Delete();
if (val.y != null) val.y.Delete();
if (val.z != null) val.z.Delete();
if (val.angle != null) val.angle.Delete();
if (val.district != null) val.district.Delete();

val.x = CreateTextdraw("X: " + val.Player.Pos.x, 0, 300, 0xFFB0B0B0);
val.y = CreateTextdraw("Y: " + val.Player.Pos.y, 0, 315, 0xFFB0B0B0);
val.z = CreateTextdraw("Z: " + val.Player.Pos.z, 0, 330, 0xFFB0B0B0);
val.angle = CreateTextdraw("Angle: " + val.Player.Angle, 0, 345, 0xFFB0B0B0);
val.district = CreateTextdraw("District: " + GetDistrictName( val.Player.Pos.x, val.Player.Pos.y ), 0, 360, 0xFFB0B0B0);

if (val.x != null) val.x.ShowForPlayer(val.Player);
if (val.y != null) val.y.ShowForPlayer(val.Player);
if (val.z != null) val.z.ShowForPlayer(val.Player);
if (val.angle != null) val.angle.ShowForPlayer(val.Player);
if (val.district != null) val.district.ShowForPlayer(val.Player);
}
}
else
{
if (val.x != null){ val.x.Delete();
val.x = null;}

if (val.y != null){ val.y.Delete();
val.y = null;}

if (val.z != null){ val.z.Delete();
val.z = null;}

if (val.angle != null){ val.angle.Delete();
val.angle = null;}

if (val.district != null){ val.district.Delete();
val.district = null;}
}
}
}

This is it for the Positioning system

Example Script: https://www.mediafire.com/?a6k18yne5m35ket

Special Thanks to : S.L.C for teaching me how to use the .push thingy.

5
Script Discussion / Changeable Text Sprites?
« on: September 21, 2014, 04:12:17 am »
I would like to know that is there a way to use text for sprites.
Not talking about textdraw but the sprites itself.

Like if i wanted to show how much fuel is left and give it percentage then i would have to make 100 sprites 1 for all numbers.
Is there a way that we can only use one sprite and we can write and show text or numbers with it.

I dont want to use the textdraw as they are very small in size.

6
Vice City / Gta .dff and .col file
« on: September 20, 2014, 04:17:45 pm »
As vcmp 0.4 has the feature to add in objects to server i wanted to make my own object but couldnt do so as there is no tutorial that i can find helps me i have tried various of tutorials but failed.
I can make .dff file easily but dont know about the .col file and how to make it and use it.
Can anyone tell me how can i make .dff and .col files which works.

7
Script Discussion / player.AddSpeed(Vector x,y,z)
« on: September 20, 2014, 01:51:31 pm »
What does the player.AddSpeed(Vector x,y,z) function do.
I am a little curious about it.I tried it by giving the x,y,z the value of 20 but the player only went above in sky and then fall.
Nothing else happend.

What is the advantage of it and how can we use it.

8
Script Releases / [Snippet]Player Fps
« on: September 19, 2014, 09:48:03 pm »
Many People view there Fps during the game without using any other software so this is a very simple function to do so

Code: [Select]
//Global Variable
local fps = [];

//Fps Function
function PlayerFps()
{
foreach (val in fps)
{
if (val.Text != null) val.Text.Delete();
val.Text = CreateTextdraw("FPS: " + val.Player.FPS.tointeger(), 0, 0, 0xFFB0B0B0);
if (val.Text != null) val.Text.ShowForPlayer(val.Player);
}

}

//On Server Start
function onServerStart()
{
NewTimer("PlayerFps", 5000, 0);
}

function onPlayerJoin(player)
{
fps.push({Player = player, Text = null});
}

function onPlayerPart(player, reason)
{
for (local i = fps.len()-1; i >= 0; i--)
{
if (fps[i].Player.ID == player.ID)
{
if (fps[i].Text != null) fps[i].Text.Delete();
fps.remove(i);
break;
}
}
}


Note:
Global Variable have to be outside any function.
Global variable have to be in the same file in which it is declared.


Simple Option to raise fps will be to turn of frame limiter in display options of gta vc settings.

Credits:S.L.C as he gave simpler function than me.

Screenshots








Pages: [1]