Sinner.PWN Posted September 21, 2016 Report Share Posted September 21, 2016 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. 3 Quote Link to comment Share on other sites More sharing options...
Banditul Posted September 22, 2016 Report Share Posted September 22, 2016 Foarte fain , o sa o folosesc. Dar poti sterge acel stock(tot functie va fii) , si folosirea varibilelor directe pentru x y z e putin mai eficienta(ma bag si eu in seamna ) ,dar hei buna treaba. Rep+ Quote Link to comment Share on other sites More sharing options...
Sinner.PWN Posted September 22, 2016 Author Report Share Posted September 22, 2016 E mai util sa caut cu CTRL + F: "stock IsPlayerFalling" decat sa caut "IsPlayerFalling" prin tot gm-ul, e mult mai rapid. Nu inteleg ce vrei sa spui cu x, y, z ... Quote Link to comment Share on other sites More sharing options...
Banditul Posted September 22, 2016 Report Share Posted September 22, 2016 (edited) 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 September 22, 2016 by Banditul Quote Link to comment Share on other sites More sharing options...
Sinner.PWN Posted September 22, 2016 Author Report Share Posted September 22, 2016 Cand vine vorba de utilizarea unui array intr-o functie de genul care nu are nevoie de "viteza" se accepta si aroganta asta. Quote Link to comment Share on other sites More sharing options...
Rayan Posted September 22, 2016 Report Share Posted September 22, 2016 (edited) :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? Edited September 22, 2016 by Rayan Quote Link to comment Share on other sites More sharing options...
Sinner.PWN Posted September 22, 2016 Author Report Share Posted September 22, 2016 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. Quote Link to comment Share on other sites More sharing options...
Lunoxx Posted April 29, 2017 Report Share Posted April 29, 2017 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 Quote Servicii scripting calitative: https://www.sa-mp.ro/forums/topic/26143-l-ofer-servicii-scripting-de-calitate/ Contact: Skype: alin.m99 Discord: Lunoxx#1155 Email: [email protected] Facebook: facebook.com/pawnscripts Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.