[CERERE] Vip for kill

Categoria cu cereri de pluginuri si nu numai.

Moderators: Moderatori ajutatori, Moderatori, Echipa eXtreamCS.com

Forum rules
Accesează link-ul pentru a putea vedea regulile forumului

Daca doriti sa vi se modifice un plugin, va rugam postati aici .
Post Reply
al3xz3t24
Membru, skill 0
Membru, skill 0
Posts: 35
Joined: 05 Feb 2018, 02:15
Detinator Steam: Nu
CS Status: Citesc forumul eXtreamCS.com...!
Fond eXtream: 0
Contact:

15 Feb 2018, 22:23

Salut, imi poate da cineva un plugin pentru a primi vip pentru kill-uri? adica la fiecare kill facut sa scrie in chat MAI AI X KILL-URI PANA VEI PRIMI VIP si sa fie un total de 1500 kill-uri...va rog...sa ofere flagurile by daca se poate, l-am vazut pe mai multe servere, daca ma poate ajuta cineva, as ramane vesnic recunoscator. Multumesc <3
RoyalServer
User avatar
DaNNe.
Fost moderator
Fost moderator
Posts: 2811
Joined: 08 Nov 2013, 20:43
Detinator Steam: Da
CS Status: Activitate scăzută
SteamID: /id/FurienMaster
Reputatie: Nick anterior: DnD. Gold, Emrys
0.5/3
Fost moderator ajutator
Fost Membru Club eXtreamCS (doua luni)
Has thanked: 244 times
Been thanked: 129 times
Contact:

18 Feb 2018, 16:55

| Afiseaza codul
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <hamsandwich>
#include <fakemeta>

#define PLUGIN	"VIP for Kills"
#define VERSION "1.0"
#define AUTHOR "DaNNe." // Da, am scris un cod fara multe spatii :(

new PlayerKills[33],
	KillsFile[128],
	bool: IsVIP[33],
	cvar_kills
	
public plugin_init() {
	register_plugin(PLUGIN, VERSION, AUTHOR)
	
	cvar_kills	=	register_cvar("cvar_needed_kills",	"1500")
	
	register_forward(FM_ClientUserInfoChanged, "FWD_ChangeName");
	
	register_event("DeathMsg", 		"EVENT_Death", 			"a");
	
	new DataDir[64],	
		DataLen		=	charsmax(DataDir),
		FileLen		=	charsmax(KillsFile)
	get_datadir(DataDir, DataLen)
	format(KillsFile, FileLen, "%s/PlayerKills.dat", DataDir)
	
}

public client_putinserver(id)
	LoadData(id)

public client_disconnect(id) 
	SaveData(id)

public FWD_ChangeName(id, buffer) {
	if(!is_user_connected(id))
		return FMRES_IGNORED;
	
	static Name[32], Val[32];
	get_user_name(id, Name, sizeof Name - 1);
	engfunc(EngFunc_InfoKeyValue, buffer, "name", Val, sizeof Val - 1);
	
	if(equal(Val, Name))
		return FMRES_IGNORED;
	
	SaveData(id)
	LoadData(id)
	return FMRES_SUPERCEDE;
}

public EVENT_Death() {
	new Killer	=	read_data(1),
		Victim	=	read_data(2)
	if(is_user_connected(Killer) && Killer != Victim) {
		if(!IsVIP[Killer]) {
			PlayerKills[Killer]++
			if(PlayerKills[Killer] >= get_pcvar_num(cvar_kills)) {
				ColorChat(Killer,	"!g[KILL BONUS]!n Ai primit!t VIP!n pentru ca ai facut!t %d kill-uri!n.", get_pcvar_num(cvar_kills))
				SetVIP(Killer)
			}
		}
	}
}

public SaveData(id) {
	new Name[32];
	get_user_name(id, Name, 31);
	
	static Data[1024]
	formatex(Data, sizeof(Data) - 1, "^"%i^"", PlayerKills[id])
	
	new Save[512]
	format(Save, 511, "^"%s^" %s", Name, Data)
	
	new Line[128], Linie, IsPlayer = false, Arg1[32]
	
	new FileOpen = fopen(KillsFile, "rt")
	while(!feof(FileOpen)) {
		fgets(FileOpen, Line, 127)
		trim(Line)
		
		parse(Line, Arg1, 31)
		
		if (equali(Arg1, Name)) {
			write_file(KillsFile, Save, Linie)
			IsPlayer = true
			break
		}
		
		Linie++
	}
	fclose(FileOpen)
	if (!IsPlayer) {
		write_file(KillsFile, Save, -1)
	}
}

public LoadData(id) {
	new Name[32];
	get_user_name(id, Name, 31);
	
	new Line[128], IsPlayer = false, Arg1[32], Arg2[32];
	
	new FileOpen = fopen(KillsFile, "rt")
	while(!feof(FileOpen)) {
		fgets(FileOpen, Line, 127)
		trim(Line)
		
		parse(Line, Arg1, 31, Arg2, 31)
		
		if (equali(Arg1, Name)) {
			PlayerKills[id] = str_to_num(Arg2)
			IsPlayer = true
			if(PlayerKills[id] >= get_pcvar_num(cvar_kills))
				SetVIP(id)
			break
		}
	}
	fclose(FileOpen)
	
	if (!IsPlayer) {
		PlayerKills[id] = 0
	}
}

public SetVIP(id) {
	if(is_user_connected(id)) {
		if(PlayerKills[id] >= get_pcvar_num(cvar_kills)) {
			IsVIP[id] = true;
			set_user_flags(id, read_flags("by"))
		}
	}
}

stock ColorChat(const id, const input[], any:...) {
	new count = 1, players[32];
	static msg[191];
	vformat(msg, 190, input, 3);
	
	replace_all(msg, 190, "!g", "^4");
	replace_all(msg, 190, "!n", "^1");
	replace_all(msg, 190, "!t", "^3");
	
	if(id) players[0] = id;
	else get_players(players, count, "ch"); {
		for(new i = 0; i < count; i++) {
			if(is_user_connected(players)) {
				message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players);
				write_byte(players);
				write_string(msg);
				message_end();
			}
		}
	} 
}
al3xz3t24
Membru, skill 0
Membru, skill 0
Posts: 35
Joined: 05 Feb 2018, 02:15
Detinator Steam: Nu
CS Status: Citesc forumul eXtreamCS.com...!
Fond eXtream: 0
Contact:

19 Feb 2018, 01:38

DaNNe. wrote:
| Afiseaza codul
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <hamsandwich>
#include <fakemeta>

#define PLUGIN	"VIP for Kills"
#define VERSION "1.0"
#define AUTHOR "DaNNe." // Da, am scris un cod fara multe spatii :(

new PlayerKills[33],
	KillsFile[128],
	bool: IsVIP[33],
	cvar_kills
	
public plugin_init() {
	register_plugin(PLUGIN, VERSION, AUTHOR)
	
	cvar_kills	=	register_cvar("cvar_needed_kills",	"1500")
	
	register_forward(FM_ClientUserInfoChanged, "FWD_ChangeName");
	
	register_event("DeathMsg", 		"EVENT_Death", 			"a");
	
	new DataDir[64],	
		DataLen		=	charsmax(DataDir),
		FileLen		=	charsmax(KillsFile)
	get_datadir(DataDir, DataLen)
	format(KillsFile, FileLen, "%s/PlayerKills.dat", DataDir)
	
}

public client_putinserver(id)
	LoadData(id)

public client_disconnect(id) 
	SaveData(id)

public FWD_ChangeName(id, buffer) {
	if(!is_user_connected(id))
		return FMRES_IGNORED;
	
	static Name[32], Val[32];
	get_user_name(id, Name, sizeof Name - 1);
	engfunc(EngFunc_InfoKeyValue, buffer, "name", Val, sizeof Val - 1);
	
	if(equal(Val, Name))
		return FMRES_IGNORED;
	
	SaveData(id)
	LoadData(id)
	return FMRES_SUPERCEDE;
}

public EVENT_Death() {
	new Killer	=	read_data(1),
		Victim	=	read_data(2)
	if(is_user_connected(Killer) && Killer != Victim) {
		if(!IsVIP[Killer]) {
			PlayerKills[Killer]++
			if(PlayerKills[Killer] >= get_pcvar_num(cvar_kills)) {
				ColorChat(Killer,	"!g[KILL BONUS]!n Ai primit!t VIP!n pentru ca ai facut!t %d kill-uri!n.", get_pcvar_num(cvar_kills))
				SetVIP(Killer)
			}
		}
	}
}

public SaveData(id) {
	new Name[32];
	get_user_name(id, Name, 31);
	
	static Data[1024]
	formatex(Data, sizeof(Data) - 1, "^"%i^"", PlayerKills[id])
	
	new Save[512]
	format(Save, 511, "^"%s^" %s", Name, Data)
	
	new Line[128], Linie, IsPlayer = false, Arg1[32]
	
	new FileOpen = fopen(KillsFile, "rt")
	while(!feof(FileOpen)) {
		fgets(FileOpen, Line, 127)
		trim(Line)
		
		parse(Line, Arg1, 31)
		
		if (equali(Arg1, Name)) {
			write_file(KillsFile, Save, Linie)
			IsPlayer = true
			break
		}
		
		Linie++
	}
	fclose(FileOpen)
	if (!IsPlayer) {
		write_file(KillsFile, Save, -1)
	}
}

public LoadData(id) {
	new Name[32];
	get_user_name(id, Name, 31);
	
	new Line[128], IsPlayer = false, Arg1[32], Arg2[32];
	
	new FileOpen = fopen(KillsFile, "rt")
	while(!feof(FileOpen)) {
		fgets(FileOpen, Line, 127)
		trim(Line)
		
		parse(Line, Arg1, 31, Arg2, 31)
		
		if (equali(Arg1, Name)) {
			PlayerKills[id] = str_to_num(Arg2)
			IsPlayer = true
			if(PlayerKills[id] >= get_pcvar_num(cvar_kills))
				SetVIP(id)
			break
		}
	}
	fclose(FileOpen)
	
	if (!IsPlayer) {
		PlayerKills[id] = 0
	}
}

public SetVIP(id) {
	if(is_user_connected(id)) {
		if(PlayerKills[id] >= get_pcvar_num(cvar_kills)) {
			IsVIP[id] = true;
			set_user_flags(id, read_flags("by"))
		}
	}
}

stock ColorChat(const id, const input[], any:...) {
	new count = 1, players[32];
	static msg[191];
	vformat(msg, 190, input, 3);
	
	replace_all(msg, 190, "!g", "^4");
	replace_all(msg, 190, "!n", "^1");
	replace_all(msg, 190, "!t", "^3");
	
	if(id) players[0] = id;
	else get_players(players, count, "ch"); {
		for(new i = 0; i < count; i++) {
			if(is_user_connected(players)) {
				message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players);
				write_byte(players);
				write_string(msg);
				message_end();
			}
		}
	} 
}

Code: Select all

Iti multumesc din suflet man, dar, kill-urile raman salvate dupa deconectare? :D Oricum testez, dar vreau sa stiu si parerea ta :D Si flagurile pentru vip?
 pe ce baza le da? nick - password sau..? :-??
al3xz3t24
Membru, skill 0
Membru, skill 0
Posts: 35
Joined: 05 Feb 2018, 02:15
Detinator Steam: Nu
CS Status: Citesc forumul eXtreamCS.com...!
Fond eXtream: 0
Contact:

19 Feb 2018, 16:21

Salut...te rog...poti adauga in script sa scrie in chat Mai ai de omorat x playeri pentru a primi gradul de vip-silver? la fiecare kill facut? Daca nu vrei, da-mi un pm cu un pret pentru tot pluginul te rog frumos. Multumesc.
User avatar
YONTU
Scripter eXtreamCS
Scripter eXtreamCS
Posts: 2466
Joined: 10 May 2013, 14:25
Detinator Steam: Nu
CS Status: Everyone is looking at ur shoes
Reputatie: Moderator ajutator
Fost scripter eXtreamCS
Location: Gura Humorului
Has thanked: 256 times
Been thanked: 288 times
Contact:

19 Feb 2018, 17:19

La EVENT_Death(), adauga dupa linia PlayerKills[Killer]++ urmatoarea linie:

Code: Select all

ColorChat(Killer, "!g[KILL BONUS]!n Mai ai nevoie de %d killuri pentru a obtine VIP.", get_pcvar_num(cvar_kills) - PlayerKills[Killer]);
Sunt pe tel
Last edited by YONTU on 19 Feb 2018, 20:11, edited 1 time in total.
„Peste douăzeci de ani vei fi dezamăgit din cauza lucrurilor pe care nu le-ai făcut, nu din cauza celor pe care le-ai făcut.” - Mark Twain
„Asa e si in viata, hotii castiga, prostii care invata pierd.” - Mihai Nemeș


Bio.LeagueCs.Ro - Biohazard v4.4 Xmas Edition
discord: IonutC#5114

Experinta in: Java/Spring boot/Angular/C/C++/C#/Javascript/Python/HTML/CSS/Pawn/SQL
Ai nevoie de ajutorul meu? Ma poti gasi doar la adresa de discord de mai sus.
al3xz3t24
Membru, skill 0
Membru, skill 0
Posts: 35
Joined: 05 Feb 2018, 02:15
Detinator Steam: Nu
CS Status: Citesc forumul eXtreamCS.com...!
Fond eXtream: 0
Contact:

19 Feb 2018, 19:55

Image

Imi da eroarea asta la compilare.. :(
User avatar
DaNNe.
Fost moderator
Fost moderator
Posts: 2811
Joined: 08 Nov 2013, 20:43
Detinator Steam: Da
CS Status: Activitate scăzută
SteamID: /id/FurienMaster
Reputatie: Nick anterior: DnD. Gold, Emrys
0.5/3
Fost moderator ajutator
Fost Membru Club eXtreamCS (doua luni)
Has thanked: 244 times
Been thanked: 129 times
Contact:

20 Feb 2018, 00:22

Scrie "Killer" în loc la "iKiller". Și eu sunt tot pe telefon.
al3xz3t24
Membru, skill 0
Membru, skill 0
Posts: 35
Joined: 05 Feb 2018, 02:15
Detinator Steam: Nu
CS Status: Citesc forumul eXtreamCS.com...!
Fond eXtream: 0
Contact:

20 Feb 2018, 11:46

Va multumesc din suflet amandurora pentru ajutor <3 Raman vesnic dator :* Functioneaza mai mult ca perfect <3

P.S. Flagurile de vip? pe ce baza le da si unde? in users? ii pune sa puna parola sau ceva? le da pe ip? sau cum functioneaza toata treaba?
User avatar
YONTU
Scripter eXtreamCS
Scripter eXtreamCS
Posts: 2466
Joined: 10 May 2013, 14:25
Detinator Steam: Nu
CS Status: Everyone is looking at ur shoes
Reputatie: Moderator ajutator
Fost scripter eXtreamCS
Location: Gura Humorului
Has thanked: 256 times
Been thanked: 288 times
Contact:

20 Feb 2018, 13:55

Cand jucatorul are killurile necesare, la conectarea pe server, acesta este recunoscut ca vip si i se atribuie direct flagurile by. Nu este trecut in niciun fisier.
„Peste douăzeci de ani vei fi dezamăgit din cauza lucrurilor pe care nu le-ai făcut, nu din cauza celor pe care le-ai făcut.” - Mark Twain
„Asa e si in viata, hotii castiga, prostii care invata pierd.” - Mihai Nemeș


Bio.LeagueCs.Ro - Biohazard v4.4 Xmas Edition
discord: IonutC#5114

Experinta in: Java/Spring boot/Angular/C/C++/C#/Javascript/Python/HTML/CSS/Pawn/SQL
Ai nevoie de ajutorul meu? Ma poti gasi doar la adresa de discord de mai sus.
Post Reply

Return to “Cereri”

  • Information