Compilare plugin credite

Modificari necesare ale pluginurilor

Moderators: Moderatori ajutatori, Moderatori

Post Reply
Pegasus6ix
Membru, skill 0
Membru, skill 0
Posts: 20
Joined: 11 Nov 2018, 23:25
Detinator Steam: Nu
CS Status: Citesc forumul eXtreamCS.com...!
Fond eXtream: 0
Has thanked: 7 times
Contact:

31 Jul 2019, 01:28

Salut imi poate compila si mie cineva pluginul de credite a lui Aragon, sau mi-l poate da cineva .amxx daca va rog ?

Sursa :
| Afiseaza codul
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <dhudmessage>
#include <fakemeta>

#define PLUGIN  "Depozit Mooney"
#define AUTHOR  "Aragon*"
#define VERSION "1.0"

new PlayerCredits[33];
new File[128], SymbolsName;

public plugin_init() {      
	register_plugin( PLUGIN, VERSION, AUTHOR );
	register_forward(FM_ClientUserInfoChanged, "ChangeName");
	SymbolsName = register_cvar("fr_name_symbols", "~`"); 	//| Symbols Name Restricted |//	
	
	register_clcmd("say", "Check");
	register_clcmd("say_team", "Check");
	register_clcmd("depozit","Depozit")
	register_clcmd("say /depozit","Depozit")
	register_clcmd("say_team /depozit","Depozit")
	register_clcmd("retrage","Retrage")
	register_clcmd("say /retrage","Retrage")
	register_clcmd("say_team /retrage","Retrage")
	register_clcmd("amx_give", "GiveCredits");
	
	register_concmd("amx_give_credits", "Give_Credits", ADMIN_CVAR, "Name/@T/@CT/@All -> Amount");
	register_concmd("amx_reset_credits", "Reset_Credits", ADMIN_CVAR, "Name/@T/@CT/@All");
	
	new DataDir[64]
	get_datadir(DataDir, 63)
	format(File, 127, "%s/FurienCredits.dat", DataDir)
	
	set_task(0.5, "TASK_ShowCredits", _, _, _, "b")
}
public plugin_natives() {
	register_native("set_user_credits", "set_user_credits", 1);
	register_native("get_user_credits", "get_user_credits", 1);
}

public client_putinserver(id) {
	LoadCredits(id)
	set_task(300.0, "TASK_GiveCredits", id, _, _, "b")
}

public set_user_credits(id, credits) {
	PlayerCredits[id] = credits;
	
	SaveCredits(id)
}
public get_user_credits(id) {
	return PlayerCredits[id]
}

public TASK_ShowCredits() {
	static id
	for(id = 1; id <= get_maxplayers(); id++) {
		if(is_user_alive(id) && is_user_connected(id)) {
			set_dhudmessage(200, 100, 0, 0.02, 0.90, 2, 0.01, 0.5, 0.01, 0.1)
			show_dhudmessage(id, "Credits: %d", get_user_credits(id))
		}
		new Players[32], Num, Spectator;
		get_players(Players, Num, "bch");
		
		for(new index = 0; index < Num; ++index) {
			Spectator = Players[index];
			
			if(pev(Spectator, pev_iuser2) == id) {
				set_dhudmessage(200, 100, 0, 0.02, 0.90, 2, 0.01, 0.5, 0.01, 0.1)
				show_dhudmessage(Spectator, "Credits: %d", get_user_credits(id))
			}
		}		
	}
}

public TASK_GiveCredits(id) {
	if(is_user_connected(id)) {
		set_user_credits(id, get_user_credits(id) + 5)
		ColorChat(id, "!x03[Credite]!x04 Ai primit!x03 5!x04 credite pentru ca ai jucat!x03 5 minute ")
	}
}

//------| Change Name |------//
public 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;
	
	set_task(0.2, "client_connect", id);
	return FMRES_SUPERCEDE;
}

//------| Client connect |------//	
public client_connect(id) {
	static sName[32];
	get_user_name(id, sName, sizeof sName - 1);
	static sChars[32];
	get_pcvar_string(SymbolsName, sChars, sizeof sChars - 1);	
	for(new i = 0 ; i < strlen(sName) ; i++) {
		for(new j = 0 ; j < strlen(sChars) ; j++) {
			if(sName == sChars[j]) {
				server_cmd("kick #%d ^"Numele tau contine caractere nepermise.^"", get_user_userid(id));
				break;
			}
			else {
				LoadCredits(id);
			}
		}
	}
}

public Depozit(id) {
	if(cs_get_user_money(id) >= 16000) {
		ColorChat(id, "!x03[Depozit]!x04 Ai depozitat!x03 16000$!x04 is ai primit!x03 1!x04 credit.");
		set_user_credits(id, get_user_credits(id) + 1);
		cs_set_user_money(id, cs_get_user_money(id) - 16000);
	}
	else {
		ColorChat(id, "!x03[Depozit]!x04 Iti trebuie!x03 16000$!x04 pentru a putea depozita.");	
	}
	return PLUGIN_HANDLED;
}

public Retrage(id) {
	if(cs_get_user_money(id) >= 16000) {
		ColorChat(id, "!x03[Depozit]!x04 Ai deja!x03 16000$.");
	}
	else if(PlayerCredits[id]) {
		ColorChat(id, "!x03[Depozit]!x04 Ai retras!x03 1!x04 credit din depozit, ai primit!x03 16000$.");
		set_user_credits(id, get_user_credits(id) - 1);
		cs_set_user_money(id, cs_get_user_money(id) + 16000);
	}
	else {
		ColorChat(id, "!x03[Depozit]!x04 Iti trebuie!x03 1 credit!x04 pentru a putea retrage.");	
	}
	return PLUGIN_HANDLED;
}

public Check(id) {
	static Args[32]
	
	read_args(Args, sizeof(Args) - 1);
	remove_quotes(Args);
	
	if(equal(Args, "/give", 5)) {
		replace(Args, sizeof(Args) - 1, "/", "");
		client_cmd(id, "amx_%s", Args);
	}
	
	return PLUGIN_CONTINUE;
}

public GiveCredits(id) {
	new Arg1[32], Arg2[6];
	
	read_argv(1, Arg1, 31);
	read_argv(2, Arg2, 5);
	
	new Target = cmd_target(id, Arg1, 8);
	new Ammount = str_to_num(Arg2);
	
	if(Target == id) {
		ColorChat(id, "!x03Nu poti sa-ti dai credite tie");
	}
	else if(!Target) {
		ColorChat(id, "!x03Acest user nu exista");
	}
	
	else if(Ammount <= 0) {
		ColorChat(id, "!x03Nu poti sa dai o suma negativa sau egala cu 0");
	}
	else if(Ammount > get_user_credits(id)){
		ColorChat(id, "!x03Nu poti sa dai mai multe credite decat ai");
	}
	else {		
		new TargetName[32], Name[32];
		get_user_name(Target, TargetName, 31);
		get_user_name(id, Name, 31);
		
		set_user_credits(id, get_user_credits(id) -  Ammount)
		ColorChat(id, "!x03I-ai dat lui!x04 %s!x03 suma de!x04 %d$", TargetName, Ammount);
		
		set_user_credits(Target, get_user_credits(Target) + Ammount)
		ColorChat(Target, "!x03Ai primit de la !x04%s!x03 suma de!x04 %d$", Name, Ammount);
	}
}

public Give_Credits(id, level, cid) {
	if(!cmd_access(id, level, cid, 2)) {
		return PLUGIN_HANDLED;
	}
	new arg[23], gplayers[32], num, i, players, name[32];
	get_user_name(id, name, 31);
	read_argv(1, arg, 23);
	new give_credits[5];
	read_argv(2, give_credits, charsmax(give_credits));
	new Credits = str_to_num(give_credits);
	if(equali(arg, "@T")) {
		get_players(gplayers, num, "e", "TERRORIST");
		for(i = 0; i < num; i++) {
			players = gplayers;
			if(!is_user_connected(players))
				continue;
			set_user_credits(players, get_user_credits(players) + Credits);
		}
		switch(get_cvar_num("amx_show_activity")) {
			case 1: ColorChat(0, "!x03ADMIN!x04 give!x03 %i Credits!x04 to all!x03 Ts.", Credits);
				case 2: ColorChat(0, "!x03%s!x04 give!x03 %i Credits!x04 to all!x03 Ts.", name, Credits);
			}
	}
	else if(equali(arg, "@CT")) {
		get_players(gplayers, num, "e", "CT");
		for(i = 0; i < num; i++) {
			players = gplayers;
			if(!is_user_connected(players))
				continue;
			set_user_credits(players, get_user_credits(players) + Credits);
		}
		switch(get_cvar_num("amx_show_activity")) {
			case 1: ColorChat(0, "!x03ADMIN!x04 give!x03 %i Credits!x04 to all!x03 CTs.", Credits);
				case 2: ColorChat(0, "!x03%s!x04 give!x03 %i Credits!x04 to all!x03 CTs.", name, Credits);
			}
	}
	if(equali(arg, "@All")) {
		get_players(gplayers, num, "a");
		for(i = 0; i < num; i++) {
			players = gplayers;
			if(!is_user_connected(players))
				continue;
			set_user_credits(players, get_user_credits(players) + Credits);
		}
		switch(get_cvar_num("amx_show_activity")) {
			case 1: ColorChat(0, "!x03ADMIN!x04 give!x03 %i Credits!x04 to all!x03 Players.", Credits);
				case 2: ColorChat(0, "!x03%s!x04 give!x03 %i Credits!x04 to all!x03 Players.", name, Credits);
			}
	}
	new player = cmd_target(id, arg, 11);
	if(!player) {
		return PLUGIN_HANDLED;
	}
	set_user_credits(player, get_user_credits(player) + Credits);
	switch(get_cvar_num("amx_show_activity")) {
		case 1: ColorChat(player, "!x03ADMIN!x04 give your!x03 %i Credits.", Credits);
			case 2: ColorChat(player, "!x03%s!x04 give your!x03 %i Credits.", name, Credits);
		}
	return PLUGIN_HANDLED;
}

public Reset_Credits(id, level, cid) {
	if(!cmd_access(id, level, cid, 2)) {
		return PLUGIN_HANDLED;
	}
	new arg[23], gplayers[32], num, i, players, name[32];
	get_user_name(id, name, 31);
	read_argv(1, arg, 23);
	if(equali(arg, "@T")) {
		get_players(gplayers, num, "e", "TERRORIST");
		for(i = 0; i < num; i++) {
			players = gplayers;
			if(!is_user_connected(players))
				continue;
			set_user_credits(players, 0);
		}
		switch(get_cvar_num("amx_show_activity")) {
			case 1: ColorChat(0, "!x03ADMIN!x04 reset!x03 Credits!x04 to all!x03 Ts.");
				case 2: ColorChat(0, "!x03%s!x04 reset!x03 Credits!x04 to all!x03 Ts.", name);
			}
	}
	
	else if(equali(arg, "@CT")) {
		get_players(gplayers, num, "e", "CT");
		for(i = 0; i < num; i++) {
			players = gplayers;
			if(!is_user_connected(players))
				continue;
			set_user_credits(players, 0);
		}
		switch(get_cvar_num("amx_show_activity")) {
			case 1: ColorChat(0, "!x03ADMIN!x04 reset!x03 %i Credits!x04 to all!x03 CTs.");
				case 2: ColorChat(0, "!x03%s!x04 reset!x03 %i Credits!x04 to all!x03 CTs.", name);
			}
	}
	if(equali(arg, "@All")) {
		get_players(gplayers, num, "a");
		for(i = 0; i < num; i++) {
			players = gplayers;
			if(!is_user_connected(players))
				continue;
			set_user_credits(players, 0);
		}
		switch(get_cvar_num("amx_show_activity")) {
			case 1: ColorChat(0, "!x03ADMIN!x04 reset!x03 Credits!x04 to all!x03 Players.");
				case 2: ColorChat(0, "!x03%s!x04 resetx03 Credits!x04 to all!x03 Players.", name);
			}
	}
	new player = cmd_target(id, arg, 11);
	if(!player) {
		return PLUGIN_HANDLED;
	}
	set_user_credits(player, 0);
	switch(get_cvar_num("amx_show_activity")) {
		case 1: ColorChat(player, "!x03ADMIN!x04 reset your!x03 Credits.");
			case 2: ColorChat(player, "!x03%s!x04 reset your!x03 Credits.", name);
		}
	return PLUGIN_HANDLED;
}

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

//------| Loading Credits |------//
public LoadCredits(id) {
	new Name[32];
	get_user_name(id, Name, 31);
	
	new Line[128], IsPlayer = false, Arg1[32], Arg2[32];
	
	new FileOpen = fopen(File, "rt")
	while(!feof(FileOpen)) {
		fgets(FileOpen, Line, 127)
		trim(Line)
		
		parse(Line, Arg1, 31, Arg2, 31)
		
		if (equali(Arg1, Name)) {
			PlayerCredits[id] = str_to_num(Arg2)
			IsPlayer = true
			break
		}
	}
	fclose(FileOpen)
	
	if (!IsPlayer) {
		PlayerCredits[id] = 1
	}
}

stock ColorChat(const id, const input[], any:...) {
	new count = 1, players[32];
	static msg[191];
	vformat(msg, 190, input, 3);
	
	replace_all(msg, 190, "!x04", "^4");
	replace_all(msg, 190, "!x01", "^1");
	replace_all(msg, 190, "!x03", "^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();
			}
		}
	} 
}
IG-BOOST.org - Instagram Followers Best, Cheap, Reliable
User avatar
L E V I N
Scripter eXtreamCS
Scripter eXtreamCS
Posts: 2290
Joined: 24 Aug 2011, 11:24
Detinator Steam: Da
CS Status:
Detinator server CS: ☯∴
SteamID: riseofevo
Reputatie: Scripter eXtreamCS
Nume anterior: Adryyy
Location: ҳ̸Ҳ̸ҳ
Has thanked: 33 times
Been thanked: 364 times
Contact:

08 Aug 2019, 13:40

ai nev de inc dhud și fixarea părților cu [ i ]
Nu fac nimic contra cost! Faceți cerere bine detaliată aici, pe forum. Nu-mi mai dați add pe Steam doar pentru a mă avea în lista de prieteni.
Am cont și activez doar aici! Aveți grijă la cei ce încearcă să mă copieze..Puteți lua legătura cu mine dacă aveți o problemă/nelămurire în acest caz.
În cazul în care utilizați ceva din addonsurile postate de mine aici, e bine să fiți la curent cu modificările aduse unor plugine, aici.
Post Reply

Return to “Modificari pluginuri”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 3 guests