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 1dgp86x1e3hcg dodana przez sebul, 18.03.2012 23:35
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.
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.
200.
201.
202.
203.
204.
205.
206.
207.
208.
209.
210.
211.
212.
213.
214.
215.
216.
217.
218.
219.
220.
221.
222.
223.
224.
225.
226.
227.
228.
229.
230.
231.
232.
233.
234.
235.
236.
237.
238.
239.
240.
241.
242.
243.
244.
245.
246.
247.
248.
249.
250.
251.
252.
253.
254.
255.
256.
257.
258.
259.
260.
261.
262.
263.
264.
265.
266.
267.
268.
269.
270.
271.
272.
273.
274.
275.
276.
277.
278.
279.
280.
281.
282.
283.
284.
285.
286.
287.
288.
289.
290.
291.
#include <amxmodx>
#include <sqlx>
#include <zombieplague>
#include <zp50_core>
#include <zp50_gamemodes>
#define LIBRARY_NEMESIS "zp50_class_nemesis"
#include <zp50_class_nemesis>
#define LIBRARY_SURVIVOR "zp50_class_survivor"
#include <zp50_class_survivor>
#define LIBRARY_SNIPER "zp50_class_sniper"
#include <zp50_class_sniper>
#define LIBRARY_ASSASSIN "zp50_class_assassin"
#include <zp50_class_assassin>
new Handle:Connect;
new SayText;
new iKillZombie[32], iKillHuman[32];
new iInfections[32], iInfected[32];
new iAntidoted[32];
new iDeath[32];
new iLastZombie[32], iLastHuman[32];
new iNemesis[32], iAssassin[32];
new iSurvivor[32], iSniper[32];
new iFirstZombie[32];
new iLZInfect[32];
public plugin_init() {
register_plugin("[ZP] Rank", "1.0", "Szapko");
 
register_event("DeathMsg", "DeathEvent", "a");
 
register_logevent("newround",2,"1=Round_Start");
 
SayText = get_user_msgid("SayText");
 
Connect = SQL_MakeDbTuple("", "", "", "");
}
public plugin_natives() {
set_module_filter("module_filter");
set_native_filter("native_filter");
}
public module_filter(const module[]) {
if (equal(module, LIBRARY_NEMESIS) || equal(module, LIBRARY_SURVIVOR) || equal(module, LIBRARY_SNIPER) || equal(module, LIBRARY_ASSASSIN))
  return PLUGIN_HANDLED;
 
return PLUGIN_CONTINUE;
}
public native_filter(const name[], index, trap) {
if (!trap)
  return PLUGIN_HANDLED;
 
return PLUGIN_CONTINUE;
}
check_rank(id) {
new DataID[1];
new qCommand[512], PlayerID[32];
 
DataID[0] = id;
 
get_user_name(id, PlayerID, charsmax(PlayerID));
format(qCommand, sizeof qCommand-1, "SELECT * FROM `zp_rank` WHERE `zp_nick`=^"%s^"", PlayerID);
SQL_ThreadQuery(Connect, "handler_check", qCommand, DataID, 1);
}
update_rank(id) {
new DataID[1];
new PlayerID[32];
new qCommand[512], qCommand2[512];
 
DataID[0] = id;
get_user_name(id, PlayerID, charsmax(PlayerID));
format(qCommand, sizeof qCommand-1, "UPDATE `zp_rank` SET `zp_kill_zombie`='%i', `zp_kill_human`='%i', `zp_death`='%i', `zp_infections`='%i', `zp_infected`='%i', `zp_antidoted`='%i', `zp_last_zombie`='%i', `zp_last_human`='%i', `zp_first_zombie`='%i' WHERE `zp_nick`=^"%s^"", iKillZombie[id], iKillHuman[id], iDeath[id], iInfections[id], iInfected[id], iAntidoted[id], iLastZombie[id], iLastHuman[id], iFirstZombie[id], PlayerID);
SQL_ThreadQuery(Connect, "handler_update", qCommand, DataID, 1);
format(qCommand2, sizeof qCommand2-1, "UPDATE `zp_rank` SET `zp_nemesis`='%i', `zp_assassin`='%i', `zp_survivor`='%i', `zp_sniper`='%i' WHERE `zp_nick`=^"%s^"", iNemesis[id], iAssassin[id], iSurvivor[id], iSniper[id], PlayerID);
SQL_ThreadQuery(Connect, "handler_update", qCommand2, DataID, 1);
}
save_rank(id) {
new DataID[1];
new qCommand[512], PlayerID[32];
 
DataID[0] = id;
get_user_name(id, PlayerID, charsmax(PlayerID));
format(qCommand, sizeof qCommand-1, "INSERT INTO `zp_rank` VALUES ( '', ^"%s^", %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i);", PlayerID, iKillZombie[id], iKillHuman[id], iDeath[id], iInfections[id], iInfected[id], iAntidoted[id], iLastZombie[id], iLastHuman[id], iFirstZombie[id], iNemesis[id], iAssassin[id] ,iSurvivor[id] ,iSniper[id]);
 
SQL_ThreadQuery(Connect, "handler_save", qCommand, DataID, 1);
}
remove_all(id) {
iKillZombie[id] = 0;
iKillHuman[id] = 0;
iDeath[id] = 0;
iInfections[id] = 0;
iInfected[id] = 0;
iAntidoted[id] = 0;
iLastZombie[id] = 0;
iLastHuman[id] = 0;
iFirstZombie[id] = 0;
iNemesis[id] = 0;
iAssassin[id] = 0;
iSurvivor[id] = 0;
iSniper[id] = 0;
}
public client_disconnect(id) {
update_rank(id);
remove_all(id);
}
public client_putinserver(id) {
remove_all(id);
check_rank(id);
}
public plugin_end() {
SQL_FreeHandle(Connect);
}
public newround(id) {
client_print(id, print_chat, "[RANK] iLZInfect - %i", iLZInfect[id])
iLZInfect[id] = 0;
}
public zp_fw_gamemodes_start(game_mode_id) {
new Players[32], Num;
 
get_players(Players, Num);
 
for (new i = 0; i<Num; i++) {
  new id = Players[i];
  if (!is_user_alive(id)) { continue; }
 
  if (zp_core_is_first_zombie(id)) {
   iFirstZombie[id] += 1;
  }
 
  if (zp_core_is_zombie(id)) {
   iInfected[id] += 1;
  }
 
  if (zp_class_nemesis_get(id)) {
   iNemesis[id] += 1;
  }
 
  if (zp_class_assassin_get(id)) {
   iAssassin[id] += 1;
  }
 
  if (zp_class_survivor_get(id)) {
   iSurvivor[id] += 1;
  }
 
  if (zp_class_sniper_get(id)) {
   iSniper[id] += 1;
  }
}
}
public DeathEvent() {
new iKiller = read_data(1);
new iVictim = read_data(2);	
if (!is_user_alive(iKiller) || !is_user_connected(iKiller) || iKiller == iVictim || iKiller == 0) {
  return PLUGIN_HANDLED;
}
 
if (!zp_core_is_zombie(iKiller)) {
  iKillZombie[iKiller] += 1;
  iDeath[iVictim] += 1;
} else {
  iKillHuman[iKiller] += 1;
  iDeath[iVictim] += 1;
}
return PLUGIN_CONTINUE;
}
public zp_fw_core_infect_post(id, attacker) {
if (!is_user_alive(attacker) || !is_user_connected(attacker) || attacker == 0) {
  return PLUGIN_HANDLED;
}
 
if (attacker != id) {
  iInfections[attacker] += 1;
  iInfected[id] += 1;
  iLZInfect[attacker] = 1;
}
 
return PLUGIN_CONTINUE;
}
public zp_fw_core_cure(id, attacker) {
if (!is_user_alive(attacker) || !is_user_connected(attacker) || attacker == 0) {
  return PLUGIN_HANDLED;
}
 
if (attacker == id) {
  iAntidoted[id] += 1;
}
 
return PLUGIN_CONTINUE;
}
public zp_fw_core_last_zombie(id) {
if (!is_user_alive(id) || !is_user_connected(id) || id == 0) {
  return PLUGIN_HANDLED;
}
 
if (iLZInfect[id] != 0) {
  iLastZombie[id] += 1;
}
 
return PLUGIN_CONTINUE;
}
public zp_fw_core_last_human(id) {
if (!is_user_alive(id) || !is_user_connected(id) || id == 0) {
  return PLUGIN_HANDLED;
}
 
if (zp_core_get_zombie_count() > 0) {
  iLastHuman[id] += 1;
}
 
return PLUGIN_CONTINUE;
}
public handler_save(FailState, Handle:Query, Error[], Errorcode, Data[], DataSize) {
new id = Data[0];
 
if (Errorcode) {
  log_amx("[save_rank] Blad w zapytaniu: %s", Error);
}
if (FailState == TQUERY_CONNECT_FAILED) {
  log_amx("[save_rank] Nie mozna podlaczyc sie do bazy danych");
  return PLUGIN_CONTINUE;
} else if(FailState == TQUERY_QUERY_FAILED) {
  log_amx("[save_rank] Zapytanie anulowane");
  return PLUGIN_CONTINUE;
}
 
return PLUGIN_CONTINUE;
}
public handler_check(FailState, Handle:Query, Error[], Errorcode, Data[], DataSize) {
new id = Data[0];
 
if (Errorcode) {
}
if (FailState == TQUERY_CONNECT_FAILED) {
  return PLUGIN_CONTINUE;
} else if(FailState == TQUERY_QUERY_FAILED) {
  return PLUGIN_CONTINUE;
}
 
if (!SQL_MoreResults(Query)) {
  save_rank(id);
} else {
  iKillZombie[id] = SQL_ReadResult(Query, SQL_FieldNameToNum(Query, "zp_kill_zombie"));
  iKillHuman[id] = SQL_ReadResult(Query, SQL_FieldNameToNum(Query, "zp_kill_human"));
  iDeath[id] = SQL_ReadResult(Query, SQL_FieldNameToNum(Query, "zp_death"));
  iInfections[id] = SQL_ReadResult(Query, SQL_FieldNameToNum(Query, "zp_infections"));
  iInfected[id] = SQL_ReadResult(Query, SQL_FieldNameToNum(Query, "zp_infected"));
  iAntidoted[id] = SQL_ReadResult(Query, SQL_FieldNameToNum(Query, "zp_antidoted"));
  iLastZombie[id] = SQL_ReadResult(Query, SQL_FieldNameToNum(Query, "zp_last_zombie"));
  iLastHuman[id] = SQL_ReadResult(Query, SQL_FieldNameToNum(Query, "zp_last_human"));
  iFirstZombie[id] = SQL_ReadResult(Query, SQL_FieldNameToNum(Query, "zp_first_zombie"));
  iNemesis[id] = SQL_ReadResult(Query, SQL_FieldNameToNum(Query, "zp_nemesis"));
  iAssassin[id] = SQL_ReadResult(Query, SQL_FieldNameToNum(Query, "zp_assassin"));
  iSurvivor[id] = SQL_ReadResult(Query, SQL_FieldNameToNum(Query, "zp_survivor"));
  iSniper[id] = SQL_ReadResult(Query, SQL_FieldNameToNum(Query, "zp_sniper"));
}
 
return PLUGIN_CONTINUE;
}
public handler_update(FailState, Handle:Query, Error[], Errorcode, Data[], DataSize) {
new id = Data[0];
 
if (Errorcode) {
} else {
}
if (FailState == TQUERY_CONNECT_FAILED) {
  return PLUGIN_CONTINUE;
} else if(FailState == TQUERY_QUERY_FAILED) {
  return PLUGIN_CONTINUE;
}
 
return PLUGIN_CONTINUE;
}
stock client_printcolor(const id, const input[], any:...) {
new count = 1, players[32];
static msg[191];
vformat(msg, 190, input, 3);
 
replace_all(msg, 190, "!g", "^4"); // Green Color
replace_all(msg, 190, "!y", "^1"); // Default Color
replace_all(msg, 190, "!t", "^3"); // Team Color
 
if (id) players[0] = id; else get_players(players, count, "ch")
{
  for (new i = 0; i < count; i++) {
   if (is_user_connected(players[i])) {
	message_begin(MSG_ONE_UNRELIABLE, SayText, _, players[i]);
	write_byte(players[i]);
	write_string(msg);
	message_end();
   }
  }
}
}

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