Anti-Jetpack - 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: Anti-Jetpack (
/showthread.php?tid=254650)
[SOLVED]Anti-Jetpack -
grand.Theft.Otto - 12.05.2011
I have an anti-jetpack code:
pawn Code:
public AntiJetpack()
{
for (new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i) && isspawned[i] == 1 /*&& PlayerInfo[i][Level] >= 1 || IsPlayerAdmin(i)*/)
{
if (GetPlayerSpecialAction(i) == 2)
{
new string[128],name[MAX_PLAYER_NAME];
GetPlayerName(i,name,sizeof(name));
format(string,sizeof(string),"***KICK: %s (%d) (AUTO KICK) Jetpack Cheats.",name,i);
SendClientMessageToAll(COLOR_PINK,string);
SendClientMessage(i,COLOR_PINK,"You Have Been Automatically Kicked.");
SetPlayerPos(i,197.6661,173.8179,1003.0234);
SetPlayerInterior(i,3);
SetCameraBehindPlayer(i);
SaveToFile("KickLog",string);
Kick(i);
return 1;
}
}
}
}
It kicks the player who has the jetpack, but the problem is, it also kicks 2 bots out of the 7 bots I have.
My 7 bots range from id 0-6, while id 7 is where the regular players start. It kicked id 7 (me) then after 5 secs, it kicked 2 bots (id 5 and 6).
Anyone know why?
Re: Anti-Jetpack -
Tee - 12.05.2011
Does PlayerInfo[i][Level] mean AdminLevel?
Re: Anti-Jetpack -
grand.Theft.Otto - 12.05.2011
Yes, but right now I'm testing it by spawning a jetpack using a cheat program on my server with an unregistered username. It doesn't kick me if I am admin, but if I am not, it WILL kick me which is the good thing, but the problem is it kicks 2 bot's.
Re: Anti-Jetpack -
Snipa - 12.05.2011
Add the check IsPlayerNPC
Re: Anti-Jetpack -
Tee - 12.05.2011
pawn Code:
public AntiJetpack()
{
for (new i = 0; i < MAX_PLAYERS; i++)
{
if(!IsPlayerNPC(playerid) && IsPlayerConnected(i) && isspawned[i] == 1 /*&& PlayerInfo[i][Level] >= 1 || IsPlayerAdmin(i)*/)//If you add Level and IsPlayerAdmin, it would just check for players that are connected, is spawned, is level 1 or more and is logged to RCON.
{
if(GetPlayerSpecialAction(i) == 2)
{
new string[128],name[MAX_PLAYER_NAME];
GetPlayerName(i,name,sizeof(name));
format(string,sizeof(string),"***KICK: %s (%d) (AUTO KICK) Jetpack Cheats.",name,i);
SendClientMessageToAll(COLOR_PINK,string);
SendClientMessage(i,COLOR_PINK,"You Have Been Automatically Kicked.");
SetPlayerPos(i,197.6661,173.8179,1003.0234);
SetPlayerInterior(i,3);
SetCameraBehindPlayer(i);
SaveToFile("KickLog",string);
Kick(i);
return 1;
}
}
}
}
Snipa beat me.

.
Re: Anti-Jetpack -
grand.Theft.Otto - 12.05.2011
Yeah. I added IsPlayerNPC before but forgot to add [SOLVED].
Thanks though!