Coloraţi-mi un plugin

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
User avatar
sN1kkeRs.
Membru, skill +3
Membru, skill +3
Posts: 1058
Joined: 19 Sep 2013, 19:43
Detinator Steam: Da
Detinator server CS: Da
SteamID: bzk15
Location: Brăila
Has thanked: 124 times
Been thanked: 37 times

25 Sep 2013, 21:33

Puteti să îmi coloraţi şi mie acest plugin ceva de genul:

[*] Ultimele harti jucate: de_dust2 bla_bla bla_bla

Code: Select all

#include <amxmodx>
#include <amxmisc>

// number of last maps to save
#define LAST_MAPS_SAVE 5

new gSaveFile[64];
new gLastMapName[LAST_MAPS_SAVE][32];
new gLastMapTime[LAST_MAPS_SAVE];
new gNumLastMaps;

public plugin_init() {
	register_plugin("Last Maps Time", "0.0.1", "Exolent");
	
	register_clcmd("say /harti", "CmdLastMaps");
	
	get_datadir(gSaveFile, charsmax(gSaveFile));
	add(gSaveFile, charsmax(gSaveFile), "/lastmaps.txt");
	
	new f = fopen(gSaveFile, "rt");
	
	if(f) {
		new line[64], minutes[12];
		
		while(!feof(f) && gNumLastMaps < LAST_MAPS_SAVE) {
			fgets(f, line, charsmax(line));
			trim(line);
			
			if(line[0]) {
				parse(line, gLastMapName[gNumLastMaps], charsmax(gLastMapName[]), minutes, charsmax(minutes));
				gLastMapTime[gNumLastMaps++] = str_to_num(minutes);
			}
		}
		
		fclose(f);
	}
}

public plugin_end() {
	new minutes = floatround(get_gametime() / 60.0, floatround_ceil);
	
	new map[32];
	get_mapname(map, charsmax(map));
	
	new f = fopen(gSaveFile, "wt");
	
	fprintf(f, "^"%s^" %d", map, minutes);
	
	if(gNumLastMaps == LAST_MAPS_SAVE) {
		gNumLastMaps--;
	}
	
	for(new i = 0; i < gNumLastMaps; i++) {
		fprintf(f, "^n^"%s^" %d", gLastMapName[i], gLastMapTime[i]);
	}
	
	fclose(f);
}

public CmdLastMaps(id) {
	if(gNumLastMaps) {
		new maps[192], len;
		for(new i = 0; i < gNumLastMaps; i++) {
			len += formatex(maps[len], charsmax(maps) - len, "%s%s (%dmin)", len ? ", " : "", gLastMapName[i], gLastMapTime[i]);
		}
		
		client_print(id, print_chat, "[*] Ultimele harti jucate: %s", maps);
	} else {
		client_print(id, print_chat, "[*] Ne pare rau dar nu sunt harti salvate.");
	}
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1033\\ f0\\ fs16 \n\\ par }
*/
Eu l-am colorat dar îmi dă eroare la complilare
Last edited by sN1kkeRs. on 25 Sep 2013, 21:40, edited 1 time in total.
RoyalServer
User avatar
alkaline
Fost moderator
Fost moderator
Posts: 734
Joined: 18 Jul 2012, 09:42
Detinator Steam: Da
Reputatie: Fost Moderator ajutator
Nume anterior: lucylucy
Fond eXtream: 0
Location: Caras-Severin
Has thanked: 5 times
Been thanked: 296 times

25 Sep 2013, 21:39

| Afiseaza codul
#include <amxmodx>
#include <amxmisc>

// number of last maps to save
#define LAST_MAPS_SAVE 5

new gSaveFile[64];
new gLastMapName[LAST_MAPS_SAVE][32];
new gLastMapTime[LAST_MAPS_SAVE];
new gNumLastMaps;

public plugin_init() {
	register_plugin("Last Maps Time", "0.0.1", "Exolent");
	
	register_clcmd("say /harti", "CmdLastMaps");
	
	get_datadir(gSaveFile, charsmax(gSaveFile));
	add(gSaveFile, charsmax(gSaveFile), "/lastmaps.txt");
	
	new f = fopen(gSaveFile, "rt");
	
	if(f) {
		new line[64], minutes[12];
		
		while(!feof(f) && gNumLastMaps < LAST_MAPS_SAVE) {
			fgets(f, line, charsmax(line));
			trim(line);
			
			if(line[0]) {
				parse(line, gLastMapName[gNumLastMaps], charsmax(gLastMapName[]), minutes, charsmax(minutes));
				gLastMapTime[gNumLastMaps++] = str_to_num(minutes);
			}
		}
		
		fclose(f);
	}
}

public plugin_end() {
	new minutes = floatround(get_gametime() / 60.0, floatround_ceil);
	
	new map[32];
	get_mapname(map, charsmax(map));
	
	new f = fopen(gSaveFile, "wt");
	
	fprintf(f, "^"%s^" %d", map, minutes);
	
	if(gNumLastMaps == LAST_MAPS_SAVE) {
		gNumLastMaps--;
	}
	
	for(new i = 0; i < gNumLastMaps; i++) {
		fprintf(f, "^n^"%s^" %d", gLastMapName, gLastMapTime);
	}
	
	fclose(f);
}

public CmdLastMaps(id) {
	if(gNumLastMaps) {
		new maps[192], len;
		for(new i = 0; i < gNumLastMaps; i++) {
			len += formatex(maps[len], charsmax(maps) - len, "%s%s (%dmin)", len ? ", " : "", gLastMapName, gLastMapTime);
		}
		
		Color( id, "^4Ultimele harti jucate^1: ^3%s", maps );
		} else {
		Color( id, "^4Ne pare rau dar nu sunt harti jucate" );
	}
}

stock Color(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();
			}
		}
	}
}
User avatar
sN1kkeRs.
Membru, skill +3
Membru, skill +3
Posts: 1058
Joined: 19 Sep 2013, 19:43
Detinator Steam: Da
Detinator server CS: Da
SteamID: bzk15
Location: Brăila
Has thanked: 124 times
Been thanked: 37 times

25 Sep 2013, 21:44

T/C :)
Post Reply

Return to “Cereri”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 34 guests