Anti miniguns - 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)
+--- Thread: Anti miniguns (
/showthread.php?tid=307632)
Anti miniguns -
lusta19 - 31.12.2011
the gamemodes is warnings
Код:
public OnPlayerDeath(playerid, killerid, reason)
{
if(GetPlayerWeapon(killerid) == 38)
{
new string[128], player[MAX_PLAYER_NAME];
GetPlayerName(playerid, player, sizeof(player));
format(string, sizeof(string), "%s died! Server Banned his attacker (reason: Minigun)", player);
SendClientMessageToAll(YELLOW, string);
Ban(killerid);
}
return 1;
}
Waring:
Код:
D:\Hybrid Teszt szerver\gamemodes\hybrid.pwn(26193) : warning 225: unreachable code
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
1 Warning.
help, THx
Re: Anti miniguns -
BlackSA - 31.12.2011
What line is 26193?
Re: Anti miniguns -
James Coral - 31.12.2011
Not Ban only
Check Code:
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
if(GetPlayerWeapon(killerid) == 38)
{
new IP[32];
for(new p=0;p<MAX_PLAYERS;p++) //Make loop
{
GetPlayerIp(p,IP,32);
new name[24];
GetPlayerName(p,name,24);
BanEx(p,"%s Have been Banned Reason: (minigun), name"); }
}
return 1;
}
return 1;
}
UNTESTED
Re: Anti miniguns -
LiamM - 31.12.2011
Just saying, would it not be easier to GetPlayerWeapon under OnPlayerUpdate? So as soon as the player has a minigun it bans them? Cause the way your doing it here, players can run around with a minigun when ever they like as long as they dont kill anyone...
Just a suggestion eh?
Re: Anti miniguns -
Mikkel_Pedersen - 31.12.2011
Quote:
Originally Posted by James Coral
Not Ban only
Check Code:
pawn Код:
public OnPlayerDeath(playerid, killerid, reason) { if(GetPlayerWeapon(killerid) == 38) { new IP[32]; for(new p=0;p<MAX_PLAYERS;p++) //Make loop { GetPlayerIp(p,IP,32); new name[24]; GetPlayerName(p,name,24); BanEx(p,"%s Have been Banned Reason: (minigun), name"); } } return 1; } return 1; }
UNTESTED
|
So you want to ban everyone, as soon a cheater makes a minigun kill?
Also, I would make a timer and check a player's weapons using
GetPlayerWeaponData, since
GetPlayerWeapon only checks the weapon you are holding. And OPU gets called lots of times per second, so it would be useless to check for a minigun that often.
EDIT: Sorry for just suggesting something new, instead of helping you fix the problem. I guess your OnPlayerDeath got more code than just a minigun check. So if you just 'return 1;' in the middle (or just after the minigun check), then the rest of the code in OnPlayerDeath won't be called, therefore unreachable. But show us the exact line of where the error occurs.
Re: Anti miniguns -
lusta19 - 31.12.2011
Quote:
Originally Posted by James Coral
Not Ban only
Check Code:
pawn Код:
public OnPlayerDeath(playerid, killerid, reason) { if(GetPlayerWeapon(killerid) == 38) { new IP[32]; for(new p=0;p<MAX_PLAYERS;p++) //Make loop { GetPlayerIp(p,IP,32); new name[24]; GetPlayerName(p,name,24); BanEx(p,"%s Have been Banned Reason: (minigun), name"); } } return 1; } return 1; }
UNTESTED
|
Not good
Quote:
Originally Posted by BlackSA
What line is 26193?
|
Код:
new Kill_Size = sizeof(Kill_levels)-1;
Re: Anti miniguns -
HyperZ - 31.12.2011
Quote:
Originally Posted by lusta19
the gamemodes is warnings
Код:
public OnPlayerDeath(playerid, killerid, reason)
{
if(GetPlayerWeapon(killerid) == 38)
{
new string[128], player[MAX_PLAYER_NAME];
GetPlayerName(playerid, player, sizeof(player));
format(string, sizeof(string), "%s died! Server Banned his attacker (reason: Minigun)", player);
SendClientMessageToAll(YELLOW, string);
Ban(killerid);
}
return 1;
}
Waring:
Код:
D:\Hybrid Teszt szerver\gamemodes\hybrid.pwn(26193) : warning 225: unreachable code
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
1 Warning.
help, THx
|
This warnning isn't from this code/callback.
Press CTRL+G and search for 26193 and then copy the lines and post them here.
Re: Anti miniguns -
James Coral - 31.12.2011
JunkBuster is your friend!
Re: Anti miniguns -
lusta19 - 31.12.2011
Quote:
Originally Posted by HyperZ
This warnning isn't from this code/callback.
Press CTRL+G and search for 26193 and then copy the lines and post them here.
|
Код:
new Kill_Size = sizeof(Kill_levels)-1;
AW: Anti miniguns -
BigETI - 31.12.2011
You know that hacking clients can emulate OnPlayerDeath so peoples without minigun can be also punished.
Quote:
Also, I would make a timer and check a player's weapons using GetPlayerWeaponData, since GetPlayerWeapon only checks the weapon you are holding. And OPU gets called lots of times per second, so it would be useless to check for a minigun that often.
|
Of course OPU gets called several times but if you know how detect it more slightly and synced there are alot of tricks how to check it over OPU (from cessils anticheat guide)