28.12.2009, 10:05
Hello there,
Im trying to learn how to use the getxyifrontofme function
I checked the wiki about, still im doing something wrong and i just cant figure it out.
p.s. iknow every scripter must have the taxi npc script where i could check. But if i do that i wont 'understand' and learn how it works.
Here is what the piece of code where i go wrong somehow;
(OnNPCCheckplayer is a timer that repeats every 5 seconds)
P.S. 2 - If i understand this, then im going to make a tutorial because i saw very much questions about it
Im trying to learn how to use the getxyifrontofme function
I checked the wiki about, still im doing something wrong and i just cant figure it out.
p.s. iknow every scripter must have the taxi npc script where i could check. But if i do that i wont 'understand' and learn how it works.
Here is what the piece of code where i go wrong somehow;
Код:
//------------------------------------------wikithing wich i want to use because im learning! XD GetXYInFrontOfMe(Float:x, &Float:y, Float:distance) { new Float:z,Float:a; GetMyPos( x, y, z); GetMyFacingAngle(a); x += (distance * floatsin(-a, degrees)); y += (distance * floatcos(-a, degrees)); } //------------------------------------------ public OnNPCCheckplayer() { new Float:x, Float:y ; GetXYInFrontOfMe(x, y, 5.0); for(new i = 0; i < MAX_PLAYERS; i++) if(IsPlayerInRangeOfPoint(i, 5.0, x,y,5.0)) { SendChat("I 'see' a player is in front of me ."); } }
P.S. 2 - If i understand this, then im going to make a tutorial because i saw very much questions about it