Discord sunucumuz açılmıştır, hepinizi bekleriz

https://discord.gg/43gGDQe6tS

basit istek

Eklenti sorunlarınız ve özel eklenti istekleriniz

Moderatör: Moderatörler


Konu Sahibi
rexluc
Mesajlar: 34
Kayıt: Prş Haz 30, 2016 4:46 pm

basit istek

Mesaj gönderen rexluc »

bilalgecer47 yazdı: Sal Mar 01, 2022 1:07 pm

Kod: Tümünü seç

#pragma semicolon 1

#include <amxmodx>
#include <reapi>

new bool:g_blPlayerAFK[MAX_PLAYERS+1];

public plugin_init(){
	register_plugin("Is Player AFK", "0.1", "` BesTCore;"); /*Duzenleme: By.KinG*/

	RegisterHookChain(RG_CBasePlayer_Spawn, "RG_CBasePlayer_Spawn_Post", .post = true);

	register_clcmd("say /afk", "clcmd_afk");
	
	sorun aynı kral afk yazınca direkt kill cekiyor frag -1 oluyor frag 0 olarak kalmıyor 
	
	register_clcmd("say", "clcmd_say");
	register_clcmd("say_team", "clcmd_say");
}
public clcmd_say(const id){
	if(g_blPlayerAFK[id]){
		client_print_color(id, id, "^3Afk sisteminde oldugunuz icin mesajlasamassiniz, cikis yapmak icin^4 /afk^3 yaziniz.");
		return PLUGIN_HANDLED;
	}
	return PLUGIN_CONTINUE;
}
public RG_CBasePlayer_Spawn_Post(const id){
	if(get_member(id, m_bJustConnected)){
		return;
	}

	if(g_blPlayerAFK[id]){
		set_task(1.0, "UserKill", id);
	}
}
public UserKill(id){
	client_print_color(id, id, "^3Afk sisteminde oldugun icin slaylandin, cikis yapmak icin^4 /afk^3 yaziniz.");
	user_kill(id, 1);
	set_entvar(id, var_frags, 0.0);
	set_member(id,m_iDeaths,0);
}
public clcmd_afk(const id){
	if(g_blPlayerAFK[id]){
		client_print_color(id, id, "^3Basarili bir sekilde afk sisteminden cikis yaptiniz.");
		g_blPlayerAFK[id] = false;
		return PLUGIN_HANDLED;
	}
	else {
		g_blPlayerAFK[id] = true;
		client_print_color(id, id, "^3Afk sistemine giris yaptiniz, her el basi slaylanacak ve artik mesaj atamayacaksiniz.");
		
		if(is_user_alive(id))
		{
			set_task(1.0, "UserKill", id);
		}
	}
	return PLUGIN_HANDLED;
}
public client_disconnected(id){
	g_blPlayerAFK[id] = false;
}
sorun aynı hocam frag -1 oluyor afk yazınca direk 0 olarak kalması gerekiyor. pluginleri kapatıp denedik aynı

Link:
Linklerini gizle
Linki Kopyala
Kullanıcı avatarı

bilalgecer47
Mesajlar: 729
Kayıt: Çrş Ağu 22, 2018 9:20 pm

basit istek

Mesaj gönderen bilalgecer47 »

Kod: Tümünü seç

#pragma semicolon 1

#include <amxmodx>
#include <reapi>

new bool:g_blPlayerAFK[MAX_PLAYERS+1];

public plugin_init(){
	register_plugin("Is Player AFK", "0.1", "` BesTCore;"); /*Duzenleme: By.KinG*/

	RegisterHookChain(RG_CBasePlayer_Spawn, "RG_CBasePlayer_Spawn_Post", .post = true);

	register_clcmd("say /afk", "clcmd_afk");
		
	register_clcmd("say", "clcmd_say");
	register_clcmd("say_team", "clcmd_say");
}
public clcmd_say(const id){
	if(g_blPlayerAFK[id]){
		client_print_color(id, id, "^3Afk sisteminde oldugunuz icin mesajlasamassiniz, cikis yapmak icin^4 /afk^3 yaziniz.");
		return PLUGIN_HANDLED;
	}
	return PLUGIN_CONTINUE;
}
public RG_CBasePlayer_Spawn_Post(const id){
	if(get_member(id, m_bJustConnected)){
		return;
	}

	if(g_blPlayerAFK[id]){
		set_task(1.0, "UserKill", id);
	}
}
public UserKill(id){
	client_print_color(id, id, "^3Afk sisteminde oldugun icin slaylandin, cikis yapmak icin^4 /afk^3 yaziniz.");
	user_kill(id, 1);
	set_entvar(id, var_frags, 0.0);
	set_member(id,m_iDeaths,0);
	message_begin(MSG_ALL,85);
	write_byte(id);
	write_short(0);write_short(0);write_short(0);write_short(0);
	message_end();
}
public clcmd_afk(const id){
	if(g_blPlayerAFK[id]){
		client_print_color(id, id, "^3Basarili bir sekilde afk sisteminden cikis yaptiniz.");
		g_blPlayerAFK[id] = false;
		return PLUGIN_HANDLED;
	}
	else {
		g_blPlayerAFK[id] = true;
		client_print_color(id, id, "^3Afk sistemine giris yaptiniz, her el basi slaylanacak ve artik mesaj atamayacaksiniz.");
		
		if(is_user_alive(id))
		{
			set_task(1.0, "UserKill", id);
		}
	}
	return PLUGIN_HANDLED;
}
public client_disconnected(id){
	g_blPlayerAFK[id] = false;
}

Link:
Linklerini gizle
Linki Kopyala
Cevapla