[Include] iParachute v0.1 (Skydiving/Parachuting information, functions)
#1

Skydive v0.1

Info:
I'm a skydiving lover, yes...
This include brings you some information while you're skydiving, and currently just one new callback.

Video:
[ame]http://www.youtube.com/watch?v=TALFHMJU76c[/ame]

As you could see, it's quite simple, but it can be useful for a base jump mini game, a parachuting school in a RP, etc.

Download:
Include Download
MapAndreas Include by RyDeR` <-- NECESSARY!

Functions:
pawn Код:
IsPlayerSkyDiving(playerid);
/*
    Returns: -false --> Not parachuting.
             -true  --> Parachuting.
*/


GetPlayerParachuteState(playerid);
/*
    Returns: -  0 --> Closed
             -  1 --> Opened
             -  2 --> Opening
*/


GetPlayerAltitude(playerid);
/*
    Returns the distance in meters from you to the ground.
*/
Callbacks:
pawn Код:
native OnPlayerOpenParachute(playerid, altitude);
/*
    You're able to know when a player opens his parachute, and his altitude too. :D
*/
Example:
Here is the code which I used in the video:
pawn Код:
#include <a_samp>
#include <skydive>

public OnPlayerOpenParachute(playerid, altitude)
{
    new cade[128], name[MAX_PLAYER_NAME];
    GetPlayerName(playerid,name,MAX_PLAYER_NAME);
    format(cade,128,"* %s opened his parachute at %d meters from the ground!",name,altitude);
    SendClientMessageToAll(-1,cade);
    return 1;
}

public OnPlayerUpdate(playerid)
{
    if(IsPlayerSkyDiving(playerid))
        {
            new cad[70], estado[15];
        switch(GetPlayerParachuteState(playerid))
        {
            case 0: estado = "Closed";
            case 1: estado = "Opened";
            case 2: estado = "Opening";
        }
        format(cad,70,"~n~~n~~n~~n~~n~~n~Altitude: ~p~%d~w~m~n~~w~State: ~p~%s",GetPlayerAltitude(playerid),estado);
        GameTextForPlayer(playerid,cad,1000,5);
    }
    return 1;
}
Credits:
[DOG]irinel1996
RyDeR` (Map Andreas include)


Bugs:
I didn't find anyone, make me know if you find one!

I hope you like it!
I'm still working in this include, making new callbacks to know when a players lands, etc.

Best regards!
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)