PDA

View Full Version : Anti miniguns


lusta19
31/12/2011, 11:06 AM
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 (c) 1997-2006, ITB CompuPhase


1 Warning.


help, THx

BlackSA
31/12/2011, 11:12 AM
What line is 26193?

James Coral
31/12/2011, 11:13 AM
Not Ban only

Check Code:


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

LiamM
31/12/2011, 11:14 AM
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? :)

Mikkel_Pedersen
31/12/2011, 11:17 AM
Not Ban only

Check Code:


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 (http://wiki.sa-mp.com/wiki/GetPlayerWeaponData), since GetPlayerWeapon (http://wiki.sa-mp.com/wiki/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.

lusta19
31/12/2011, 11:22 AM
Not Ban only

Check Code:


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


What line is 26193?

new Kill_Size = sizeof(Kill_levels)-1;

HyperZ
31/12/2011, 11:33 AM
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 (c) 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.

James Coral
31/12/2011, 11:38 AM
JunkBuster is your friend!

lusta19
31/12/2011, 11:59 AM
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;

BigETI
31/12/2011, 12:13 PM
You know that hacking clients can emulate OnPlayerDeath so peoples without minigun can be also punished.

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)