getxyinfronofme
#8

i don't know if this will work but u can at least try it:
pawn Код:
#define RECORDING "npc15"
#define RECORDING_TYPE 2

#include <a_npc>
main(){}
public OnRecordingPlaybackEnd() StartRecordingPlayback(RECORDING_TYPE, RECORDING);
public OnNPCEnterVehicle(vehicleid, seatid) StartRecordingPlayback(RECORDING_TYPE, RECORDING);
public OnNPCExitVehicle() StopRecordingPlayback();

forward OnNPCCheckplayer();

public OnNPCSpawn()
{
  StartRecordingPlayback(RECORDING_TYPE, RECORDING);
  SetTimer("OnNPCCheckplayer",5000,1);
  return 1;
}
//------------------------------------------
stock 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,Float:unusedx,Float:unusedy,Float:tempz;
    GetMyPos(unusedx,unusedy,tempz);
    GetXYInFrontOfMe(x, y, 5.0);
    for(new i = 0; i < MAX_PLAYERS; i++){
        if(IsPlayerConnected(i) && IsPlayerInRangeOfPoint(i, 5.0, x,y,tempz))
        {
            SendChat("I 'see' a player is in front of me !.");
        }
    }
}
btw so & in a function lets you save the thingy to a variable.. hmm something new i learned ;x

and nice tut, i love maths ;]
Reply


Messages In This Thread
getxyinfronofme - by boelie - 28.12.2009, 10:05
Re: getxyinfronofme - by Gamer_Z - 28.12.2009, 10:12
Re: getxyinfronofme - by boelie - 28.12.2009, 10:15
Re: getxyinfronofme - by Gamer_Z - 28.12.2009, 10:16
Re: getxyinfronofme - by boelie - 28.12.2009, 10:21
Re: getxyinfronofme - by boelie - 28.12.2009, 10:55
Re: getxyinfronofme - by M4S7ERMIND - 28.12.2009, 11:38
Re: getxyinfronofme - by Gamer_Z - 28.12.2009, 12:14
Re: getxyinfrontofme - by boelie - 28.12.2009, 17:38
Re: getxyinfronofme - by Gamer_Z - 28.12.2009, 21:04

Forum Jump:


Users browsing this thread: 4 Guest(s)