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 z12jkpwn64yl dodana przez Leihto, 08.08.2013 16:44
Typ:



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.
136.
137.
138.
/* AMX Mod X
*   Healthkit
*
* (c) Copyright 2006 by VEN
*
* This file is provided as is (no warranties)
*
*	Description:
*		This plugin basically provides an ability to spawn HL healthkits.
*		If healthkit is collected it would appear again later like in HL.
*		Note: Engine module required.
*
*	Commands:
*		healthkit_spawn [save] - spawns a healthkit at the origin of a player who typed that command
*			if "save" argument is specified then origin would be added to the end of the file
*			$configsdir/maps/<currentmap>.cfg (file would be created if it is not exists)
*			that would allow to spawn saved healthkits every specific map load
*			Note: to avoid error create $configsdir/maps folder if it is not exists.
*
*		healthkit_load <x> <y> <z> - spawns a healthkit at the specified origin
*
*		healthkit_clear - removes all spawned healthkits
*
*		Commands access level is ADMIN_CFG (falg "h") can be redefined (#define ACCESS_LEVEL)
*/
 
#include <amxmodx>
#include <amxmisc>
#include <engine>
#include <fakemeta>
#include <fakemeta_util>
 
#define ACCESS_LEVEL ADMIN_CFG
new CLASSNAME[] = "item_healthkit"
 
new FILE[96]
 
new ADD_HEALTH = 30;
 
public plugin_init() {
	register_plugin("Healthkit", "0.1", "VEN")
	register_clcmd("healthkit_spawn", "cmd_healthkit_spawn", ACCESS_LEVEL, "[save]")
	register_concmd("healthkit_load", "cmd_healthkit_load", ACCESS_LEVEL, "<x> <y> <z>")
	register_concmd("healthkit_clear", "cmd_healthkit_clear", ACCESS_LEVEL)
 
	register_forward(FM_Touch, "fmtouch")
 
	new configs_dir[64], map[32]
	get_configsdir(configs_dir, 63)
	get_mapname(map, 31)
	format(FILE, 95, "%s/maps/%s.cfg", configs_dir, map)
}
 
public plugin_precache() {
	precache_model("models/w_medkit.mdl")
	precache_sound("items/smallmedkit1.wav")
}
 
public cmd_healthkit_spawn(id, level, cid) {
	if (!cmd_access(id, level, cid, 1))
		return PLUGIN_HANDLED
 
	new origin[3];
	get_user_origin(id, origin)
	healthkit_spawn(origin)
 
	new arg1[6]
	read_argv(1, arg1, 5)
	if (!equali(arg1, "save"))
		return PLUGIN_HANDLED
 
	new command[48]
	format(command, 47, "healthkit_load %d %d %d", origin[0], origin[1], origin[2])
	write_file(FILE, command)
 
	return PLUGIN_HANDLED
}
 
public cmd_healthkit_load(id, level, cid) {
	if (!cmd_access(id, level, cid, 4))
		return PLUGIN_HANDLED
 
	new arg1[8], arg2[8], arg3[8], origin[3]
	read_argv(1, arg1, 7)
	read_argv(2, arg2, 7)
	read_argv(3, arg3, 7)
	origin[0] = str_to_num(arg1)
	origin[1] = str_to_num(arg2)
	origin[2] = str_to_num(arg3)
	healthkit_spawn(origin)
 
	return PLUGIN_HANDLED
}
 
public cmd_healthkit_clear(id, level, cid) {
	if (!cmd_access(id, level, cid, 1))
		return PLUGIN_HANDLED
 
	new healthkit = -1
	while ((healthkit = find_ent_by_class(healthkit, CLASSNAME)))
		remove_entity(healthkit)
 
	return PLUGIN_HANDLED
}
 
healthkit_spawn(origin[3]) {
	new healthkit = create_entity(CLASSNAME)
	if (!healthkit)
		return
 
	new Float:vec[3]
	IVecFVec(origin, vec)
	entity_set_origin(healthkit, vec)
	DispatchSpawn(healthkit)
}
 
public fmtouch(ent, id)
{
	if( !is_user_alive( id ) ) return FMRES_IGNORED;
 
 
	if( !pev_valid( ent ) ) return FMRES_IGNORED;
 
	static classname_h[32];
 
	pev( ent, pev_classname, classname_h, 31 );
 
	if( !equali( classname_h, CLASSNAME ) ) return FMRES_IGNORED;
 
	fm_set_user_health( id, get_user_health( id ) + ADD_HEALTH );
 
	remove_entity(ent);
 
	return FMRES_IGNORED;
 
}
 
 

Dodanych wklejek: 4031
Powered By (Pav32) Pastebin © 2011