Kick an NPC - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Kick an NPC (
/showthread.php?tid=274063)
Kick an NPC -
Davz*|*Criss - 04.08.2011
Hey guys i got 4 NPCS in my script.
And i want to know how do i kick the shit npcs?
Please tell me.
Thanks!
Davz~
Re: Kick an NPC -
Davz*|*Criss - 04.08.2011
Oh my god, what the hell is this, No one knows what to do?
= Ima feel sorry for 1 bump.
Re: Kick an NPC -
[MG]Dimi - 04.08.2011
Delete ConnectNPC under OnGameModeInit?
Re: Kick an NPC -
RyDeR` - 04.08.2011
Simply use "Kick":
Re: Kick an NPC -
Davz*|*Criss - 04.08.2011
that doesnt work
Re: Kick an NPC -
RyDeR` - 04.08.2011
Yes it does - What about trying?
Re: Kick an NPC -
Davz*|*Criss - 04.08.2011
Hi if it works for you.
It does not work for me, Sir.
Here is the code:
pawn Код:
public KickHydraAssualts(playerid)
{
new npcname[MAX_PLAYER_NAME];
GetPlayerName(playerid, npcname, sizeof(npcname));
if(!strcmp(npcname, "HydraAssualt1", true))
{
Kick(HydraAssualt1);
Kick(playerid);
return 1;
}
if(!strcmp(npcname, "HydraAssualt2", true))
{
Kick(HydraAssualt2);
Kick(playerid);
return 1;
}
if(!strcmp(npcname, "HydraAssualt3", true))
{
Kick(HydraAssualt3);
Kick(playerid);
return 1;
}
if(!strcmp(npcname, "HydraAssualt4", true))
{
Kick(HydraAssualt4);
Kick(playerid);
return 1;
}
return 1;
}
I have set an timer about 42 seconds, and that kicks npc..
But none of this works.
Re: Kick an NPC -
RyDeR` - 04.08.2011
Try this without any timer - Just add the example in a simple command to see if it works (it should work):
pawn Код:
stock KickNPC(npcName[])
{
for(new i, tmpName[MAX_PLAYER_NAME]; i < MAX_PLAYERS; ++i)
{
if(IsPlayerNPC(i))
{
if(!strcmp(tmpName, npcName, true))
{
return Kick(i);
}
}
}
return 0;
}
Usage:
pawn Код:
KickNPC("HydraAssualt1");
Re: Kick an NPC -
Davz*|*Criss - 04.08.2011
thanks very much!
Re: Kick an NPC -
Tigerkiller - 04.08.2011
change maxnpcs in your server.cfg to 0
so no npcs can connect