#include <a_samp>
#include <a_npc>
#define RECORDING_TYPE 1
#define RECORDING_TYPE2 2
#define RECORDING1 "Soldado1"
#define RECORDING2 "Soldado2"
#define RECORDING3 "Hydra"
#define RECORDING4 "mave"
#define RECORDING5 "tanke1"
#define RECORDING6 "tanke2"
#define RECORDING7 "tanke3"
#define RECORDING8 "truck"
new Carro1;
new Carro2;
new Carro3;
new Carro4;
new Carro5;
new Carro6;
new timer;
public OnFilterScriptInit()
{
ConnectNPC("Soldado1","Soldado1");
ConnectNPC("Soldado2","Soldado2");
ConnectNPC("Piloto","Hydra");
ConnectNPC("PilotoNews","mave");
ConnectNPC("MotoristaTanque","tanke1");
ConnectNPC("MotoristaTanque","tanke2");
ConnectNPC("MotoristaTanque","tanke3");
ConnectNPC("Motorista","truck");
Carro1 = CreateVehicle(520, 0.0, 0.0, 5.0, 0.0, 3, 3, 5000);
Carro2 = CreateVehicle(497, 0.0, 0.0, 5.0, 0.0, 3, 3, 5000);
Carro3 = CreateVehicle(432, 0.0, 0.0, 5.0, 0.0, 3, 3, 5000);
Carro4 = CreateVehicle(432, 0.0, 0.0, 5.0, 0.0, 3, 3, 5000);
Carro5 = CreateVehicle(432, 0.0, 0.0, 5.0, 0.0, 3, 3, 5000);
Carro6 = CreateVehicle(427, 0.0, 0.0, 5.0, 0.0, 3, 3, 5000);
return 1;
}
public OnPlayerConnect(playerid)
{
timer = SetTimerEx("NPCFollow", 1000, true, "d", playerid);
}
main(){}
public OnRecordingPlaybackEnd()
StartRecordingPlayback(RECORDING_TYPE2, RECORDING1);
StartRecordingPlayback(RECORDING_TYPE2, RECORDING2);
StartRecordingPlayback(RECORDING_TYPE1, RECORDING3);
StartRecordingPlayback(RECORDING_TYPE1, RECORDING4);
StartRecordingPlayback(RECORDING_TYPE1, RECORDING5);
StartRecordingPlayback(RECORDING_TYPE1, RECORDING6);
StartRecordingPlayback(RECORDING_TYPE1, RECORDING7);
StartRecordingPlayback(RECORDING_TYPE1, RECORDING8);
public OnPlayerSpawn(playerid)
{
if(IsPlayerNPC(playerid))
{
new npcname[MAX_PLAYER_NAME];
GetPlayerName(playerid, npcname, sizeof(npcname));
if(!strcmp(npcname, "Piloto", true))
{
PutPlayerInVehicle(playerid, Carro1, 0);
}
if(!strcmp(npcname, "PilotoNews", true))
{
PutPlayerInVehicle(playerid, Carro2, 0);
}
if(!strcmp(npcname, "MotoristaTanque1", true))
{
PutPlayerInVehicle(playerid, Carro3, 0);
}
if(!strcmp(npcname, "MotoristaTanque2", true))
{
PutPlayerInVehicle(playerid, Carro4, 0);
}
if(!strcmp(npcname, "MotoristaTanque3", true))
{
PutPlayerInVehicle(playerid, Carro5, 0);
}
if(!strcmp(npcname, "Motorista", true))
{
PutPlayerInVehicle(playerid, Carro6, 0);
}
return 1;
}
return 1;
}
forward NPCFollow(playerid);
public NPCFollow(playerid)
{
new Float:x, Float:y, Float:z;
if(!IsPlayerNPC(playerid))
{
GetPlayerPos(playerid, x, y, z);
}
for(new i=0; i<MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i) && IsPlayerNPC(i))
{
if(GetDistanceBetweenPlayers(playerid, i)<15)
{
SetPlayerPos(i, x-2, y, z);
}
}
}
return 1;
}
stock GetDistanceBetweenPlayers(playerid, playerid2) //By Slick (Edited by Smugller thx for ****** )
{
new Float:x1,Float:y1,Float:z1,Float:x2,Float:y2,Float:z2;
new Float:dis;
GetPlayerPos(playerid,x1,y1,z1);
GetPlayerPos(playerid2,x2,y2,z2);
dis = floatsqroot((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1)+(z2-z1)*(z2-z1));
return floatround(dis);
}
warning 235: public function lacks forward declaration (symbol "OnRecordingPlaybackEnd") error 004: function "StartRecordingPlayback" is not implemented error 010: invalid function or declaration error 025: function heading differs from prototype error 025: function heading differs from prototype error 025: function heading differs from prototype error 025: function heading differs from prototype error 025: function heading differs from prototype error 025: function heading differs from prototype warning 217: loose indentation warning 217: loose indentation warning 204: symbol is assigned a value that is never used: "timer" |
/* SA-MP NPC Functions
*
* © Copyright 2009, SA-MP Team
*
*/
#if defined _samp_included
#endinput
#endif
#define _samp_included
#pragma library samp
#pragma tabsize 4
#include <core>
#include <float>
#include <string>
#include <file>
#include <time>
#include <datagram>
// --------------------------------------------------
// Natives
// --------------------------------------------------
// Util
native print(const string[]);
native printf(const format[], {Float,_}:...);
native format(output[], len, const format[], {Float,_}:...);
native SetTimer(funcname[], interval, repeating);
native KillTimer(timerid);
native GetTickCount();
native Float:asin(Float:value);
native Float:acos(Float:value);
native Float:atan(Float:value);
native Float:atan2(Float:x, Float:y);
native SendChat(msg[]);
native SendCommand(commandtext[]);
native GetPlayerState(playerid);
native GetPlayerPos(playerid, &Float:x, &Float:y, &Float:z);
native GetPlayerVehicleID(playerid);
native GetPlayerArmedWeapon(playerid);
native GetPlayerHealth(playerid);
native GetPlayerArmour(playerid);
native GetPlayerSpecialAction(playerid);
native IsPlayerStreamedIn(playerid);
native IsVehicleStreamedIn(vehicleid);
native GetPlayerKeys(playerid, &keys, &updown, &leftright);
native GetPlayerFacingAngle(playerid, &Float:ang);
native GetMyPos(&Float:x, &Float:y, &Float:z);
native SetMyPos(Float:x, Float:y, Float:z);
native GetMyFacingAngle(&Float:ang);
native SetMyFacingAngle(Float:ang);
native GetDistanceFromMeToPoint(Float:X, Float:Y, Float:Z, &Float:Distance);
native IsPlayerInRangeOfPoint(playerid, Float:range, Float:X, Float:Y, Float:Z);
native GetPlayerName(playerid, const name[], len);
native IsPlayerConnected(playerid);
#define PLAYER_RECORDING_TYPE_NONE 0
#define PLAYER_RECORDING_TYPE_DRIVER 1
#define PLAYER_RECORDING_TYPE_ONFOOT 2
native StartRecordingPlayback(playbacktype, recordname[]);
native StopRecordingPlayback();
native PauseRecordingPlayback();
native ResumeRecordingPlayback();
// --------------------------------------------------
// Defines
// --------------------------------------------------
// States
#define PLAYER_STATE_NONE (0)
#define PLAYER_STATE_ONFOOT (1)
#define PLAYER_STATE_DRIVER (2)
#define PLAYER_STATE_PASSENGER (3)
#define PLAYER_STATE_WASTED (7)
#define PLAYER_STATE_SPAWNED (8)
#define PLAYER_STATE_SPECTATING (9)
// Misc
#define MAX_PLAYER_NAME (24)
#define MAX_PLAYERS (500)
#define MAX_VEHICLES (2000)
#define INVALID_PLAYER_ID (0xFFFF)
#define INVALID_VEHICLE_ID (0xFFFF)
#define NO_TEAM (255)
#define MAX_OBJECTS (150)
#define INVALID_OBJECT_ID (255)
#define MAX_GANG_ZONES (1024)
#define MAX_TEXT_DRAWS (1024)
#define MAX_MENUS (128)
#define INVALID_MENU (0xFF)
#define INVALID_TEXT_DRAW (0xFFFF)
#define INVALID_GANG_ZONE (-1)
// Weapons
#define WEAPON_BRASSKNUCKLE (1)
#define WEAPON_GOLFCLUB (2)
#define WEAPON_NITESTICK (3)
#define WEAPON_KNIFE (4)
#define WEAPON_BAT (5)
#define WEAPON_SHOVEL (6)
#define WEAPON_POOLSTICK (7)
#define WEAPON_KATANA (8)
#define WEAPON_CHAINSAW (9)
#define WEAPON_DILDO (10)
#define WEAPON_DILDO2 (11)
#define WEAPON_VIBRATOR (12)
#define WEAPON_VIBRATOR2 (13)
#define WEAPON_FLOWER (14)
#define WEAPON_CANE (15)
#define WEAPON_GRENADE (16)
#define WEAPON_TEARGAS (17)
#define WEAPON_MOLTOV (18)
#define WEAPON_COLT45 (22)
#define WEAPON_SILENCED (23)
#define WEAPON_DEAGLE (24)
#define WEAPON_SHOTGUN (25)
#define WEAPON_SAWEDOFF (26)
#define WEAPON_SHOTGSPA (27)
#define WEAPON_UZI (28)
#define WEAPON_MP5 (29)
#define WEAPON_AK47 (30)
#define WEAPON_M4 (31)
#define WEAPON_TEC9 (32)
#define WEAPON_RIFLE (33)
#define WEAPON_SNIPER (34)
#define WEAPON_ROCKETLAUNCHER (35)
#define WEAPON_HEATSEEKER (36)
#define WEAPON_FLAMETHROWER (37)
#define WEAPON_MINIGUN (38)
#define WEAPON_SATCHEL (39)
#define WEAPON_BOMB (40)
#define WEAPON_SPRAYCAN (41)
#define WEAPON_FIREEXTINGUISHER (42)
#define WEAPON_CAMERA (43)
#define WEAPON_PARACHUTE (46)
#define WEAPON_VEHICLE (49)
#define WEAPON_DROWN (53)
#define WEAPON_COLLISION (54)
// Keys
#define KEY_ACTION (1)
#define KEY_CROUCH (2)
#define KEY_FIRE (4)
#define KEY_SPRINT (8)
#define KEY_SECONDARY_ATTACK (16)
#define KEY_JUMP (32)
#define KEY_LOOK_RIGHT (64)
#define KEY_HANDBRAKE (128)
#define KEY_LOOK_LEFT (256)
#define KEY_SUBMISSION (512)
#define KEY_LOOK_BEHIND (512)
#define KEY_WALK (1024)
#define KEY_ANALOG_UP (2048)
#define KEY_ANALOG_DOWN (4096)
#define KEY_ANALOG_RIGHT (16384)
#define KEY_ANALOG_LEFT (8192)
#define KEY_UP (-128)
#define KEY_DOWN (128)
#define KEY_LEFT (-128)
#define KEY_RIGHT (128)
// --------------------------------------------------
// Forwards (Callback declarations)
// --------------------------------------------------
forward OnNPCModeInit();
forward OnNPCModeExit();
forward OnNPCConnect(myplayerid);
forward OnNPCDisconnect(reason[]);
forward OnNPCSpawn();
forward OnNPCEnterVehicle(vehicleid, seatid);
forward OnNPCExitVehicle();
forward OnClientMessage(color, text[]);
forward OnPlayerDeath(playerid);
forward OnPlayerText(playerid, text[]);
forward OnPlayerStreamIn(playerid);
forward OnPlayerStreamOut(playerid);
forward OnVehicleStreamIn(vehicleid);
forward OnVehicleStreamOut(vehicleid);
forward OnRecordingPlaybackEnd();
// --------------------------------------------------