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 36rce1nt7xog dodana przez Droso, 15.10.2012 15:06
Typ:



sss
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.
139.
140.
141.
142.
143.
144.
145.
146.
147.
148.
149.
150.
151.
152.
153.
154.
155.
156.
157.
158.
159.
160.
161.
162.
163.
164.
165.
166.
167.
168.
169.
170.
171.
172.
173.
174.
175.
176.
177.
178.
179.
180.
181.
182.
183.
184.
185.
186.
187.
188.
189.
190.
191.
192.
193.
194.
195.
196.
197.
198.
199.
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <hamsandwich>
#include <nvault>
 
new vault
new cvar_teamtransfer
new joined[33]
 
public plugin_init()
{
	register_plugin("Money Manager", "1.1", "Lucky")
 
	register_clcmd("say", "handle_say")
	register_clcmd("say_team", "handle_say")
 
	RegisterHam(Ham_Spawn, "player", "player_spawn", 1)
 
	cvar_teamtransfer = register_cvar("amx_transfer_teamonly", "1")
	register_cvar("amx_moneysave_currentmap", "2")
 
	if(get_cvar_num("amx_moneysave_currentmap") == 2)
	{
		delete_file("addons/amxmodx/data/vault/save_money.vault")
	}
	vault = nvault_open("save_money")
}
 
public plugin_end()
{
	nvault_close(vault)
}
 
public client_putinserver(id)
{
	joined[id] = false
	set_task(60.0, "check_money_msg", id, _, _, "b")
}
 
public player_spawn(id)
{
	if(!joined[id] && is_user_connected(id))
	{
		new authid[32]
		get_user_authid(id, authid, 31)
		new money = nvault_get(vault, authid)
		if(!money)
		{
			nvault_touch(vault, authid)
			cs_set_user_money(id, get_cvar_num("mp_startmoney"))
		}
		else
		{
			cs_set_user_money(id, money)
		}
		joined[id] = true
	}
}
 
public check_money_msg(id)
{
	if(cs_get_user_money(id) < get_cvar_num("mp_startmoney"))
	{
		colorchat(id, "!g[Menadzer Pieniedzy] !nKtos chce pozyczyc od ciebie pieniadze ??!")
		colorchat(id, "!g[Menadzer Pieniedzy] !nsay!g/transfer nick gracza ilosc pieniedzy")
	}
}
 
public client_disconnect(id)
{
	new authid[32]
	get_user_authid(id, authid, 31)
	new smoney[11]
	num_to_str(cs_get_user_money(id), smoney, 10)
	nvault_set(vault, authid, smoney)
	remove_task(id)
}
 
public handle_say(id)
{
	new arg[32]
	read_argv(1, arg, 31)
	new temp[10]
	copy(temp, 6, arg)
	if(equali(temp, "/money"))
	{
		if(cs_get_user_money(id) > get_cvar_num("mp_startmoney"))
			return PLUGIN_HANDLED
		new name[65]
		get_user_name(id, name, 64)
		new maxpl = get_maxplayers()
		for(new i = 1; i <= maxpl; i++)
		{
			if(get_user_team(i) == get_user_team(id) && cs_get_user_money(i) > cs_get_user_money(id))
			{
				colorchat(i, "!g[Money Manager] !t%s !nhave only !t$%i!n, transfer money to him: !gsay !t/transfer", name, cs_get_user_money(id))
			}
		}
		return PLUGIN_HANDLED
	}
	copy(temp, 9, arg)
	if(equali(temp, "/transfer"))
	{
		new args[101], arg1[10], arg2[64], arg3[32]
		read_args(args, 100)
		remove_quotes(args)
		parse(args, arg1, 100, arg2, 63, arg3, 31)
		if(!arg2[0] || !arg3[0])
		{
			colorchat(id, "!g[Menadzer Pieniedzy] !nKod: !gsay !t/transfer <nick gracza albo #ID gracza> <ilosc pieniedzy>")
			return PLUGIN_HANDLED
		}
 
		new player = cmd_target(id, arg2, 0)
		if(!player)
		{
			colorchat(id, "!g[Menadzer Pieniedzy] !nNie ma takiego gracza !")
			return PLUGIN_HANDLED
		}
		if(get_user_team(id) != get_user_team(player) && get_pcvar_num(cvar_teamtransfer) == 1)
		{
			colorchat(id, "!g[Money Manager] !nYou can transfer money !tonly to teammates!n!")
			return PLUGIN_HANDLED
		}
 
		if(player == id)
		{
			colorchat(id, "!g[Money Manager] !nYou can not transfer money to yourself!")
			return PLUGIN_HANDLED
		}
 
		if(!is_str_num(arg3))
		{
			colorchat(id, "!g[Money Manager] !nThis is not a valid money amount!")
			return PLUGIN_HANDLED
		}
 
		new money_transfer = str_to_num(arg3)
 
		new name1[64], name2[64]
		get_user_name(id, name1, 63)
		get_user_name(player, name2, 63)
		if(is_user_connected(id) && money_transfer >= cs_get_user_money(id))
		{
			colorchat(id, "!g[Money Manager] !nAll your money (!t$%i!n) is transfered to !t%s!n!", cs_get_user_money(id), name2)
			colorchat(player, "!g[Money Manager] !t%s !ntransfered all his money (!t$%i!n) to you!", name1, cs_get_user_money(id))
			cs_set_user_money(player, cs_get_user_money(player) + cs_get_user_money(id))
			cs_set_user_money(id, 0)
		}
		else
		{
			if(is_user_connected(id)){
			colorchat(id, "!g[Money Manager] !n$%i !nis transfered to !t%s!n!", money_transfer, name2)
			colorchat(player, "!g[Money Manager] !n%s !ntransfered to you !t$%i!n!", name1, money_transfer)
			cs_set_user_money(player, cs_get_user_money(player) + money_transfer)
			cs_set_user_money(id, cs_get_user_money(id) - money_transfer)
		}
		}
		return PLUGIN_HANDLED
	}
	return PLUGIN_CONTINUE
}
 
// colored chat
colorchat(id, const msg[], any:...)
{
new message[256]
vformat(message, 255, msg, 3)
 
replace_all(message, 255, "!n", "^x01")
replace_all(message, 255, "!t", "^x03")
replace_all(message, 255, "!g", "^x04")
 
if(id == 0)
{
	new maxplayers = get_maxplayers()
	for(new i = 1; i <= maxplayers; i++)
	{
		if(is_user_connected(i))
		{
			message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), {0,0,0}, i)
			write_byte(i)
			write_string(message)
			message_end()
		}
	}
}
else
{
	if(is_user_connected(id))
	{
		message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), {0,0,0}, id)
		write_byte(id)
		write_string(message)
		message_end()
	}
}
}

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