The Stock
pawn Код:
stock givePlayerValidWeapon(playerid, weapon) {
switch(weapon) {
case 0, 1: {
playerVariables[playerid][pWeapons][0] = weapon;
GivePlayerWeapon(playerid, weapon, 99999);
}
case 2, 3, 4, 5, 6, 7, 8, 9: {
playerVariables[playerid][pWeapons][1] = weapon;
GivePlayerWeapon(playerid, weapon, 99999);
}
case 22, 23, 24: {
playerVariables[playerid][pWeapons][2] = weapon;
GivePlayerWeapon(playerid, weapon, 100);
}
case 25, 26, 27: {
playerVariables[playerid][pWeapons][3] = weapon;
GivePlayerWeapon(playerid, weapon, 99999);
}
case 28, 29, 32: {
playerVariables[playerid][pWeapons][4] = weapon;
GivePlayerWeapon(playerid, weapon, 99999);
}
case 30, 31: {
playerVariables[playerid][pWeapons][5] = weapon;
GivePlayerWeapon(playerid, weapon, 99999);
}
case 33, 34: {
playerVariables[playerid][pWeapons][6] = weapon;
GivePlayerWeapon(playerid, weapon, 99999);
}
case 35, 36, 37, 38: {
playerVariables[playerid][pWeapons][7] = weapon;
GivePlayerWeapon(playerid, weapon, 99999);
}
case 16, 17, 18, 39: {
playerVariables[playerid][pWeapons][8] = weapon;
GivePlayerWeapon(playerid, weapon, 99999);
}
case 41, 42, 43: {
playerVariables[playerid][pWeapons][9] = weapon;
GivePlayerWeapon(playerid, weapon, 99999);
}
case 10, 11, 12, 13, 14, 15: {
playerVariables[playerid][pWeapons][10] = weapon;
GivePlayerWeapon(playerid, weapon, 99999);
}
case 44, 45, 46: {
playerVariables[playerid][pWeapons][11] = weapon;
GivePlayerWeapon(playerid, weapon, 99999);
}
case 40: {
playerVariables[playerid][pWeapons][12] = weapon;
GivePlayerWeapon(playerid, weapon, 99999);
}
}
return 1;
}
Stock removePlayerWeapon
pawn Код:
stock removePlayerWeapon(playerid, weapon) {
playerVariables[playerid][pAnticheatExemption] = 6;
switch(weapon) {
case 0, 1: {
if(playerVariables[playerid][pTabbed] >= 1) {
playerVariables[playerid][pOutstandingWeaponRemovalSlot] = 0;
}
else {
ResetPlayerWeapons(playerid);
playerVariables[playerid][pWeapons][0] = 0;
givePlayerWeapons(playerid);
}
}
case 2, 3, 4, 5, 6, 7, 8, 9: {
if(playerVariables[playerid][pTabbed] >= 1) {
playerVariables[playerid][pOutstandingWeaponRemovalSlot] = 1;
}
else {
ResetPlayerWeapons(playerid);
playerVariables[playerid][pWeapons][1] = 0;
givePlayerWeapons(playerid);
}
}
case 22, 23, 24: {
if(playerVariables[playerid][pTabbed] >= 1) {
playerVariables[playerid][pOutstandingWeaponRemovalSlot] = 2;
}
else {
ResetPlayerWeapons(playerid);
playerVariables[playerid][pWeapons][2] = 0;
givePlayerWeapons(playerid);
}
}
case 25, 26, 27: {
if(playerVariables[playerid][pTabbed] >= 1) {
playerVariables[playerid][pOutstandingWeaponRemovalSlot] = 3;
}
else {
ResetPlayerWeapons(playerid);
playerVariables[playerid][pWeapons][3] = 0;
givePlayerWeapons(playerid);
}
}
case 28, 29, 32: {
if(playerVariables[playerid][pTabbed] >= 1) {
playerVariables[playerid][pOutstandingWeaponRemovalSlot] = 4;
}
else {
ResetPlayerWeapons(playerid);
playerVariables[playerid][pWeapons][4] = 0;
givePlayerWeapons(playerid);
}
}
case 30, 31: {
if(playerVariables[playerid][pTabbed] >= 1) {
playerVariables[playerid][pOutstandingWeaponRemovalSlot] = 5;
}
else {
ResetPlayerWeapons(playerid);
playerVariables[playerid][pWeapons][5] = 0;
givePlayerWeapons(playerid);
}
}
case 33, 34: {
if(playerVariables[playerid][pTabbed] >= 1) {
playerVariables[playerid][pOutstandingWeaponRemovalSlot] = 6;
}
else {
ResetPlayerWeapons(playerid);
playerVariables[playerid][pWeapons][6] = 0;
givePlayerWeapons(playerid);
}
}
case 35, 36, 37, 38: {
if(playerVariables[playerid][pTabbed] >= 1) {
playerVariables[playerid][pOutstandingWeaponRemovalSlot] = 7;
}
else {
ResetPlayerWeapons(playerid);
playerVariables[playerid][pWeapons][7] = 0;
givePlayerWeapons(playerid);
}
}
case 16, 17, 18, 39: {
if(playerVariables[playerid][pTabbed] >= 1) {
playerVariables[playerid][pOutstandingWeaponRemovalSlot] = 8;
}
else {
ResetPlayerWeapons(playerid);
playerVariables[playerid][pWeapons][8] = 0;
givePlayerWeapons(playerid);
}
}
case 41, 42, 43: {
if(playerVariables[playerid][pTabbed] >= 1) {
playerVariables[playerid][pOutstandingWeaponRemovalSlot] = 9;
}
else {
ResetPlayerWeapons(playerid);
playerVariables[playerid][pWeapons][9] = 0;
givePlayerWeapons(playerid);
}
}
case 10, 11, 12, 13, 14, 15: {
if(playerVariables[playerid][pTabbed] >= 1) {
playerVariables[playerid][pOutstandingWeaponRemovalSlot] = 10;
}
else {
ResetPlayerWeapons(playerid);
playerVariables[playerid][pWeapons][10] = 0;
givePlayerWeapons(playerid);
}
}
case 44, 45, 46: {
if(playerVariables[playerid][pTabbed] >= 1) {
playerVariables[playerid][pOutstandingWeaponRemovalSlot] = 11;
}
else {
ResetPlayerWeapons(playerid);
playerVariables[playerid][pWeapons][11] = 0;
givePlayerWeapons(playerid);
}
}
case 40: {
if(playerVariables[playerid][pTabbed] >= 1) {
playerVariables[playerid][pOutstandingWeaponRemovalSlot] = 12;
}
else {
ResetPlayerWeapons(playerid);
playerVariables[playerid][pWeapons][12] = 0;
givePlayerWeapons(playerid);
}
}
}
return 1;
}
Public Anticheat
pawn Код:
public antiCheat() {
foreach(Player, i) {
if(playerVariables[i][pStatus] >= 1) {
if(GetPlayerSpecialAction(i) == SPECIAL_ACTION_USEJETPACK && playerVariables[i][pJetpack] == 0 && playerVariables[i][pAdminLevel] < 1) {
scriptBan(i, "Hacking (Jetpack)");
}
if(playerVariables[i][pAdminLevel] < 3 && playerVariables[i][pEvent] == 0 && playerVariables[i][pAnticheatExemption] == 0) {
if(GetPlayerWeapon(i) >= 1 && GetPlayerState(i) == 1) {
if(playerVariables[i][pWeapons][0] != 1 && GetPlayerWeapon(i) == 1) hackerTrigger(i);
if(playerVariables[i][pWeapons][1] != 2 && GetPlayerWeapon(i) == 2) hackerTrigger(i);
if(playerVariables[i][pWeapons][1] != 3 && GetPlayerWeapon(i) == 3) hackerTrigger(i);
if(playerVariables[i][pWeapons][1] != 4 && GetPlayerWeapon(i) == 4) hackerTrigger(i);
if(playerVariables[i][pWeapons][1] != 5 && GetPlayerWeapon(i) == 5) hackerTrigger(i);
if(playerVariables[i][pWeapons][1] != 6 && GetPlayerWeapon(i) == 6) hackerTrigger(i);
if(playerVariables[i][pWeapons][1] != 7 && GetPlayerWeapon(i) == 7) hackerTrigger(i);
if(playerVariables[i][pWeapons][1] != 8 && GetPlayerWeapon(i) == 8) hackerTrigger(i);
if(playerVariables[i][pWeapons][1] != 9 && GetPlayerWeapon(i) == 9) hackerTrigger(i);
if(playerVariables[i][pWeapons][2] != 22 && GetPlayerWeapon(i) == 22) hackerTrigger(i);
if(playerVariables[i][pWeapons][2] != 23 && GetPlayerWeapon(i) == 23) hackerTrigger(i);
if(playerVariables[i][pWeapons][2] != 24 && GetPlayerWeapon(i) == 24) hackerTrigger(i);
if(playerVariables[i][pWeapons][3] != 25 && GetPlayerWeapon(i) == 25) hackerTrigger(i);
if(playerVariables[i][pWeapons][3] != 26 && GetPlayerWeapon(i) == 26) hackerTrigger(i);
if(playerVariables[i][pWeapons][3] != 27 && GetPlayerWeapon(i) == 27) hackerTrigger(i);
if(playerVariables[i][pWeapons][4] != 28 && GetPlayerWeapon(i) == 28) hackerTrigger(i);
if(playerVariables[i][pWeapons][4] != 29 && GetPlayerWeapon(i) == 29) hackerTrigger(i);
if(playerVariables[i][pWeapons][4] != 32 && GetPlayerWeapon(i) == 32) hackerTrigger(i);
if(playerVariables[i][pWeapons][5] != 30 && GetPlayerWeapon(i) == 30) hackerTrigger(i);
if(playerVariables[i][pWeapons][5] != 31 && GetPlayerWeapon(i) == 31) hackerTrigger(i);
if(playerVariables[i][pWeapons][6] != 33 && GetPlayerWeapon(i) == 33) hackerTrigger(i);
if(playerVariables[i][pWeapons][6] != 34 && GetPlayerWeapon(i) == 34) hackerTrigger(i);
if(playerVariables[i][pWeapons][7] != 35 && GetPlayerWeapon(i) == 35) hackerTrigger(i);
if(playerVariables[i][pWeapons][7] != 36 && GetPlayerWeapon(i) == 36) hackerTrigger(i);
if(playerVariables[i][pWeapons][7] != 37 && GetPlayerWeapon(i) == 37) hackerTrigger(i);
if(playerVariables[i][pWeapons][7] != 38 && GetPlayerWeapon(i) == 38) hackerTrigger(i);
if(playerVariables[i][pWeapons][8] != 16 && GetPlayerWeapon(i) == 16) hackerTrigger(i);
if(playerVariables[i][pWeapons][8] != 17 && GetPlayerWeapon(i) == 17) hackerTrigger(i);
if(playerVariables[i][pWeapons][8] != 18 && GetPlayerWeapon(i) == 18) hackerTrigger(i);
if(playerVariables[i][pWeapons][8] != 39 && GetPlayerWeapon(i) == 39) hackerTrigger(i);
if(playerVariables[i][pWeapons][9] != 41 && GetPlayerWeapon(i) == 41) hackerTrigger(i);
if(playerVariables[i][pWeapons][9] != 42 && GetPlayerWeapon(i) == 42) hackerTrigger(i);
if(playerVariables[i][pWeapons][9] != 43 && GetPlayerWeapon(i) == 43) hackerTrigger(i);
if(playerVariables[i][pWeapons][10] != 10 && GetPlayerWeapon(i) == 10) hackerTrigger(i);
if(playerVariables[i][pWeapons][10] != 11 && GetPlayerWeapon(i) == 11) hackerTrigger(i);
if(playerVariables[i][pWeapons][10] != 12 && GetPlayerWeapon(i) == 12) hackerTrigger(i);
if(playerVariables[i][pWeapons][10] != 13 && GetPlayerWeapon(i) == 13) hackerTrigger(i);
if(playerVariables[i][pWeapons][10] != 14 && GetPlayerWeapon(i) == 14) hackerTrigger(i);
if(playerVariables[i][pWeapons][10] != 15 && GetPlayerWeapon(i) == 15) hackerTrigger(i);
if(playerVariables[i][pWeapons][11] != 44 && GetPlayerWeapon(i) == 44) hackerTrigger(i);
if(playerVariables[i][pWeapons][11] != 45 && GetPlayerWeapon(i) == 45) hackerTrigger(i);
if(playerVariables[i][pWeapons][11] != 46 && GetPlayerWeapon(i) == 46) hackerTrigger(i);
if(playerVariables[i][pWeapons][12] != 40 && GetPlayerWeapon(i) == 40) hackerTrigger(i);
}
else if(eventVariables[eEventStat] != 0) { // Event anticheat - check 5 event weapon slots, checks if the weapon is valid (in case of a bug).
new
wep = GetPlayerWeapon(i); // so we don't call getplayerweapon a million times!1
if(eventVariables[eEventWeapons][0] != wep && eventVariables[eEventWeapons][1] != wep && eventVariables[eEventWeapons][2] != wep && eventVariables[eEventWeapons][3] != wep && eventVariables[eEventWeapons][4] != wep) { // Valid weapon check (in case someone has admin weapons)
if(playerVariables[i][pWeapons][GetWeaponSlot(wep)] != wep) hackerTrigger(i);
}
}
}
}
}
return 1;
}
pawn Код:
stock hackerTrigger(playerid) {
if(playerVariables[playerid][pTabbed] == 0) {
playerVariables[playerid][pHackWarnings]++;
playerVariables[playerid][pHackWarnTime] = 1;
printf("Hack Warning! Weapon %d (playerid: %d)", GetPlayerWeapon(playerid), playerid);
if(playerVariables[playerid][pHackWarnings] >= 3) {
new
wep = GetPlayerWeapon(playerid),
reason[94];
GetPlayerName(playerid, szPlayerName, MAX_PLAYER_NAME);
format(reason, sizeof(reason), "[uRP - ADM] {FFFFFF}%s provavelmente estб usando Weapon Hacking (%s).", szPlayerName, WeaponNames[wep]);
submitToAdmins(reason, COLOR_HOTORANGE);
if(playerVariables[playerid][pHackWarnings] >= MAX_WEAPON_HACK_WARNINGS) {
format(reason, sizeof(reason), "Weapon Hacking (%s).", WeaponNames[wep]);
scriptBan(playerid, reason);
}
}
}
return 1;
}
Ok, but the problem is: He doesn't say that the player is using weapon hack - as is right without ammo - it simply removes the weapon.