Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Useful NPC Functions v1.0 by [uL]Pottus
- v1.0
- FCNPC_Punch(npcid, Float:x, Float:y, Float:z, PunchResetDelay = 125) - Allows the NPC to punch and resets correctly to punch again
- FCNPC_GoToPlayer(npcid, playerid, movetype = MOVE_TYPE_WALK, UseZMap = 0) - Goes to a players exact position
- FCNPC_GoToPlayerEx(npcid, playerid, Float:dist, Float:rangle, movetype = MOVE_TYPE_WALK, UseZMap = 0) - Goes to a player from a set distance and angle that
- is realtive to the players facing angle
- v1.1
- FCNPC_StartRNPCPlayBack(npcid) start a FCNPC recording playback
- */
- //------------------------------------------------------------------------------
- // Punching Function
- //------------------------------------------------------------------------------
- stock FCNPC_Punch(npcid, Float:x, Float:y, Float:z, PunchResetDelay = 125)
- {
- FCNPC_AimAt(npcid, x, y, z, 0);
- FCNPC_StopAim(npcid);
- FCNPC_SetKeys(npcid, 0x80 + 4);
- SetTimerEx("ResetNPCKeys", PunchResetDelay, false, "i", npcid);
- }
- //------------------------------------------------------------------------------
- //------------------------------------------------------------------------------
- // Go to a players position
- //------------------------------------------------------------------------------
- stock FCNPC_GoToPlayer(npcid, playerid, movetype = MOVE_TYPE_WALK, UseZMap = 0)
- {
- new Float:x, Float:y, Float:z;
- GetPlayerPos(playerid, x, y, z);
- FCNPC_GoTo(npcid, x, y, z, movetype, UseZMap);
- }
- //------------------------------------------------------------------------------
- //------------------------------------------------------------------------------
- // Go to a players position specify a distance from player and realtive angle from
- // the players facing angle
- //------------------------------------------------------------------------------
- stock FCNPC_GoToPlayerEx(npcid, playerid, Float:dist, Float:rangle, movetype = MOVE_TYPE_WALK, UseZMap = 0)
- {
- new Float:x, Float:y, Float:z, Float:fa;
- GetPlayerPos(playerid, x, y, z);
- GetPlayerFacingAngle(playerid, fa);
- rangle += fa;
- x = (x + dist * floatsin(-rangle,degrees));
- y = (y + dist * floatcos(-rangle,degrees));
- FCNPC_GoTo(npcid, x, y, z, movetype, UseZMap);
- }
- //------------------------------------------------------------------------------
- //------------------------------------------------------------------------------
- // Resets NPC Keys
- //------------------------------------------------------------------------------
- forward ResetNPCKeys(npcid);
- public ResetNPCKeys(npcid) { FCNPC_SetKeys(npcid, 0); }
- //------------------------------------------------------------------------------
- //------------------------------------------------------------------------------
- // Play a RNPC recording
- //------------------------------------------------------------------------------
- stock FCNPC_StartRNPCPlayBack(npcid)
- {
- new recname[16];
- format(recname, sizeof(recname), "rnpc%03d-00", npcid);
- FCNPC_StopRecordingPlayback(npcid);
- FCNPC_StartRecordingPlayback(npcid, recname);
- return 1;
- }
- //------------------------------------------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement