CREDITS:- @Shadow - for his onPlayerFall event shown >here< (http://forum.vc-mp.org/?topic=4237.msg31288#msg31288)
- @sseebbyy - everything else
- @ermaccer - for telling me how to make a vehicle be colorable
Parachuting System
" I'm presenting you the future "
Fully controllable parachute, released by using it's own bag
Even able to listen radio, if you really wish to
The only way you can go is down, slowly
It auto-detaches by itself almost everytime you get on ground
Players with high ping won't be disadvantaged
https://youtu.be/SKOGkIwgmNI
now colorable: http://i.imgur.com/XRsAdMl.png
[spoiler=Instalation guide]
1. Download the custom files from >here< (http://www.mediafire.com/file/fp67yjr2j9nr31h/VCMP+Parachute+%28wep%2C+veh%29+v2.zip) and place them in your store2. Place this script in the top:srand( GetTickCount() ); // KAKAN's suggestion for a pure random coloring
local wepParaID = 100; // the weapon ID of the parachute
local vehParaID = 6400; // the vehicle ID of the parachute
local plrParachute = array( GetMaxPlayers(), 0 );
local forParachute = array( GetMaxPlayers(), 0 );
local g_PlayerFallAccum = array(GetMaxPlayers(), 0.0);
function onPlayerFall(player, speed)
{
if( speed > 13 ) if( player.Weapon == 100 ) Announce( "Open your parachute!", player, 1 );
}
function _PlayerFallResetFunc()
{
g_PlayerFallAccum.apply(@(v) 0.0);
for( local i = 0; i <= GetMaxPlayers(); i++ )
{
local player = FindPlayer( i );
if( player )
{
if( (player.Vehicle) && (plrParachute[player.ID]) && (player.Vehicle.ID == plrParachute[player.ID].ID) )
{
if( forParachute[player.ID] == 1 )
{
local vSpd = player.Vehicle.Speed;
player.Vehicle.AddSpeed( Vector( vSpd.x *1.5, vSpd.y *1.5, vSpd.z +0.2 ) );
forParachute[player.ID] = 0;
}
else if( ( player.Vehicle.Speed.z < 0.01 ) && ( player.Vehicle.Speed.z > -0.01 ) )
onPlayerExitVehicle( player, player.Vehicle );
}
}
}
}
local _PlayerFallResetTimer = NewTimer("_PlayerFallResetFunc", 500, 0);
3. This goes under onPlayerMove( player, lastX, lastY, lastZ, newX, newY, newZ ): if( !player.Vehicle )
{
// Get the speed to avoid too many table lookups
local speed = g_PlayerFallAccum[player.ID];
// Update the accumulated speed
speed += lastZ > newZ ? lastZ - newZ : 0.0;
// Check the accumulated speed
if (speed > 1.0) onPlayerFall(player, speed);
else if( player.Weapon == 100 ) Announce( "", player, 1 );
// Save the accumulated speed
g_PlayerFallAccum[player.ID] = speed;
}
4. This one, under onPlayerGameKeysChange( player, oldKey, newKey ) if( ( newKey == KEY_ONFOOT_FIRE ) && ( !player.Vehicle ) && (player.Weapon == wepParaID) && (g_PlayerFallAccum[player.ID] != 0) )
{
player.SetWeapon( wepParaID, 0 );
player.SetWeapon( 0, 0 );
plrParachute[player.ID] = CreateVehicle( vehParaID, 0, player.Pos, 0, 0, 0 );
plrParachute[player.ID].EulerAngle.z = player.Angle ;
plrParachute[player.ID].Colour1 = random( 2, 59 );
plrParachute[player.ID].Colour2 = random( 0, 59 );
player.Vehicle = plrParachute[player.ID];
//player.SetAnim( 0, 161 );
player.Vehicle.Radio = 10;
Announce( "", player, 1 );
forParachute[player.ID] = 1;
}
5. And this one goes in onPlayerExitVehicle( player, vehicle ) if( plrParachute[player.ID] && vehicle.ID == plrParachute[player.ID].ID )
{
vehicle.Delete();
player.SetAnim( 0, 144 );
}
6. Now comes a new function that may be at the end of your scriptfunction random( min, max )
{
// coded by Gudio
if ( min < max )
return rand() % (max - min + 1) + min.tointeger();
else if ( min > max )
return rand() % (min - max + 1) + max.tointeger();
else if ( min == max )
return min.tointeger();
}
[/spoiler]
PS: It might not be perfect, but it is a start.
/me waits for your suggestions/complaints
PS2: Is there anybody good in modeling/editing vehicles ?
Since the parachute is a vehicle, it can also have 2 editable colors that will be fun to play with. :DDone with help from
@ermaccer !
I will give a try but From Video its looking so cool.
Awesome Work dude
Well done.
Nice job Seby! ;D
innovative, love it!!
Good job, my friend, congratulations :D
nice nice nice nice nice
Seby, simply the most creative person in VC:MP :)
Innvation Nation !! We would love to see more things <A jetpack :P>
@sseebbyy
good job
Good job ^^ !
Quote from: jayant on Feb 26, 2017, 03:56 AMWe would love to see more things <A jetpack :P>
You have my bless to use this as a base :D
PS: Thanks everyone !
Hope we could do something like that in the client side for a height meter :D
ontopic: Cool work seby. You really are the most creative guy around here :D
Quote from: KAKAN on Feb 26, 2017, 12:45 PMHope we could do something like that in the client side for a height meter :D
Currently it's possible on client side only with your-own player.Angle and tons of raytrace and it will lag for others players anyway.
So using vehicle it's really best way to avoid lags.
Quote from: vito on Feb 26, 2017, 12:56 PMSo using vehicle it's really best way to avoid lags.
Do you mean it will work using vehicle.Pos.z ? 'cause that's what I believe will do the job.
Unfortunately, I won't work on such a thing yet, since I'm still learning client-side scripting.
@sseebbyy - Used your code base with some changes and now I got working jetpack,but for some seconds. It was fun.
UpdateChangelog:
- made parachute be colorable (in 2 colors)
- changed animation ID when player "detaches" parachute - to avoid a bug
- made parachute spawn in random colors by start
First post was updated with new download link + some code edits.
(https://forum.vc-mp.org/proxy.php?request=http%3A%2F%2Fi.imgur.com%2FXRsAdMl.png&hash=e257713a5c36e68db986ad00ff3a7b9afe8d5a31)
Quote from: sseebbyy on Mar 04, 2017, 10:22 PMUpdate
Changelog:
- made parachute be colorable (in 2 colors)
- changed animation ID when player "detaches" parachute - to avoid a bug
- made parachute spawn in random colors by start
First post was updated with new download link + some code edits.
(https://forum.vc-mp.org/proxy.php?request=http%3A%2F%2Fi.imgur.com%2FXRsAdMl.png&hash=e257713a5c36e68db986ad00ff3a7b9afe8d5a31)
Cool friend :D
To note: onPlayerGameKeysChange doesn't work with secondary keys.
Random function can be updated to a better one. Also, to make it truly random, add a srand( GetTickCount() ); to it.
Quote from: KAKAN on Mar 05, 2017, 05:31 AMAlso, to make it truly random, add a srand( GetTickCount() ); to it.
That's some really old code written by Gudio, but it was doing it's job.
Never thought of a better one, because I didn't really need one.
But now may be the moment. How exactly should I use that srand( GetTickCount() ) ?
Quote from: sseebbyy on Mar 05, 2017, 03:50 PMBut now may be the moment. How exactly should I use that srand( GetTickCount() ) ?
The srand inserts a seed which is used by the rand function in its algorithm. In this case GetTickCount which is being changed every second. Making a seed with srand( GetTickCount() ) will set a unique seed everytime the script runs so it will generate a pure random number rather than a sequential default seed one.
Hope I you get it.
p.s: inb4 someone comes and says that's not what srand does in squirrel ;D cuz I forgot
Quote from: Doom_Kill3R on Mar 05, 2017, 04:06 PM.
Oh, this is pretty cool. Thank you !
First post updated !Now the parachute will get really random colors, thanks to
@KAKAN 's suggestion.
- Added srand( GetTickCount() ); in the top of the script.
Bro I've tried this great
Suggestion to these changes
add local ParachuteWorldID = 0; // the vehicle WorldID of the parachute
Change
if( player.Weapon == 100) Announce( "Open your parachute!", player, 1 );
to
if( player.Weapon == wepParaID) Announce( "Open your parachute!", player, 1 );
Change
if( ( newKey == KEY_ONFOOT_FIRE ) && ( !player.Vehicle ) && (player.Weapon == 100) && (g_PlayerFallAccum[player.ID] != 0) )
to
if( ( newKey == KEY_ONFOOT_FIRE ) && ( !player.Vehicle ) && (player.Weapon == wepParaID) && (g_PlayerFallAccum[player.ID] != 0) )
Change
plrParachute[player.ID] = CreateVehicle( 6400, 0, player.Pos, 0, 0, 0 );
to
plrParachute[player.ID] = CreateVehicle( vehParaID, 0, player.Pos, 0, 0, 0 );
I suggest those changes because I thought it did not work because I changed wepParaID = 100; To the correct id on my server and as there were functions like if (player.Weapon == 100) Announce ("Open your parachute!", Player, 1); I did not work but now
Quote from: Luis_Labarca on Apr 19, 2017, 05:24 PMBro I've tried this great
Suggestion to these changes
add local ParachuteWorldID = 0; // the vehicle WorldID of the parachute
Change
if( player.Weapon == 100) Announce( "Open your parachute!", player, 1 );
to
if( player.Weapon == wepParaID) Announce( "Open your parachute!", player, 1 );
Change
if( ( newKey == KEY_ONFOOT_FIRE ) && ( !player.Vehicle ) && (player.Weapon == 100) && (g_PlayerFallAccum[player.ID] != 0) )
to
if( ( newKey == KEY_ONFOOT_FIRE ) && ( !player.Vehicle ) && (player.Weapon == wepParaID) && (g_PlayerFallAccum[player.ID] != 0) )
Change
plrParachute[player.ID] = CreateVehicle( 6400, 0, player.Pos, 0, 0, 0 );
to
plrParachute[player.ID] = CreateVehicle( vehParaID, 0, player.Pos, 0, 0, 0 );
I suggest those changes because I thought it did not work because I changed wepParaID = 100; To the correct id on my server and as there were functions like if (player.Weapon == 100) Announce ("Open your parachute!", Player, 1); I did not work but now
You're not doing anything, it's the same thing, for me it's always worked like this
Quote from: kennedyarz on Apr 19, 2017, 10:02 PMQuote from: Luis_Labarca on Apr 19, 2017, 05:24 PMBro I've tried this great
Suggestion to these changes
add local ParachuteWorldID = 0; // the vehicle WorldID of the parachute
Change
if( player.Weapon == 100) Announce( "Open your parachute!", player, 1 );
to
if( player.Weapon == wepParaID) Announce( "Open your parachute!", player, 1 );
Change
if( ( newKey == KEY_ONFOOT_FIRE ) && ( !player.Vehicle ) && (player.Weapon == 100) && (g_PlayerFallAccum[player.ID] != 0) )
to
if( ( newKey == KEY_ONFOOT_FIRE ) && ( !player.Vehicle ) && (player.Weapon == wepParaID) && (g_PlayerFallAccum[player.ID] != 0) )
Change
plrParachute[player.ID] = CreateVehicle( 6400, 0, player.Pos, 0, 0, 0 );
to
plrParachute[player.ID] = CreateVehicle( vehParaID, 0, player.Pos, 0, 0, 0 );
I suggest those changes because I thought it did not work because I changed wepParaID = 100; To the correct id on my server and as there were functions like if (player.Weapon == 100) Announce ("Open your parachute!", Player, 1); I did not work but now
You're not doing anything, it's the same thing, for me it's always worked like this
My suggestion is not for you :P
Quote from: Luis_Labarca on Apr 20, 2017, 01:24 AMQuote from: kennedyarz on Apr 19, 2017, 10:02 PMQuote from: Luis_Labarca on Apr 19, 2017, 05:24 PMBro I've tried this great
Suggestion to these changes
add local ParachuteWorldID = 0; // the vehicle WorldID of the parachute
Change
if( player.Weapon == 100) Announce( "Open your parachute!", player, 1 );
to
if( player.Weapon == wepParaID) Announce( "Open your parachute!", player, 1 );
Change
if( ( newKey == KEY_ONFOOT_FIRE ) && ( !player.Vehicle ) && (player.Weapon == 100) && (g_PlayerFallAccum[player.ID] != 0) )
to
if( ( newKey == KEY_ONFOOT_FIRE ) && ( !player.Vehicle ) && (player.Weapon == wepParaID) && (g_PlayerFallAccum[player.ID] != 0) )
Change
plrParachute[player.ID] = CreateVehicle( 6400, 0, player.Pos, 0, 0, 0 );
to
plrParachute[player.ID] = CreateVehicle( vehParaID, 0, player.Pos, 0, 0, 0 );
I suggest those changes because I thought it did not work because I changed wepParaID = 100; To the correct id on my server and as there were functions like if (player.Weapon == 100) Announce ("Open your parachute!", Player, 1); I did not work but now
You're not doing anything, it's the same thing, for me it's always worked like this
My suggestion is not for you :P
He only gave his opinion.
And he was right.
Quote from: MatheuS on Apr 20, 2017, 01:58 AMQuote from: Luis_Labarca on Apr 20, 2017, 01:24 AMQuote from: kennedyarz on Apr 19, 2017, 10:02 PMQuote from: Luis_Labarca on Apr 19, 2017, 05:24 PMBro I've tried this great
Suggestion to these changes
add local ParachuteWorldID = 0; // the vehicle WorldID of the parachute
Change
if( player.Weapon == 100) Announce( "Open your parachute!", player, 1 );
to
if( player.Weapon == wepParaID) Announce( "Open your parachute!", player, 1 );
Change
if( ( newKey == KEY_ONFOOT_FIRE ) && ( !player.Vehicle ) && (player.Weapon == 100) && (g_PlayerFallAccum[player.ID] != 0) )
to
if( ( newKey == KEY_ONFOOT_FIRE ) && ( !player.Vehicle ) && (player.Weapon == wepParaID) && (g_PlayerFallAccum[player.ID] != 0) )
Change
plrParachute[player.ID] = CreateVehicle( 6400, 0, player.Pos, 0, 0, 0 );
to
plrParachute[player.ID] = CreateVehicle( vehParaID, 0, player.Pos, 0, 0, 0 );
I suggest those changes because I thought it did not work because I changed wepParaID = 100; To the correct id on my server and as there were functions like if (player.Weapon == 100) Announce ("Open your parachute!", Player, 1); I did not work but now
You're not doing anything, it's the same thing, for me it's always worked like this
My suggestion is not for you :P
He only gave his opinion.
And he was right.
exact. Besides, I better shut up ...
Good point.
I've updated the code. Thank you.
Report anything else wrong, if there is any. :)
Can you tell me where model taken from? I'm going to use it in my server so I need credits of model, thanks.
tutorial for installation?
Quote from: QW.jester on Apr 21, 2017, 10:44 AMtutorial for installation?
Noob Stick to Play
(https://forum.vc-mp.org/proxy.php?request=http%3A%2F%2Fi66.tinypic.com%2F34jb1ue.png&hash=b6a8ef7c14c6db1fa1187beac5e48e8e56312d62)
Quote from: vito on Apr 21, 2017, 09:24 AMCan you tell me where model taken from? I'm going to use it in my server so I need credits of model, thanks.
From GTA:SanAndreas, edited by me.
Suggestion to avoid annoying warning whenever you have the parachute. The ad will only appear when you reach a speed of at least 150 m/s that is when you fall.
if (speed > 150.0) onPlayerFall(player, speed);
You can see its speed using this... Just to check. Do not leave it there
AnnounceAll ( speed + "", 0);
Then, for the data to be deleted to prevent the ad from continuing to appear, use this
if ( player.Pos.z < 20 ) speed = 0;
Then everything will be better. and it will be like this
speed += lastZ > newZ ? lastZ - newZ : 0.0;
AnnounceAll ( speed + "", 0);
if (speed > 150.0) onPlayerFall(player, speed);
if ( player.Pos.z < 20 ) speed = 0;
But without this AnnounceAll ( speed + "", 0);
Quote from: kennedyarz on May 19, 2017, 09:51 PMSuggestion to avoid annoying warning whenever you have the parachute. The ad will only appear when you reach a speed
Thanks ! Got the point and did the update.
Changelog:- part of onPlayerFall() was edited by adding a speed checker.
- part of onPlayerMove() was edited by adding the text remover.
AweSome Best I Like Plese You enjoy Parachuting System in my server :
http://www49.zippyshare.com/v/36387578/file.html
http://www.mediafire.com/file/fp67yjr2j9nr31h/VCMP+Parachute+%28wep%2C+veh%29+v2.zip
Enjoy In The Server cmd Parachuting System
Help me
@Shadow @sseebbyy @ermaccer
Quote from: [TkD]MarineForce123 on Jun 16, 2017, 06:59 AMAweSome Best I Like Plese You enjoy Parachuting System in my server :
It is pretty easy to implement it in your server buddy, just give it a try.
If you face problems, show us a screenshot with the error and the line provoking the error. We will help.
(it's all about copy/paste and following the written instructions)
Cool Man!