Should work well, and if it doesn't, a few tweaks would get it working
(I've made this real quick AND I might have gotten the weapon slots wrong)
#define FILTERSCRIPT
#include <a_samp>
forward WeaponChecker();
enum Sections
{
PRESIDENT,
VICEPRESIDENT,
SECURITY,
SWAT,
COPS,
TERRORISTS,
CIVILIANS
};
new WPTimer;
new ValidWeapons[Sections][13] =
{
{0, 2, 24, -1, -1, -1, -1, -1, -1, -1, 14, -1, -1}, //PRESIDENT: Golf Club, Flowers, Deagle
{0, -1, 23, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, //VICEPRESIDENT: Silenced Pistol
{0, -1, -1, 26, 29, 31, -1, -1, -1, -1, -1, -1, -1}, //SECURITY: Sawn-offs, MP5, M4
{0, -1, 24, 25, 32, -1, -1, -1, -1, -1, -1, -1, -1}, //SWAT: Deagle, Shotgun, Tec-9
{0, -1, 24, -1, 28, 31, -1, -1, -1, -1, -1, -1, -1}, //POLICE: Deagle, UZI, M4
{0, -1, -1, 27, 32, 30, -1, -1, -1, -1, -1, -1, -1}, //TERRORIST: Spas, AK-47, Tec-9
{0, -1, 24, 25, -1, -1, -1, -1, -1, -1, 10, -1, -1} //CIVILIAN: Purple Dildo, Desert Eagle, Shotgun
};
public OnFilterScriptInit()
{
WPTimer = SetTimer("WeaponChecker", 2000, true);
return 1;
}
public OnFilterScriptExit()
{
KillTimer(WPTimer);
return 1;
}
public WeaponChecker()
{
for(new i = 0; i<MAX_PLAYERS; i++)
{
new PInvalidWeapons[13] = {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1};
for(new w = 0; w < 13; w++)
{
new PWep, PAmmo;
GetPlayerWeaponData(i, w, PWep, PAmmo);
//Assign invalid shit to an array
if(PWep != ValidWeapons[PLAYERCLASS] && PWep != 0)
{
PInvalidWeapons[w] = PWep;
}
}
//Replace valid weapons with EMPTY = -1
if(IsPlayerVIP(i))
{
if(PInvalidWeapons[1] == 8 || PInvalidWeapons[1] == 9) PInvalidWeapons[1] = -1;
if(PInvalidWeapons[6] != -1) PInvalidWeapons[6] = -1;
}
if(PInvalidWeapons[8] == 16 || PInvalidWeapons[8] == 18) PInvalidWeapons[8] = -1;
if(PInvalidWeapons[11] == 46) PInvalidWeapons[11] = -1;
if(PInvalidWeapons[9] == 41) PInvalidWeapons[9] = -1;
for(new w = 0; w < 13; w++)
{
//If this happens, then that weapon was not cleared before, so its PROBABLY a hacked weapon
//Further additions should be made incase admins CAN actually give weapons to player
//or themselves
if(PInvalidWeapons[w] != -1)
{
//BAN THIS HACKER
//also break the loop
break;
}
}
}
}
Since I don't have time to built a similar to PTP class selection system, I can't test it, if Jonne likes it, he can test it himself.
Basically what this does is get the weapon ID from each slot and compare it against the class weapon slot set, if anything different is found, it is added to an array and compared against possible valid weapons (VIP weapons or things like grenade or parachute), if those weapons were added to the invalid array, they are removed. Any remaining invalid weapon in the array would mean that the dude is carrying something he is not supposed to, therefore, he/she can be banned.