Jump to content

Velocity


Rimmon

Recommended Posts

Player

In acest tutorial voi incerca sa va explic cate ceva despre Velocity(Viteza)

Stiu sa folosesc aceste functii da nu prea stiu sa le explic

Pentru a seta viteza unui player se foloseste

  • SetPlayerVelocity(playerid, Float:x , Float:y , Float:z ) ;

playerid - playerul caruia ii seteaza viteza

Float:x - Cata viteza in directia X sa se aplice

Float:y - Cata viteza in directia Y sa se aplice

Float:z - Cata viteza in directia Z sa se aplice

Ex:

[pawn]CMD:sus ( playerid , params [ ] )

{

    SetPlayerVelocity ( playerid , 0.0 , 0.0 , 0.3 ) ;

    return 1;

}[/pawn]

//Forteaza playerul sa sara 0.3 metri in aer

[pawn]CMD:jos ( playerid , params [ ] )

{

    SetPlayerVelocity ( playerid , 0.0 , 0.0 , -0.3 ) ;

    return 1;

}[/pawn]

//Forteaza playerul sa se scufunde 0.3 metri

  • GetPlayerVelocity ( playerid ,  Float:x , Float:y , Float:z ) ;

playerid - playerul caruia ii afla viteza

Float:x - Afla viteza de deplasare a directiei X

Float:y - Afla viteza de deplasare a directiei Z

Float:z - Afla viteza de deplasare a directiei Y

Cu GetPlayerVelocity afli viteza playerului pentru a o aplica in alta parte..

Ex:

[pawn]CMD:jump ( playerid , params [ ] )

{

    new

          Float:x , Float:y , Float:z

    ;

    GetPlayerVelocity ( playerid , x , y , z ) ;

    SetPlayerVelocity ( playerid , x , y , z+0.3 ) ;

    return 1;

}[/pawn]

//Afla pozitia playerului,viteza si il forteaza sa sara 0.3 metri si se pastreaza viteza x si y

Masina

  • SetVehicleVelocity(vehicleid, Float:x , Float:y , Float:z ) ;

vehicleid - masina careia i se seteaza viteza

Float:x - Cata viteza in directia X sa se aplice

Float:y - Cata viteza in directia Y sa se aplice

Float:z - Cata viteza in directia Z sa se aplice

Ex:

[pawn]CMD:sus ( playerid , params [ ] )

{

    SetVehicleVelocity ( GetPlayerVehicleID( playerid ) , 0.0 , 0.0 , 0.3 ) ;

    return 1;

}[/pawn]

//Forteaza masina sa sara 0.3 metri in aer

  • GetVehicleVelocity ( vehicleid ,  Float:x , Float:y , Float:z ) ;

vehicleid - masina cereia i se afla viteza

Float:x - Afla viteza de deplasare a directiei X

Float:y - Afla viteza de deplasare a directiei Z

Float:z - Afla viteza de deplasare a directiei Y

Cu GetVehicleVelocity afli viteza masinii pentru a o aplica in alta parte..

Ex:

[pawn]CMD:jump ( playerid , params [ ] )

{

    new

          Float:x , Float:y , Float:z

    ;

    GetVehicleVelocity ( GetPlayerVehicleID ( playerid ) , x , y , z ) ;

    SetPlayerVelocity ( GetPlayerVehicleID ( playerid ) , x , y , z+0.3 ) ;

    return 1;

}[/pawn]

//Afla pozitia masinii,viteza si o forteaza sa sara 0.3 metri si se pastreaza viteza x si y a masinii

Massari e curva mea

Link to comment
Share on other sites

La sistemul meu nu am folosit functiile astea...Tot ce am facut este asta:

[pawn]new Float:v[3];

vehicleid = GetPlayerVehicleID(playerid);

if(IsPlayerInAnyVehicle)

{

GetVehicleVelocity(vehicleid,v[0],v[1],v[2]);

SetVehicleVelocity(vehicleid,v[0] * 2,v[1] * 2,v[2] * 2);

}[/pawn]

Bineinteles,aceste lucruri le-am pus sub callbac-ul corespunzator,da acesta este doar un exemplu,ca sa demonstrez ca nu imi trebuie alte functii decat astea...

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.