Merhabalar Silah hilesini engellemek için en performanslı yolu paylaşmak istedim. Sistemin çalışma mantığı şudur ; Kullanıcıya silah verildiğinde Pvar değerini 1 yapıp ateş ettiğinde kontrol ediliyor. Eğer pvar değeri 1 değilse işlem yapılıyor.
Kodları moda geçirmeden önce GivePlayerWeapon fonksiyonlarınızı GivePlayerWeaponEx ve ResetPlayerWeapons fonksiyonlarınızı ResetWeapons olarak değiştiriniz.
public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
{
new weapname[32];
GetWeaponName(weaponid, weapname, sizeof(weapname));
if(GetPVarInt(playerid, weapname) < 1)
{
new str2[128];
format(str2,sizeof(str2),"[ANTI HILE]%s(%d) adlı kullanıcı oyundan atıldı. Sebep : Silah hilesi (%s).",Pname(playerid),playerid,weapname);
SendClientMessageToAll(-1,str2);
SetPVarInt(playerid, weapname, GetPVarInt(playerid, weapname) -1);
ResetWeapons(playerid);
DelayedKick(playerid,10);
return 0;
}
return 1;
}
stock GivePlayerWeaponEx(playerid, weapid, ammo)
{
new gunname[32];
GivePlayerWeapon(playerid, weapid, ammo);
GetWeaponName(weapid, gunname, sizeof(gunname));
SetPVarInt(playerid, gunname, GetPVarInt(playerid, gunname) +ammo);
}
stock ResetWeapons(playerid)
{
SetPVarInt(playerid, "Brass Knuckles", 0);
SetPVarInt(playerid, "Golf Club", 0);
SetPVarInt(playerid, "Nite Stick", 0);
SetPVarInt(playerid, "Knife", 0);
SetPVarInt(playerid, "Baseball Bat", 0);
SetPVarInt(playerid, "Shovel", 0);
SetPVarInt(playerid, "Pool Cue", 0);
SetPVarInt(playerid, "Katana", 0);
SetPVarInt(playerid, "Chainsaw", 0);
SetPVarInt(playerid, "Heat Seaker", 0);
SetPVarInt(playerid, "Dildo", 0);
SetPVarInt(playerid, "Vibrator", 0);
SetPVarInt(playerid, "Flowers", 0);
SetPVarInt(playerid, "Cane", 0);
SetPVarInt(playerid, "Teargas", 0);
SetPVarInt(playerid, "Bomb", 0);
SetPVarInt(playerid, "HS Rocket", 0);
SetPVarInt(playerid, "Flamethrower", 0);
SetPVarInt(playerid, "Satchel Explosives", 0);
SetPVarInt(playerid, "Spray Can", 0);
SetPVarInt(playerid, "Fire Extinguisher", 0);
SetPVarInt(playerid, "Camera", 0);
SetPVarInt(playerid, "Night Vis Goggles", 0);
SetPVarInt(playerid, "Thermal Goggles", 0);
SetPVarInt(playerid, "Grenade", 0);
SetPVarInt(playerid, "Molotov Cocktail", 0);
SetPVarInt(playerid, "Colt 45", 0);
SetPVarInt(playerid, "Silenced Pistol", 0);
SetPVarInt(playerid, "Desert Eagle", 0);
SetPVarInt(playerid, "Shotgun", 0);
SetPVarInt(playerid, "Sawn-off Shotgun", 0);
SetPVarInt(playerid, "Combat Shotgun", 0);
SetPVarInt(playerid, "UZI", 0);
SetPVarInt(playerid, "MP5", 0);
SetPVarInt(playerid, "AK47", 0);
SetPVarInt(playerid, "M4", 0);
SetPVarInt(playerid, "Tec9", 0);
SetPVarInt(playerid, "Rifle", 0);
SetPVarInt(playerid, "Sniper Rifle", 0);
SetPVarInt(playerid, "Rocket Launcher", 0);
SetPVarInt(playerid, "Minigun", 0);
ResetPlayerWeapons(playerid);
}
//-----------------------------------------------------
forward _KickPlayerDelayed(playerid);
public _KickPlayerDelayed(playerid)
{
Kick(playerid);
return 1;
}
DelayedKick(playerid, time = 500)
{
SetTimerEx("_KickPlayerDelayed", time, false, "d", playerid);
return 1;
}
reyiz yapmış hll
Reyiz paylaşmış helal.
Paylaşım için teşekkürler.
OnPlayerWeaponShot her zaman doğru sonucu vermez, emeğine sağlık.
Alıntı yapılan: cngznNN - 10 Mart 2019, 19:49:33
OnPlayerWeaponShot her zaman doğru sonucu vermez, emeğine sağlık.
Doğru sonuçtan kastın ince işlemlerde olsa gerek, Publicte sadece silah adı kontrolü yapılıyor pek çıkmaz.
Çoğu kişinin işine yarayabilecek bir paylaşım eline sağlık.
Backup işi biliyor.
Yine yapmışsın, yorum yapmadan kullananlar size de selam.
Teşekkürler
Paylaşım için Teşekkürler.
Teşekkürler.
Eline sağlık teşekkürler.
Teşekkürler, umarım 0.3DL versiyonunda çalışıyordur.
Teşekkürler. :helal:
Yararlı.