/* NPC Help by Sayaron This is a small guide that helps you to make NPCs in vehicles What is required for it to work?: -A NPC record (Use the filterscript npc_record wich is included in the sa-mp folder at download. The file will be in "npcmodes" > "recordings") -A npcmode that reefers to the NPC record (Look in the folder "npcmodes" to see how its done) */ #include <a_samp> #include <a_npc> new YourVehicle; // The name of your vehicle public OnGameModeInit() { ConnectNPC("Ali","test"); // The name of your NPC and the record. The record need to match an record with the same name. The NPC name can be anything YourVehicle = AddStaticVehicle(519,427.0935,2498.0588,17.4012,88.9030,95,17); // Creating your vehicle, this can be done ingame by typing /save. Then go to your SA-MP folder and find the folder "savedpositions" return 1; } public OnPlayerSpawn(playerid) { if(!IsPlayerNPC(playerid)) return 0; // If the player is not a NPC, nothing will happend new playername[64]; //Player String GetPlayerName(playerid,playername,64); //This is to get the NPC's name if(!strcmp(playername, "test", true)) { // Detecting if the NPC is spawned. If it is not spawned or the name is wrong, nothing will happend SetSpawnInfo( playerid, 0, 255, 427.0935, 2498.0588, 17.4012, 88.9030, 0, 0, 0, 0, 0, 0 ); //SetSpawnInfo( playerid, Team, Skin, x, y, z, rotation, weapon1, ammo for weapon1, w2, ammo2, w3, ammo3 ); SetPlayerColor(playerid,0xFFFFFFFF); // Chose any color you want, this is currently white PutPlayerInVehicle(playerid, YourVehicle, 0); //PutPlayerInVehicle(playerid, vehiclename, seat); } return 1; } // This is to stop remote bots to connect, it will only let your bots connect // If you dont want it, you may remove it public OnPlayerConnect(playerid) { if(IsPlayerNPC(playerid)) { new ip_addr_npc[64+1]; new ip_addr_server[64+1]; GetServerVarAsString("bind",ip_addr_server,64); GetPlayerIp(playerid,ip_addr_npc,64); if(!strlen(ip_addr_server)) { ip_addr_server = "127.0.0.1"; } if(strcmp(ip_addr_npc,ip_addr_server,true) != 0) { // this bot is remote connecting printf("NPC: Got a remote NPC connecting from %s and I'm kicking it.",ip_addr_npc); Kick(playerid); return 0; } printf("NPC: Connection from %s is allowed.",ip_addr_npc); } return 1; }
ohh, It might be a problem in the recorded file.
run npc_record or something like that form the filterscripts and record something for the npcs to do it. |