NPC Keeps Leaving The Server
#1

How can i stop my npc from leaving the server? - It connects and then disconnects

Here is my script:

Quote:


*/
#include <a_samp>

#define COLOR_GREY 0xAFAFAFAA
#define COLOR_GREEN 0x33AA33AA
#define COLOR_RED 0xAA3333AA
#define COLOR_YELLOW 0xFFFF00AA
#define COLOR_WHITE 0xFFFFFFAA

#define COLOR_RED 0xAA3333AA
#define COLOR_SYSTEM 0xEFEFF7AA

public OnGameModeInit()
{


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, "ammunationshooter", true)) { // Detecting if the NPC is spawned. If it is not spawned or the name is wrong, nothing will happend
SetSpawnInfo( playerid, 0, 255, 1958.33, 1343.12, 15.36, 269.15, 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

}
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)) return 0;

return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp(cmdtext, "/ammunationshooter", true) == 0) {
SendClientMessageToAll(COLOR_SYSTEM,"..:ispatch-::..");
SendClientMessageToAll(COLOR_SYSTEM,"LSPD And SWAT's to the Main Ammunation Store immediatly");
SendClientMessageToAll(COLOR_SYSTEM,"Terrorists Have Been Found Shooting Anyone Who Passes Them");
SendClientMessageToAll(COLOR_SYSTEM,"You must kill them before its too late. Good Luck");

ConnectNPC("ammunationshooter","ammunationshooter" ); // 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

return 1;
}
return 0;
}

All i need is the bot to connect and have 1 command...

Connect the bot...

NPC Name: ammunationshooter
Commands:

Quote:

{
if(strcmp(cmdtext, "/ammunationshooter", true) == 0) {
SendClientMessageToAll(COLOR_SYSTEM,"..:ispatch-::..");
SendClientMessageToAll(COLOR_SYSTEM,"LSPD And SWAT's to the Main Ammunation Store immediatly");
SendClientMessageToAll(COLOR_SYSTEM,"Terrorists Have Been Found Shooting Anyone Who Passes Them");
SendClientMessageToAll(COLOR_SYSTEM,"You must kill them before its too late. Good Luck");

ConnectNPC("ammunationshooter","ammunationshooter" ); // 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

return 1;
}
return 0;
}
Thanks for the help
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)