SA-MP Forums Archive
A little problem with OnPlayerDeath() - 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: A little problem with OnPlayerDeath() (/showthread.php?tid=501068)



A little problem with OnPlayerDeath() - FilesMAker - 16.03.2014

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 ?


Re: A little problem with OnPlayerDeath() - Parallex - 16.03.2014

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



Re : A little problem with OnPlayerDeath() - FilesMAker - 16.03.2014

Код:
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


Re : A little problem with OnPlayerDeath() - anou1 - 16.03.2014

off topic but you should use switch

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


Re : A little problem with OnPlayerDeath() - FilesMAker - 16.03.2014

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