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]
16
Script Releases / Re: Position System
« on: September 28, 2014, 03:14:28 pm »
I don't find it any clean that you're creating a new timer after a timer ends.

You should run an infinite timer, and please, not 100 miliseconds, that'll just lag a server with a decent playercount.

Code: [Select]
if(showpos[player.ID]==false)
Should be
Code: [Select]
if(!showpos[player.ID])

Same with true, you don't need that there.
Also, there's no point in checking if it's true in an else if if the previous statement was false. It's either true or false.
Code: [Select]
if(!showpos[player.ID]) //player will have it false when it enters the game
{
}
else
{
}

And obviously what heekzs said, the timers are bad. Really bad.

Updated the code.
Made the timer infinite and also changed the if and else .

17
Script Releases / Re: Position System
« on: September 28, 2014, 08:07:23 am »
It looks good, but isn't it overlat on chat ? :/
Yeah i know so i changed it position to much lower

now its fine


Mana :D.
Thats just another thing.

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

19
Script Discussion / Re: Static Maps Angle
« on: September 22, 2014, 06:32:22 pm »
try  going in negative number.
Or it can be that the road is present but angle is causing it to go underground.

20
Script Discussion / Re: Changeable Text Sprites?
« on: September 21, 2014, 03:25:07 pm »
In only one image file like this



or different image files for different numbers,text

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

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

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

24
Script Discussion / Re: Radio Streams And Database Problem ( Once Again )
« on: September 20, 2014, 01:41:11 pm »
That will raise an error when the property doesn't exist. You're checking the cash before checking the query itself.

Oh, sorry i have updated it now
and for
Also, why do you need 5 lines of code to decrease someone's cash?
You can do it in 2:
Code: [Select]
status[ player.ID ].Cash -= GetSQLColumnData( q, 2 );
player.Cash = status[ player.ID ].Cash;
I didnt changed that i just modified some of the lines.
Well but changed it to urs

25
Script Releases / Re: [Snippet]Player Fps
« on: September 20, 2014, 06:13:18 am »
foreach

Code: [Select]
'foreach' '(' [index_id','] value_id 'in' exp ')' stat
Executes a statement for every element contained in an array, table, class, string or generator. If exp is a generator it will be resumed every iteration as long as it is alive; the value will be the result of 'resume' and the index the sequence number of the iteration starting from 0.
   
Code: [Select]
local a=[10,23,33,41,589,56]
foreach(idx,val in a)
    print("index="+idx+" value="+val+"\n");
//or
foreach(val in a)
    print("value="+val+"\n");

Similar to iterators in standard C++ or the new range based for loop in C++11.


Array

push(val)

appends the value ‘val’ at the end of the array

Similar to push_back() in std::vector or related containers in C++.


References taken from Squirrel 3.0 Reference Manual
Thanks

26
Script Releases / Re: [Snippet]Player Fps
« on: September 20, 2014, 04:21:03 am »
Well then i will update the snippet as u tell.

BTW:What does the foreach loop and the arr.push do.

I dont know about them as i learned c++ and it dont contain them.

27
Script Releases / Re: [Snippet]Player Fps
« on: September 19, 2014, 10:18:31 pm »
You really need to revise the current implementation. If you require an array element for each second that the server is running then you seriously need to take a look at your code from a different perspective:
Code: [Select]
fps <- array(86400,null);//86400 stand for seconds in a day so if u r going to run server continuously for more than 1 day than change it.

Cant find another way to delete the previous textdraw.Can u suggest any.

28
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








29
Script Discussion / Re: Radio Streams And Database Problem ( Once Again )
« on: September 19, 2014, 06:22:04 pm »
Try this
Code: [Select]
else if ( cmd == "buyprops" )
{

if ( player.IsSpawned )
{
if ( text )
{
if ( IsNum( text ) )
{
local q = QuerySQL( g_DB, "SELECT * FROM Props WHERE rowid = '" + text.tointeger() + "'" );

if ( q )
{
if ( player.Cash >= GetSQLColumnData( q, 2 ) )
{

QuerySQL( g_DB, "UPDATE Props SET Owner = '" + player.Name.tolower() + "' WHERE rowid = '" + text.tointeger() + "'" );
Message( "** " + player.Name + " Bought Property:[ " + GetSQLColumnData( q, 1 ) + " ] ID:[ " + text + " ]" );
//Announce( "~h~Property Purchased!", player, 0 );
// DecreaseCash( player, GetSQLColumnData( q, 2 ).tointeger() );

status[ player.ID ].Cash -= GetSQLColumnData( q, 2 );
player.Cash = status[ player.ID ].Cash;



} else MessagePlayer( "[#FF0000][EFE] Error - You need $" + GetSQLColumnData( q, 2 ) + " to Buy this!", player );

} else MessagePlayer( "[#FF0000][EFE] The Prop Not found in the Database!", player );

} else MessagePlayer( "[#FF0000][EFE] Error - ID must be Numbers", player );

} else MessagePlayer( "[#FF0000][EFE] Error -  /" + cmd + " <ID>", player );
} else MessagePlayer( "[#FF0000][EFE] You haven't spawned yet..", player );

}

I modified it due to my laziness i didnt add the register or logedin sys in this.
I tried it with my server and it work.
I have changed the storing of Name in lower case.
Well that should work

Pages: 1 [2]