A little problem with OnPlayerDeath()
#1

I made an auto weapon hack detector, that see the reason of death and compare it with vip levels and duty. I have set on vip levels : molotovs for VIP lvl 1 and flamethrower on VIP lvl 2, the problem is when a player vip 1 uses molotov to kill someone OnPlayerDeath() return as reason flamethrower id.

I' searching for a solution without using GetPlayerWeapon() function because i used it and it bans 50 players, it return a false weapon id.

Could you help me ?
Reply
#2

Can you please supply your
pawn Код:
public OnPlayerDeath
Reply
#3

Код:
forward WeaponHackDetector(playerid, reason);
public WeaponHackDetector(playerid, reason)
{
    if(NotAllowedWeapToBan[playerid]) return 1;
    
    if(reason == 18) {  // Molotovs
        if(PlayerInfo[playerid][VLvlVIP] < X) NotAllowedWeaponBan(playerid, reason);

    }else if(reason == 27) {  //Combat Shotgun
        if(PlayerInfo[playerid][VLvlVIP] < X) NotAllowedWeaponBan(playerid, reason);

    }else if(reason == 28) {  //Micro SMG/Uzi
        if(PlayerInfo[playerid][VLvlVIP] < X) NotAllowedWeaponBan(playerid, reason);

    }else if(reason == 29) {  //MP5
        if(PlayerInfo[playerid][VLvlVIP] < X) NotAllowedWeaponBan(playerid, reason);

    }else if(reason == 32) {  //Tec-9
        if(PlayerInfo[playerid][VLvlVIP] < X) NotAllowedWeaponBan(playerid, reason);

    }else if(reason == 35) {  //RPG
        if(PlayerInfo[playerid][VLvlVIP] < X) NotAllowedWeaponBan(playerid, reason);

    }else if(reason == 36) {  //HS Rocket
        if(PlayerInfo[playerid][VLvlVIP] < X) NotAllowedWeaponBan(playerid, reason);

    }else if(reason == 37) {  //Flamethrower
        if(PlayerInfo[playerid][VLvlVIP] < X) NotAllowedWeaponBan(playerid, reason);

    }else if(reason == 38) { //Minigun
    	if(PlayerInfo[playerid][VLvlVIP] < X)
		{
			//if(MiniDutyJump[playerid] == 0)
			//{
			if(PlayerInfo[playerid][VDuty] != 1) NotAllowedWeaponBan(playerid, reason);
			//}
		}

    }else if(reason == 39) { //Satchel Charge
        if(PlayerInfo[playerid][VLvlVIP] < X) NotAllowedWeaponBan(playerid, reason);
	}

	return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
     WeaponHackDetector(killerid, reason);
}
Note : X is a specific level for VIP
Reply
#4

off topic but you should use switch

https://sampwiki.blast.hk/wiki/Control_Structures#switch
Reply
#5

your true, I was so busy and i forget it i ll update it. but my problem is molotovs and flame thrower
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)