[SA Style] Parachuting System (now colorable!)

Started by Sebastian, Feb 25, 2017, 05:43 PM

Previous topic - Next topic

jayant

#15
@sseebbyy - Used your code base with some changes and now I got working jetpack,but for some seconds. It was fun.

Diego^

BRL's Developer.

Sebastian

Update

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.


Luis_Labarca

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.


Cool friend :D

My server RP
IP: 51.222.28.159:8194

KAKAN

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.
oh no

Sebastian

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() ) ?

DizzasTeR

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

Sebastian

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

Luis_Labarca

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
My server RP
IP: 51.222.28.159:8194

kennedyarz

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

Luis_Labarca

Quote from: kennedyarz on Apr 19, 2017, 10:02 PM
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

My suggestion is not for you :P
My server RP
IP: 51.222.28.159:8194

MatheuS

Quote from: Luis_Labarca on Apr 20, 2017, 01:24 AM
Quote from: kennedyarz on Apr 19, 2017, 10:02 PM
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

My suggestion is not for you :P

He only gave his opinion.

And he was right.
if( !sucess ) tryAgain();
Thanks to the VCMP community. It was the happiest period of my life.

kennedyarz

Quote from: MatheuS on Apr 20, 2017, 01:58 AM
Quote from: Luis_Labarca on Apr 20, 2017, 01:24 AM
Quote from: kennedyarz on Apr 19, 2017, 10:02 PM
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

My suggestion is not for you :P

He only gave his opinion.

And he was right.

exact. Besides, I better shut up ...

Sebastian

Good point.
I've updated the code. Thank you.

Report anything else wrong, if there is any. :)

vito

Can you tell me where model taken from? I'm going to use it in my server so I need credits of model, thanks.