Skocz do zawartości

Witamy w Nieoficjalnym polskim support'cie AMX Mod X

Witamy w Nieoficjalnym polskim support'cie AMX Mod X, jak w większości społeczności internetowych musisz się zarejestrować aby móc odpowiadać lub zakładać nowe tematy, ale nie bój się to jest prosty proces w którym wymagamy minimalnych informacji.
  • Rozpoczynaj nowe tematy i odpowiedaj na inne
  • Zapisz się do tematów i for, aby otrzymywać automatyczne uaktualnienia
  • Dodawaj wydarzenia do kalendarza społecznościowego
  • Stwórz swój własny profil i zdobywaj nowych znajomych
  • Zdobywaj nowe doświadczenia

Dołączona grafika Dołączona grafika

Guest Message by DevFuse
 

Wklejka 135134026928331 dodana przez k4x4z5, 27.10.2012 13:17
Typ:


135134026928331
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
42.
43.
44.
45.
46.
47.
48.
49.
50.
51.
52.
53.
54.
55.
56.
57.
58.
59.
60.
61.
62.
63.
64.
65.
66.
67.
68.
69.
70.
71.
72.
73.
74.
75.
76.
77.
78.
79.
80.
81.
82.
83.
84.
85.
86.
87.
88.
89.
90.
91.
92.
93.
94.
95.
96.
97.
98.
99.
100.
101.
102.
103.
104.
105.
106.
107.
108.
109.
110.
111.
112.
113.
114.
115.
116.
117.
118.
119.
120.
121.
122.
123.
124.
125.
126.
127.
128.
129.
130.
131.
132.
133.
134.
135.
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
 
#define PLUGIN "Czapki"
#define VERSION "1.0"
#define AUTHOR "Cypis"
 
new gEnt[33];
new Array:gModel;
new Array:gNazwa;
new Array:gBody;
 
public plugin_init() 
{
	register_plugin(PLUGIN, VERSION, AUTHOR);
 
	register_clcmd("say /hat", "MenuHat");
	register_clcmd("say /hats", "MenuHat");
	register_clcmd("say /czapki", "MenuHat");
}
 
public plugin_precache()
{
	gModel = ArrayCreate(128);
	gNazwa = ArrayCreate(64);
	gBody = ArrayCreate();
 
	ArrayPushString(gModel, "Zadna");
	ArrayPushString(gNazwa, "\yZdejmij czapke");
	ArrayPushCell(gBody, 0);
 
	new configfile[128];
	get_configsdir(configfile, 127);
	add(configfile, 127, "/hats.ini");
 
	if(!file_exists(configfile))
		return;
 
	new linia[256], txtlen, ilosc;
	for(new i=0; i<file_size(configfile, 1); i++)
	{
		read_file(configfile, i, linia, 255, txtlen);
		if(contain(linia, ";") != -1 || !txtlen)
			continue;
 
		new model[128], nazwa[64], body[6];
		parse(linia, model, 127, nazwa, 63, body, 5);
		remove_quotes(model);
		remove_quotes(nazwa);
		remove_quotes(body);
		format(model, 127, "models/komandosi_jail/czapki/%s", model);
 
		ArrayPushString(gModel, model);
		ArrayPushString(gNazwa, nazwa);
		ArrayPushCell(gBody, str_to_num(body));
 
		new gmodel[64];
		if(ilosc)
		{
			for(new j=1; j<ArraySize(gBody)-1; j++)
			{
				ArrayGetString(gModel, j, gmodel, 63);
				if(equal(model, gmodel))
				{
					gmodel[0] = 1;
					break;
				}
				else
					gmodel[0] = 0;
			}
		}
		if(!gmodel[0])
		{
			precache_model(model);
			log_amx("Precache %s", model);
		}
		else
			log_amx("Precache %s %s %s", model, nazwa, body);
 
		ilosc++;
	}
}
 
public MenuHat(id)
{
	new nazwa[64], int[4], menu = menu_create("Czapki:", "Handel_Czapki");
 
	for(new i=0; i<ArraySize(gBody); i++)
	{
		num_to_str(i, int, 3);
		ArrayGetString(gNazwa, i, nazwa, 63);
		menu_additem(menu, nazwa, int);
	}
 
	menu_setprop(menu, MPROP_EXITNAME, "Wyjdz");
	menu_display(id, menu);
	return PLUGIN_HANDLED;
}
 
public Handel_Czapki(id, menu, item)
{
	if(item == MENU_EXIT)
		return;
 
	new acces, callback, num[4], nazwa[64];
	menu_item_getinfo(menu, item, acces, num, 3, nazwa, 63, callback);
 
	UstawCzapke(id, str_to_num(num));
	item? client_print(id, 3, "Zalozyles czapke %s", nazwa): client_print(id, 3, "Zdjales swoja czapke");
}
 
stock UstawCzapke(id, anum)
{
	if(gEnt[id])
		set_pev(gEnt[id], pev_effects, anum? pev(gEnt[id], pev_effects) & ~EF_NODRAW: pev(gEnt[id], pev_effects) | EF_NODRAW);
 
	if(!anum)
		return;
 
	new model[128];
	ArrayGetString(gModel, anum, model, 127);
 
	if(!gEnt[id]) 
	{
		gEnt[id] = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target"))
		set_pev(gEnt[id], pev_movetype, MOVETYPE_FOLLOW);
		set_pev(gEnt[id], pev_aiment, id);
		set_pev(gEnt[id], pev_rendermode, kRenderNormal);
	}
 
	engfunc(EngFunc_SetModel, gEnt[id], model);	
	set_pev(gEnt[id], pev_body, ArrayGetCell(gBody, anum));
}