Jump to content

functie: IsPlayerFalling


Sinner.PWN

Recommended Posts

stock IsPlayerFalling( playerid ) // Definim stock-ul nostru
{
    new Float:Velocity[ 3 ]; // Definim o variabila de tip float cu o dimensiune de 3 celule
    GetPlayerVelocity( playerid, Velocity[ 0 ], Velocity[ 1 ], Velocity[ 2 ] ); // Verificam viteza de deplasare pe toate cele 3 coordonate x,y,z
    return ( Velocity[ 2 ] != 0.0 ); // Daca Z-ul ce reprezinta miscarea pe axa Z(pe verticala) a jucatorului este diferit de 0 stock-ul va returna valoarea 1.
}
// Exemplu comanda
CMD:pee( playerid, params[] )
{
	if( IsPlayerFalling( playerid ) )
		return SendClientMessage( playerid, ~1, "Te afli in cadere, nu poti folosi aceasta animatie!" );

	// Cod animatie
	return true;
}

Postez aici o functie care poate va fi utila in blocarea animatiilor. Exista un bug in care daca se foloseste /pee in cadere libera viata jucatorului nu va fi afectata la impactul cu solul.

  • Upvote 3

Sinner.png

Link to comment
Share on other sites

Ma refeream la array si non-array , am gresit eu exprimarea http://forum.sa-mp.com/showthread.php?t=580289 Asta voiam sa zic, bine nu e mare lucru dar e spre bine. Si da stiu ca e mai usor :)

Edit: Scuze de posturi si etc, dar sunt putin obsedat de verbul "a optimiza" =))

Edited by Banditul
Link to comment
Share on other sites

Chiar acum, Rayan a spus:

:d, Multumim pentru tutorial SoNNy. +1

p.s: cum am facut eu la comanda /time, face acelasi lucru sau e mult mai optima varianta asta?

Multumesc pentru +1.

Poti folosi aceasta functie pentru a-ti optimiza codul si sa o folosesti in toate animatiile in loc sa scrii acelasi cod de fiecare data.

Sinner.png

Link to comment
Share on other sites

  • 7 months later...
On 9/22/2016 at 1:26 PM, Banditul said:

Ma refeream la array si non-array , am gresit eu exprimarea http://forum.sa-mp.com/showthread.php?t=580289 Asta voiam sa zic, bine nu e mare lucru dar e spre bine. Si da stiu ca e mai usor :)

Edit: Scuze de posturi si etc, dar sunt putin obsedat de verbul "a optimiza" =))

Optimizarea adevarata o faci in alte circumstante, nu neaparat in functii de genu`, dar ce sa zic, nu contest faptul ca variabilele normale sunt mai rapide decat array-urile :))

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.

×
×
  • 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.