· 8 years ago · Feb 09, 2018, 03:50 PM
1
2#include <sourcemod>
3#include <sdktools>
4#include <cstrike>
5#include <sdkhooks>
6#include <stocklib>
7#include "party.sp"
8
9#define BoxModel "models/items/item_item_crate.mdl"
10#define BcModel "models/props_interiors/vendingmachinesoda01a.mdl"
11#define HealSound "boooom/heal.wav"
12#define AmmoSound "boooom/createammo.wav"
13#define BcSound "boooom/createbc.wav"
14#define zhskin "models/player/elis/ud/undead.mdl"
15#define ZmnewSound "boooom/zmnew.wav"
16#define ZmchangeSound "boooom/zmchange.wav"
17#define ZminfectSound "boooom/zminfect.mp3"
18#define ZmdieSound "boooom/zmdie.wav"
19#define ZmOverlay "boooom/overlays/zombies_win"
20#define HumanOverlay "boooom/overlays/humans_win"
21#define ZmBackSound "boooom/zmbackground.mp3"
22#define StimpackSound1 "boooom/st1.mp3"
23
24//DollarShopModel
25#define TrollSkin "models/player/paultroll/troll.mdl"
26
27#define MAXCLASS 7
28#define MAXINVEN 50
29#define MAXITEM 3
30#define MAXTYPE 2
31
32//Zombie//
33new Handle:h_cdown = INVALID_HANDLE;
34new zm[MAXPLAYERS+1];
35new String:NCN[MAXPLAYERS+1][64];
36new countdown;
37new roundcheck;
38new Handle:hurting[MAXPLAYERS+1];
39new hurt[MAXPLAYERS+1];
40new fakedead[MAXPLAYERS+1];
41new Handle:h_rtimer = INVALID_HANDLE;
42new endcheck;
43
44new Level[MAXPLAYERS+1];
45new MaxXp[MAXPLAYERS+1];
46new Xp[MAXPLAYERS+1];
47new firstcheck[MAXPLAYERS+1];
48new dollar[MAXPLAYERS];
49
50//class
51new ClassNum[MAXCLASS+1];
52new String:ClassName[MAXCLASS+1][64];
53new String:ClassWeapon[MAXCLASS+1][3][32];
54new ClassHealth[MAXCLASS+1];
55new Float:ClassSpeed[MAXCLASS+1];
56new Float:ClassJump[MAXCLASS+1];
57new Class[MAXPLAYERS+1] = 0;
58new bool:AccessKey[MAXPLAYERS+1] = false;
59new Handle:Healing[MAXPLAYERS+1] = INVALID_HANDLE;
60new Healed[MAXPLAYERS+1];
61new String:ClassInfo[MAXCLASS][256] = {
62 "ì‹œë¯¼ì€ ê°€ìž¥ 기본ì ì¸ í´ëž˜ìФì´ë©° 좀비 ì„ íƒì „ í´ëž˜ìŠ¤ë¥¼ ê³ ë¥¼ë–„ì˜ ì§ì—…입니다.",
63 "í™”ë ¥ë³‘ì€ E키를 눌러 ìŠ¤íŒ€íŒ©ì„ ë°œë™ì‹œí‚¬ìˆ˜ 있습니다",
64 "ì¹˜ìœ ë³‘ì€ ì¹˜ë£ŒëŒ€ìƒì„ ë°”ë¼ë³´ê³ E키를 눌러 치료가능합니다",
65 "",
66 "ë³´ê¸‰ë³‘ì€ E키를 ì´ìš©í•´ì„œ 보급ìƒìžë¥¼ 2개까지 놓ì„수있으며 보급ìƒìžë¥¼ ë°”ë¼ë³´ê³ R키를 눌러 ë³´ê¸‰ì„ ë°›ì„수 있습니다",
67 "ë³´ë³‘ì€ ë¹ ë¥¸ ì†ë„를 ê°€ì§€ê³ ìžˆìœ¼ë©° E키를 눌러 ìŠ¤íŒ€íŒ©ì„ ë°œë™ì‹œí‚¬ìˆ˜ìžˆìŠµë‹ˆë‹¤",
68 "스나ì´í¼ëŠ” E키를 ì´ìš©í•´ 바리케ì´ë“œë¥¼ 최대 3개까지 소환가능하며 Shift를 눌러 íŠ¹ìˆ˜íƒ„ì•½ì„ íƒì´ 가능합니다",
69};
70
71//Ammo
72new AmmoBox[MAXPLAYERS+1][2][2];
73new UsedBox[MAXPLAYERS+1][2];
74new LimitUseBox[MAXPLAYERS+1];
75new UsingBox[MAXPLAYERS+1];
76
77//Barricade
78new Barricade[MAXPLAYERS+1][3];
79new UsedBc[MAXPLAYERS+1][3];
80new LimitUseBc[MAXPLAYERS+1];
81new UsingBc[MAXPLAYERS+1];
82
83//SniperAmmo
84new SniperBullet[MAXPLAYERS+1];
85
86//Steampack
87new UsingSt[MAXPLAYERS+1];
88new LimitUseSt[MAXPLAYERS+1];
89new ActivingSt[MAXPLAYERS+1];
90
91//Stimpack
92new g_iWeaponRateQueue[MAXPLAYERS];
93new g_iWeaponRateQueueLength;
94new g_iOffs_ActiveWeapon = -1;
95new g_iOffs_NextPrimaryAttack = -1;
96new Float:g_flMultiplier = 0.7;
97
98//dollarshop
99new Inventory[MAXPLAYERS+1][MAXINVEN+1];
100new UsingItem[MAXPLAYERS+1][MAXTYPE+1];
101
102new ItemCode[MAXITEM+1];
103new String:ItemName[MAXITEM+1][32];
104new ItemType[MAXITEM+1];
105new ItemPrice[MAXITEM+1];
106new String:ItemTypeName[MAXTYPE+1][32];
107new String:ItemRoute[MAXITEM+1][256];
108
109new beamfollowentity[MAXPLAYERS+1];
110
111//Query
112new Handle:DB = INVALID_HANDLE;
113
114public OnMapStart()
115{
116 PrecacheModel(BoxModel, true);
117 PrecacheModel(BcModel, true);
118 PrecacheSound(HealSound, true);
119 PrecacheSound(AmmoSound, true);
120 PrecacheSound(BcSound, true);
121 PrecacheModel(zhskin, true);
122 PrecacheSound(ZmnewSound, true);
123 PrecacheSound(ZminfectSound, true);
124 PrecacheSound(ZmchangeSound, true);
125 PrecacheSound(ZmdieSound, true);
126 PrecacheModel(ZmOverlay, true);
127 PrecacheModel(HumanOverlay, true);
128 PrecacheSound(ZmBackSound, true);
129 PrecacheSound(StimpackSound1, true);
130
131 if(h_cdown != INVALID_HANDLE)
132 {
133 KillTimer(h_cdown);
134 h_cdown = INVALID_HANDLE;
135 }
136 if(h_rtimer != INVALID_HANDLE)
137 {
138 KillTimer(h_rtimer);
139 h_rtimer = INVALID_HANDLE;
140 }
141
142 CreateTimer(1.0, NoPerson);
143
144 decl String:szClass[65];
145 for(new i=MaxClients; i<=GetMaxEntities(); i++)
146 {
147 if(IsValidEdict(i) && IsValidEntity(i))
148 {
149 GetEdictClassname(i, szClass, sizeof(szClass));
150 if(StrEqual("func_buyzone", szClass))
151 {
152 RemoveEdict(i);
153 }
154 }
155 }
156
157 SQL_TConnect(SQL_Connection, "czdata");
158}
159
160public OnPluginStart()
161{
162 HookEvent("round_start", Event_RoundStart);
163 HookEvent("round_end", Event_RoundEnd);
164 HookEvent("player_death", Event_Playerdeath);
165 HookEvent("player_team", Event_OnPlayerJoinTeam, EventHookMode_Pre);
166 HookEvent("player_spawn", Event_PlayerSpawn);
167 HookEvent("player_hurt", Event_PlayerHurt);
168 HookEvent("weapon_fire", Event_WeaponFire);
169
170 RegConsoleCmd("say", SayHook);
171 RegConsoleCmd("rebuy", Rebuy);
172 RegConsoleCmd("jointeam", JoinTeam);
173 RegConsoleCmd("nightvision", NightVision);
174 RegConsoleCmd("drop", Drop);
175 RegAdminCmd("sm_killent", KillEntity, ADMFLAG_KICK);
176 RegAdminCmd("sm_GetTeam", GetTeam, ADMFLAG_KICK);
177 RegAdminCmd("sm_tst", TrailStatus, ADMFLAG_KICK);
178 RegServerCmd("renewtable", RenewTable);
179
180 //CreateClass(num, String:name[64], String:p1weapon[32], String:p2weapon[32], String:sweapon[32], health, Float:speed, Float:jump)
181
182 CreateClass(0, "시민", "", "", "", 100, 1.0, 1.0);
183 CreateClass(1, "í™”ë ¥ë³‘", "weapon_m3", "weapon_xm1014", "weapon_fiveseven", 300, 1.0, 0.0);
184 CreateClass(2, "ì¹˜ìœ ë³‘", "weapon_p90", "weapon_mp5navy", "weapon_deagle", 200, 1.0, 0.0);
185 CreateClass(3, "ë² í…Œëž‘", "weapon_m249", "weapon_m249", "weapon_elite", 500, 1.15, 200.0);
186 CreateClass(4, "보급병", "weapon_tmp", "weapon_mac10", "weapon_p228", 300, 1.0, 0.0);
187 CreateClass(5, "보병", "weapon_ak47", "weapon_m4a1", "weapon_fiveseven", 300, 1.15, 200.0);
188 CreateClass(6, "스나병", "weapon_awp", "weapon_awp", "weapon_deagle", 150, 1.0, 0.0);
189
190 //CreateItem(ì•„ì´í…œì½”드, ì•„ì´í…œì´ë¦„, ì•„ì´í…œìœ 형, 가격, 경로)
191
192 CreateItem(0, "무지개", 0, 100, "materials/boooom/trails/rainbow.vmt");
193 CreateItem(1, "별", 0, 100, "materials/boooom/trails/star.vmt");
194
195 CreateItem(2, "트롤", 1, 100, TrollSkin);
196
197 ItemTypeName[0] = "íŠ¸ë ˆì¼";
198 ItemTypeName[1] = "ì¸ê°„스킨";
199
200 g_iOffs_ActiveWeapon = FindSendPropOffs("CBasePlayer", "m_hActiveWeapon");
201 g_iOffs_NextPrimaryAttack = FindSendPropOffs("CBaseCombatWeapon", "m_flNextPrimaryAttack");
202}
203
204public OnMapEnd()
205{
206 if(h_cdown != INVALID_HANDLE)
207 {
208 KillTimer(h_cdown);
209 h_cdown = INVALID_HANDLE;
210 }
211 if(h_rtimer != INVALID_HANDLE)
212 {
213 KillTimer(h_rtimer);
214 h_rtimer = INVALID_HANDLE;
215 }
216
217 SQL_DisconnectFromDB();
218}
219
220public OnClientPutInServer(Client)
221{
222 if(!IsFakeClient(Client)) Load(Client);
223
224 SDKHook(Client, SDKHook_OnTakeDamage, OnTakeDamageHook);
225
226 if(firstcheck[Client] == 0)
227 {
228 firstcheck[Client] = 1;
229 Level[Client] = 1;
230 Xp[Client] = 0;
231 MaxXp[Client] = 100;
232 for(new i=0; i<MAXINVEN; i++)
233 {
234 Inventory[Client][i] = -1;
235 }
236 for(new i=0; i<MAXTYPE; i++)
237 {
238 UsingItem[Client][i] = -1;
239 }
240 }
241
242 CreateTimer(1.0, HintText, Client);
243
244 //파티
245
246 PJoined[Client] = 0;
247 Pmaster[Client] = 0;
248 PMnum[Client] = 0;
249 Pcount[Client] = 0;
250 Ptemp1[Client] = 0;
251
252 P1[Client] = 0;
253 P2[Client] = 0;
254 P3[Client] = 0;
255}
256
257public OnClientDisconnect(Client)
258{
259 if(!IsFakeClient(Client)) Save(Client);
260
261 Cmd_Pout(Client);
262
263 if(roundcheck == 1)
264 {
265 new zcount;
266
267 for(new i=1; i<=MaxClients; i++)
268 {
269 if(zm[i] == 1 && IsClientConnectedInGame(i))
270 {
271 if(i != Client)
272 zcount += 1;
273 }
274 }
275
276 if(zcount == 0)
277 {
278 CS_TerminateRound(7.0, CSRoundEnd_CTWin);
279 }
280 }
281}
282
283public Action:OnPlayerRunCmd(Client, &buttons, &impulse, Float:vel[3], Float:angles[3], &weapon)
284{
285 if(buttons & IN_USE)
286 {
287 if(AccessKey[Client] == false)
288 {
289 AccessKey[Client] = true;
290 if(zm[Client] == 0 && GetClientTeam(Client) != 1 && Class[Client] == 2 && Healing[Client] == INVALID_HANDLE)
291 {
292 Healing[Client] = CreateTimer(0.1, Heal, Client, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE);
293 new Float:clientposition[3];
294 GetClientEyePosition(Client, clientposition);
295 EmitSoundToAll(HealSound, SOUND_FROM_WORLD, SNDCHAN_AUTO, SNDLEVEL_NORMAL, SND_NOFLAGS, SNDVOL_NORMAL, SNDPITCH_NORMAL, -1, clientposition, NULL_VECTOR, true, 0.0);
296 }
297 if(zm[Client] == 0 && GetClientTeam(Client) != 1 && Class[Client] == 4)
298 {
299 if(LimitUseBox[Client] == 0)
300 {
301 SetEntPropFloat(Client, Prop_Send, "m_flProgressBarStartTime", GetGameTime());
302 SetEntProp(Client, Prop_Send, "m_iProgressBarDuration", 2);
303 CreateTimer(2.0, GoCreateAmmo, Client);
304 CreateTimer(2.0, UnLimitUseBox, Client);
305 UsingBox[Client] = 1;
306 LimitUseBox[Client] = 1;
307 }
308 }
309 if(zm[Client] == 0 && GetClientTeam(Client) != 1 && Class[Client] == 6)
310 {
311 if(LimitUseBc[Client] == 0)
312 {
313 SetEntPropFloat(Client, Prop_Send, "m_flProgressBarStartTime", GetGameTime());
314 SetEntProp(Client, Prop_Send, "m_iProgressBarDuration", 2);
315 CreateTimer(2.0, GoCreateBc, Client);
316 CreateTimer(2.0, UnLimitUseBc, Client);
317 UsingBc[Client] = 1;
318 LimitUseBc[Client] = 1;
319 }
320 }
321 if(zm[Client] == 0 && GetClientTeam(Client) != 1)
322 {
323 if(Class[Client] == 1 || Class[Client] == 5 || Class[Client] == 3)
324 {
325 if(LimitUseSt[Client] == 0)
326 {
327 SetEntPropFloat(Client, Prop_Send, "m_flProgressBarStartTime", GetGameTime());
328 SetEntProp(Client, Prop_Send, "m_iProgressBarDuration", 2);
329 CreateTimer(2.0, GoActiveSt, Client);
330 CreateTimer(2.0, UnLimitUseSt, Client);
331 UsingSt[Client] = 1;
332 LimitUseSt[Client] = 1;
333 }
334 }
335 }
336 }
337 }
338
339 else if(buttons & IN_RELOAD)
340 {
341 if(AccessKey[Client] == false)
342 {
343 AccessKey[Client] = true;
344 if(GetClientAimTarget(Client, false) != -1)
345 {
346 new Prop = GetClientAimTarget(Client, false);
347 new Float:ppos[3], Float:epos[3];
348
349 GetClientEyePosition(Client, epos);
350 GetEntPropVector(Prop, Prop_Send, "m_vecOrigin", ppos);
351
352 if(GetVectorDistance(ppos, epos) < 150.0)
353 {
354 if(GetEntPropEnt(Prop, Prop_Send, "m_iTeamNum") == 0)
355 {
356 GetAmmo(Client, GetEntPropEnt(Prop, Prop_Send, "m_hOwnerEntity"), 0);
357 }
358 else if(GetEntPropEnt(Prop, Prop_Send, "m_iTeamNum") == 1)
359 {
360 GetAmmo(Client, GetEntPropEnt(Prop, Prop_Send, "m_hOwnerEntity"), 1);
361 }
362 }
363 }
364 }
365 }
366
367 else if(buttons & IN_SPEED)
368 {
369 if(AccessKey[Client] == false)
370 {
371 AccessKey[Client] = true;
372 if(zm[Client] == 0 && Class[Client] == 6 && GetClientTeam(Client) != 1)
373 {
374 SniperMenu(Client);
375 }
376 }
377 }
378
379 else
380 {
381 AccessKey[Client] = false;
382 if(Healing[Client] != INVALID_HANDLE)
383 {
384 KillTimer(Healing[Client]);
385 Healing[Client] = INVALID_HANDLE;
386 }
387
388 if(UsingBox[Client] == 1)
389 {
390 SetEntPropFloat(Client, Prop_Send, "m_flProgressBarStartTime", 0.0);
391 SetEntProp(Client, Prop_Send, "m_iProgressBarDuration", 0);
392 UsingBox[Client] = 0;
393 }
394 if(UsingBc[Client] == 1)
395 {
396 SetEntPropFloat(Client, Prop_Send, "m_flProgressBarStartTime", 0.0);
397 SetEntProp(Client, Prop_Send, "m_iProgressBarDuration", 0);
398 UsingBc[Client] = 0;
399 }
400 if(UsingSt[Client] == 1)
401 {
402 SetEntPropFloat(Client, Prop_Send, "m_flProgressBarStartTime", 0.0);
403 SetEntProp(Client, Prop_Send, "m_iProgressBarDuration", 0);
404 UsingSt[Client] = 0;
405 }
406 }
407}
408
409public OnGameFrame()
410{
411 if(g_iWeaponRateQueueLength)
412 {
413 decl ent, Float:time;
414 new Float:enginetime = GetGameTime();
415 for(new i = 0; i < g_iWeaponRateQueueLength; i++)
416 {
417 ent = g_iWeaponRateQueue[i];
418 time = (GetEntDataFloat(ent,g_iOffs_NextPrimaryAttack) - enginetime) * g_flMultiplier;
419 SetEntDataFloat(ent, g_iOffs_NextPrimaryAttack, time + enginetime, true);
420 }
421 g_iWeaponRateQueueLength = 0;
422 }
423}
424
425//
426//
427//========================= ì´ë²¤íЏ 구간 =========================
428//
429//
430
431public Action:Event_RoundStart(Handle:event, const String:name[], bool:broadcast)
432{
433 countdown = 30;
434 roundcheck = 0;
435
436 ShowOverlayToAll("");
437
438 for(new i=1; i<=MaxClients; i++)
439 {
440 if(IsClientConnectedInGame(i))
441 {
442 zm[i] = 0;
443 SDKUnhook(i, SDKHook_WeaponSwitch, OnWeaponSwitch);
444 fakedead[i] = 0;
445 Class[i] = 0;
446 strcopy(NCN[i], 64, ClassName[Class[i]]);
447 Healed[i] = 0;
448 UsedBox[i][0] = 0;
449 UsedBox[i][1] = 0;
450 UsedBc[i][0] = 0;
451 UsedBc[i][1] = 0;
452 UsedBc[i][2] = 0;
453
454 ActivingSt[i] = 0;
455
456 if(hurting[i] != INVALID_HANDLE)
457 {
458 KillTimer(hurting[i])
459 hurting[i] = INVALID_HANDLE;
460 }
461 }
462 }
463
464 if(h_cdown != INVALID_HANDLE)
465 {
466 KillTimer(h_cdown);
467 h_cdown = INVALID_HANDLE;
468 }
469 if(h_rtimer != INVALID_HANDLE)
470 {
471 KillTimer(h_rtimer);
472 h_rtimer = INVALID_HANDLE;
473 }
474
475 EmitSoundToAll(ZmBackSound);
476 CreateTimer(1.0, SpawnAll);
477 CreateTimer(1.2, TrailTimer);
478
479 new pcount;
480
481 for(new i=1; i<=MaxClients; i++)
482 {
483 if(IsClientConnectedInGame(i))
484 {
485 if(GetClientTeam(i) != 1 && GetClientTeam(i) != 0)
486 {
487 pcount++;
488 }
489 }
490 }
491
492 if(pcount >= 2)
493 {
494 if(h_cdown == INVALID_HANDLE)
495 h_cdown = CreateTimer(1.0, Zm_Countdown, _, TIMER_REPEAT);
496 if(h_rtimer == INVALID_HANDLE)
497 h_rtimer = CreateTimer(60.0*5, RoundTimer);
498 }
499}
500
501public Action:Event_RoundEnd(Handle:event, const String:name[], bool:broadcast)
502{
503 for(new i=1; i<=MaxClients; i++)
504 {
505 if(IsClientConnectedInGame(i))
506 {
507 if(zm[i] == 0 && IsPlayerAlive(i) && IsClientConnectedInGame(i))
508 {
509 PrintToChat(i, "\x04[Server] ìƒì¡´í•˜ì…¨ìœ¼ë¯€ë¡œ 10달러가 지급ë©ë‹ˆë‹¤");
510 dollar[i] += 10;
511 if(PJoined[i] == 1)
512 {
513 PrintToChat(i, "\x04[Server] 파티와 함께 ìƒì¡´í•˜ì‹ ë³´ìƒìœ¼ë¡œ 10달러가 추가로 지급ë©ë‹ˆë‹¤");
514 dollar[i] += 10;
515 }
516 Save(i);
517 }
518 zm[i] = 0;
519 }
520 }
521 roundcheck = 2;
522 SetAutoBalance();
523
524 new h_winner = GetEventInt(event, "winner");
525
526 if(h_winner == 3)
527 {
528 ShowOverlayToAll(HumanOverlay);
529 }
530 else if(h_winner == 2)
531 {
532 ShowOverlayToAll(ZmOverlay);
533 }
534
535 for(new i=1; i<=MaxClients; i++)
536 {
537 if(hurting[i] != INVALID_HANDLE)
538 {
539 KillTimer(hurting[i]);
540 hurting[i] = INVALID_HANDLE;
541 }
542 }
543 if(h_rtimer != INVALID_HANDLE)
544 {
545 KillTimer(h_rtimer);
546 h_rtimer = INVALID_HANDLE;
547 }
548}
549
550public Action:CS_OnTerminateRound(&Float:delay, &CSRoundEndReason:reason)
551{
552 if(reason == CSRoundEnd_GameStart)
553 {
554 if(endcheck == 0)
555 return Plugin_Handled;
556 else
557 endcheck = 0;
558 }
559 return Plugin_Continue;
560}
561
562public Action:Event_Playerdeath(Handle:event, const String:name[], bool:broadcast)
563{
564 new Client = GetClientOfUserId(GetEventInt(event, "userid"));
565 new Attacker = GetClientOfUserId(GetEventInt(event, "attacker"));
566
567 if(fakedead[Client] == 0)
568 {
569 DeleteTrail(Client);
570 CreateTimer(5.0, Zm_Respawn, Client);
571 }
572 else
573 fakedead[Client] = 0;
574
575 if(roundcheck == 1)
576 {
577 if(zm[Attacker] == 0)
578 {
579 if(zm[Client] == 1)
580 {
581 Xp[Attacker] += 10;
582 dollar[Attacker] += 10;
583 CheckLevel(Attacker);
584 Save(Attacker);
585 PrintToChat(Attacker, "\x04[달러샵] 좀비를 사살하셔서 10달러와 10경험치를 íšë“하셨습니다");
586
587 new Float:clientposition[3];
588 GetClientEyePosition(Client, clientposition);
589 EmitSoundToAll(ZmdieSound, SOUND_FROM_WORLD, SNDCHAN_AUTO, SNDLEVEL_GUNFIRE, SND_NOFLAGS, SNDVOL_NORMAL, SNDPITCH_NORMAL, -1, clientposition, NULL_VECTOR, true, 0.0);
590 }
591 }
592 else
593 {
594 if(hurting[Client] != INVALID_HANDLE)
595 {
596 KillTimer(hurting[Client]);
597 hurting[Client] = INVALID_HANDLE;
598 }
599 }
600 }
601}
602
603public Action:Event_PlayerHurt(Handle:event, const String:name[], bool:broadcast)
604{
605 new hitgroup = GetEventInt(event, "hitgroup");
606 new Client = GetClientOfUserId(GetEventInt(event, "userid"));
607 new attacker = GetClientOfUserId(GetEventInt(event, "attacker"));
608
609 // ëª¸í†µì˜ ížˆíŠ¸ê·¸ë£¹ì€ 0ì´ë‹¤.
610 // ë¨¸ë¦¬ì˜ ížˆíŠ¸ê·¸ë£¹ì€ 1ì´ë‹¤.
611 // ê°€ìŠ´ì˜ ížˆíŠ¸ê·¸ë£¹ì€ 2다.
612 // ë°°ì˜ ížˆíŠ¸ê·¸ë£¹ì€ 3ì´ë‹¤.
613 // ì™¼íŒ”ì˜ ížˆíŠ¸ê·¸ë£¹ì€ 4다.
614 // ì˜¤ë¥¸íŒ”ì˜ ížˆíŠ¸ê·¸ë£¹ì€ 5다.
615 // ì™¼ë‹¤ë¦¬ì˜ ížˆíŠ¸ê·¸ë£¹ì€ 6ì´ë‹¤.
616 // ì˜¤ë¥¸ë‹¤ë¦¬ì˜ ížˆíŠ¸ê·¸ë£¹ì€ 7ì´ë‹¤.
617
618 if(roundcheck == 1 && zm[attacker] == 0 && zm[Client] == 1 && attacker != 0)
619 {
620 decl String:weapon[32];
621 GetEventString(event, "weapon", weapon, 32);
622 decl Float:Clientposition[3], Float:targetposition[3], Float:vector[3];
623 GetClientEyePosition(attacker, Clientposition);
624 GetClientEyePosition(Client, targetposition);
625 MakeVectorFromPoints(Clientposition, targetposition, vector);
626 NormalizeVector(vector, vector);
627
628 if(StrEqual("awp", weapon))
629 {
630 if(SniperBullet[attacker] == 0)
631 {
632 if(hitgroup == 1)
633 {
634 ScaleVector(vector, 1000.0);
635 makeDamage(attacker, Client, 2000, DMG_BULLET, 1.0, Clientposition, "강화탄");
636 }
637 else
638 {
639 ScaleVector(vector, 500.0);
640 makeDamage(attacker, Client, 1000, DMG_BULLET, 1.0, Clientposition, "강화탄");
641 }
642 }
643 if(SniperBullet[attacker] == 1)
644 {
645 if(hitgroup == 1)
646 {
647 ScaleVector(vector, 500.0);
648 }
649 else
650 {
651 ScaleVector(vector, 250.0);
652 }
653 makeexplosion(attacker, -1, targetposition, "í발탄", 500, 100, 0.0, SF_ENVEXPLOSION_NOFIREBALL|SF_ENVEXPLOSION_NOSMOKE);
654 }
655 if(SniperBullet[attacker] == 2)
656 {
657 if(hitgroup == 1)
658 {
659 ScaleVector(vector, 100.0);
660 }
661 else
662 {
663 ScaleVector(vector, 50.0);
664 }
665 makeDamage(attacker, Client, 500, DMG_BULLET, 1.0, Clientposition, "빙결탄");
666 Freeze(Client, 1.0);
667 }
668 TeleportEntity(Client, NULL_VECTOR, NULL_VECTOR, vector);
669 }
670
671 else if(StrEqual("knife", weapon))
672 {
673 ScaleVector(vector, 1000.0);
674 TeleportEntity(Client, NULL_VECTOR, NULL_VECTOR, vector);
675 }
676
677 else if(StrEqual("m3", weapon) || StrEqual("xm1014", weapon))
678 {
679 if(hitgroup == 1)
680 ScaleVector(vector, 100.0);
681 else
682 ScaleVector(vector, 200.0);
683 TeleportEntity(Client, NULL_VECTOR, NULL_VECTOR, vector);
684 }
685
686 else
687 {
688 if(hitgroup == 1)
689 ScaleVector(vector, 100.0);
690 else
691 ScaleVector(vector, 50.0);
692
693 TeleportEntity(Client, NULL_VECTOR, NULL_VECTOR, vector);
694 }
695 }
696}
697
698public Action:Event_OnPlayerJoinTeam(Handle:event, const String:Name[], bool:Broadcast)
699{
700 return Plugin_Handled;
701}
702
703public Action:Event_WeaponFire(Handle:event, const String:Name[], bool:Broadcast)
704{
705 new Client = GetClientOfUserId(GetEventInt(event, "userid"));
706
707 if(ActivingSt[Client] == 1)
708 {
709 new ent = GetEntDataEnt2(Client, g_iOffs_ActiveWeapon);
710 g_iWeaponRateQueue[g_iWeaponRateQueueLength++] = ent;
711 new WeaponIndexs = GetEntPropEnt(Client, Prop_Data, "m_hActiveWeapon");
712 SetEntProp(WeaponIndexs, Prop_Data, "m_iClip1", 10);
713 }
714}
715
716public Action:SayHook(Client, args)
717{
718 new String:msg[256];
719 GetCmdArgString(msg, sizeof(msg));
720 msg[strlen(msg)-1] = '\0';
721
722 new String:cmdbuffer[256];
723 strcopy(cmdbuffer, 256, msg);
724 StripQuotes(cmdbuffer);
725 TrimString(cmdbuffer);
726 strcopy(cmdbuffer, sizeof(cmdbuffer), cmdbuffer[1]);
727
728 if(StrEqual(cmdbuffer, "!파티ìƒì„±", false))
729 {
730 Cmd_Pcreate(Client);
731 }
732
733 if(StrEqual(cmdbuffer, "!파티탈퇴", false))
734 {
735 Cmd_Pout(Client);
736 }
737
738 if(StrEqual(cmdbuffer, "!파티가입", false))
739 {
740 if(Pmaster[Client] == 0 && PJoined[Client] == 0)
741 {
742 Cmd_PJoinList(Client);
743 }
744 else
745 {
746 PrintToChat(Client, "\x05[Party] \x04íŒŒí‹°ì— ê°€ìž…ë˜ì–´ìžˆì§€ 않아야 합니다.");
747 }
748 }
749
750 //파티 -세ì´í›… 부분
751 if(StrEqual(cmdbuffer, "!파티초대", false))
752 {
753 if(Pmaster[Client] == 1)
754 {
755 Cmd_PList(Client); //초대가능한 í”Œë ˆì´ì–´ 리스트를 ë„ì›ë‹ˆë‹¤.
756 }
757 else
758 {
759 PrintToChat(Client, "\x05[Party] \x04파티장만 가능합니다.");
760 }
761 }
762
763 if(StrEqual(cmdbuffer, "!파티ì›", false))
764 {
765 if(PJoined[Client] == 1)
766 {
767 Cmd_Pmem(Client);
768 }
769 else
770 {
771 PrintToChat(Client, "\x05[Party] \x04íŒŒí‹°ì— ê°€ìž…í•˜ì…”ì•¼í•©ë‹ˆë‹¤.");
772 }
773 }
774
775 if(StrEqual(cmdbuffer, "!í´ëž˜ìФ", false))
776 {
777 if(IsPlayerAlive(Client) && Class[Client] == 0 && zm[Client] == 0)
778 {
779 CreateTimer(0.1, Setting, Client);
780 }
781 }
782
783 //Lv65 {í´ëž˜ìФ}닉네임
784
785 if(GetClientTeam(Client) != 1 && GetClientTeam(Client) != 0)
786 {
787 if(IsPlayerAlive(Client))
788 {
789 if(Level[Client] < 10)
790 PrintToChatAll("\x07FF0000Lv%d \x071DDB16[%s]\x07368AFF%N\x01 : %s", Level[Client], NCN[Client], Client, cmdbuffer);
791 else if(Level[Client] < 20)
792 PrintToChatAll("\x07FF5E00Lv%d \x071DDB16[%s]\x07368AFF%N\x01 : %s", Level[Client], NCN[Client], Client, cmdbuffer);
793 else if(Level[Client] < 30)
794 PrintToChatAll("\x07FFE400Lv%d \x071DDB16[%s]\x07368AFF%N\x01 : %s", Level[Client], NCN[Client], Client, cmdbuffer);
795 else if(Level[Client] < 40)
796 PrintToChatAll("\x071DDB16Lv%d \x071DDB16[%s]\x07368AFF%N\x01 : %s", Level[Client], NCN[Client], Client, cmdbuffer);
797 else if(Level[Client] < 50)
798 PrintToChatAll("\x070100FFLv%d \x071DDB16[%s]\x07368AFF%N\x01 : %s", Level[Client], NCN[Client], Client, cmdbuffer);
799 else if(Level[Client] < 60)
800 PrintToChatAll("\x07000081Lv%d \x071DDB16[%s]\x07368AFF%N\x01 : %s", Level[Client], NCN[Client], Client, cmdbuffer);
801 else if(Level[Client] < 70)
802 PrintToChatAll("\x078324FFLv%d \x071DDB16[%s]\x07368AFF%N\x01 : %s", Level[Client], NCN[Client], Client, cmdbuffer);
803 else if(Level[Client] < 80)
804 PrintToChatAll("\x07FF00DDLv%d \x071DDB16[%s]\x07368AFF%N\x01 : %s", Level[Client], NCN[Client], Client, cmdbuffer);
805 else if(Level[Client] < 90)
806 PrintToChatAll("\x07FFFFFFLv%d \x071DDB16[%s]\x07368AFF%N\x01 : %s", Level[Client], NCN[Client], Client, cmdbuffer);
807 else if(Level[Client] < 100)
808 PrintToChatAll("\x078C8C8CLv%d \x071DDB16[%s]\x07368AFF%N\x01 : %s", Level[Client], NCN[Client], Client, cmdbuffer);
809 else if(Level[Client] == 100)
810 PrintToChatAll("\x07000000Lv%d \x071DDB16[%s]\x07368AFF%N\x01 : %s", Level[Client], NCN[Client], Client, cmdbuffer);
811 }
812 else
813 PrintToChatAll("\x07D5D5D5Lv%d [사ë§]%N : %s", Level[Client], Client, cmdbuffer);
814 }
815 else
816 PrintToChatAll("\x07D5D5D5Lv%d [ê´€ì „]%N : %s", Level[Client], Client, cmdbuffer);
817
818 return Plugin_Handled;
819}
820
821public Action:Rebuy(Client, args)
822{
823 new Handle:menu = CreateMenu(Menu_Party);
824
825 SetMenuTitle(menu, "===파티===");
826
827 AddMenuItem(menu, "0", "파티ìƒì„±");
828 AddMenuItem(menu, "1", "파티가입");
829 AddMenuItem(menu, "2", "파티초대");
830 AddMenuItem(menu, "3", "파티탈퇴");
831
832 DisplayMenu(menu, Client, MENU_TIME_FOREVER);
833}
834
835public Action:Event_PlayerSpawn(Handle:event, const String:Name[], bool:Broadcast)
836{
837 new Client = GetClientOfUserId(GetEventInt(event, "userid"));
838
839 if(IsClientConnectedInGame(Client) && roundcheck == 0)
840 {
841 if(UsingItem[Client][1] != -1)
842 {
843 SetEntityModel(Client, ItemRoute[UsingItem[Client][1]]);
844 }
845
846 CreateTimer(0.1, Setting, Client);
847 strcopy(NCN[Client], 64, "시민");
848 SetEntPropFloat(Client, Prop_Data, "m_flLaggedMovementValue", ClassSpeed[Class[Client]]);
849 }
850 DeleteTrail(Client);
851 CreateTrail(Client);
852}
853
854public Action:JoinTeam(Client, Args)
855{
856 new String:team[3], Team;
857 GetCmdArgString(team, sizeof(team));
858 Team = StringToInt(team);
859
860 if(GetClientTeam(Client) == 0 || GetClientTeam(Client) == 1)
861 {
862 if(Team != 1 && Team != 0)
863 {
864 new T_player = GetTeamClientCount(2);
865 new CT_player = GetTeamClientCount(3);
866
867 if(T_player <= CT_player)
868 {
869 CS_SwitchTeam(Client, CS_TEAM_CT);
870 }
871 else
872 {
873 CS_SwitchTeam(Client, CS_TEAM_T);
874 }
875
876 if(roundcheck == 0)
877 {
878 if(!IsPlayerAlive(Client))
879 {
880 new pcount;
881 for(new i=1; i<=MaxClients; i++)
882 {
883 if(IsClientConnectedInGame(i))
884 {
885 if(IsPlayerAlive(i) && GetClientTeam(i) != 1 && GetClientTeam(i) != 0)
886 {
887 pcount++;
888 }
889 }
890 }
891 if(pcount == 1)
892 {
893 endcheck = 1;
894 CS_TerminateRound(3.0, CSRoundEnd_GameStart);
895 }
896 CS_RespawnPlayer(Client);
897 PrintToChatAll("\x07ABF200[System]%N ë‹˜ì´ ì¸ê°„팀으로 입장하셨습니다", Client);
898 }
899 }
900 else if(roundcheck == 1)
901 {
902 if(!IsPlayerAlive(Client))
903 {
904 CS_SwitchTeam(Client, CS_TEAM_T);
905 CS_RespawnPlayer(Client);
906 SetZombie(Client);
907 PrintToChatAll("\x07ABF200[System]%N ë‹˜ì´ ì¢€ë¹„íŒ€ìœ¼ë¡œ 입장하셨습니다", Client);
908 }
909 }
910 }
911 }
912
913 if(Team == 1)
914 {
915 if(GetPlayerWeaponSlot(Client, 0) != -1) RemovePlayerItem(Client, GetPlayerWeaponSlot(Client, 0));
916 if(GetPlayerWeaponSlot(Client, 1) != -1) RemovePlayerItem(Client, GetPlayerWeaponSlot(Client, 1));
917 if(GetPlayerWeaponSlot(Client, 2) != -1) RemovePlayerItem(Client, GetPlayerWeaponSlot(Client, 2));
918 if(GetPlayerWeaponSlot(Client, 3) != -1) RemovePlayerItem(Client, GetPlayerWeaponSlot(Client, 3));
919 if(GetPlayerWeaponSlot(Client, 4) != -1) RemovePlayerItem(Client, GetPlayerWeaponSlot(Client, 4));
920 ChangeClientTeam(Client, 1);
921 PrintToChatAll("\x07ABF200[System]%N ë‹˜ì´ ê´€ì „ìœ¼ë¡œ 입장하셨습니다", Client);
922 }
923
924 return Plugin_Handled;
925}
926
927public Action:NightVision(Client, args)
928{
929 new Handle:menu = CreateMenu(Menu_MainMenu);
930
931 SetMenuTitle(menu, "í´ëž˜ìФ 좀비서버 달러샵");
932
933 AddMenuItem(menu, "0", "ë‚´ì •ë³´");
934 AddMenuItem(menu, "1", "ì¸ë²¤í† 리");
935 AddMenuItem(menu, "2", "ìž¥ì°©ì¤‘ì¸ ì•„ì´í…œ");
936 AddMenuItem(menu, "3", "ì•„ì´í…œ 구매");
937
938 DisplayMenu(menu, Client, MENU_TIME_FOREVER);
939}
940
941public Action:Drop(Client, args)
942{
943 PrintCenterText(Client, "무기는 버릴수 없습니다");
944 return Plugin_Handled;
945}
946
947public Action:KillEntity(Client, args)
948{
949 new target = GetClientAimTarget(Client, false);
950
951 if(target != -1 && IsValidEntity(target))
952 {
953 new String:classname[32];
954 GetEdictClassname(target, classname, 32);
955
956 if(StrContains(classname, "prop_") != -1)
957 AcceptEntityInput(target, "Kill");
958 else
959 PrintToConsole(Client, "프ë¡ì— ì¡°ì¤€í•˜ê³ ìžˆì§€ 않습니다");
960 }
961
962 PrintToConsole(Client, "ì—”í‹°í‹°ì— ì¡°ì¤€í•˜ê³ ìžˆì§€ 않습니다");
963}
964
965public Action:TrailStatus(Client, args)
966{
967 PrintToChat(Client, "%d %d", beamfollowentity[Client], IsValidEntity(beamfollowentity[Client]));
968}
969
970public Action:RenewTable(args)
971{
972 PrintToServer("Renewed");
973 SQL_CreateTable(DB);
974}
975
976//
977//
978//========================= 타ì´ë¨¸, 함수 구간 =========================
979//
980//
981
982public CreateClass(num, String:name[64], String:p1weapon[32], String:p2weapon[32], String:sweapon[32], health, Float:speed, Float:jump)
983{
984 ClassNum[num] = num;
985 ClassName[num] = name;
986 ClassWeapon[num][0] = p1weapon;
987 ClassWeapon[num][1] = p2weapon;
988 ClassWeapon[num][2] = sweapon;
989 ClassHealth[num] = health;
990 ClassSpeed[num] = speed;
991 ClassJump[num] = jump;
992}
993
994public CreateItem(num, const String:name[], type, price, const String:route[])
995{
996 ItemCode[num] = num;
997 strcopy(ItemName[num], 32, name);
998 ItemType[num] = type;
999 ItemPrice[num] = price;
1000 strcopy(ItemRoute[num], 256, route);
1001}
1002
1003public Action:Zm_Countdown(Handle:timer)
1004{
1005 if(countdown > 0)
1006 {
1007 PrintCenterTextAll("ì¢€ë¹„ì„ íƒê¹Œì§€ %d ì´ˆ 남았습니다", countdown);
1008 countdown -= 1;
1009 }
1010 else
1011 {
1012 roundcheck = 1;
1013 CreateTimer(0.1, SelectZombie);
1014 if(h_cdown != INVALID_HANDLE)
1015 {
1016 KillTimer(h_cdown);
1017 h_cdown = INVALID_HANDLE;
1018 }
1019 return Plugin_Stop;
1020 }
1021 return Plugin_Continue;
1022}
1023
1024public Action:RoundTimer(Handle:timer)
1025{
1026 CS_TerminateRound(7.0, CSRoundEnd_CTWin);
1027 if(h_cdown != INVALID_HANDLE)
1028 {
1029 KillTimer(h_cdown);
1030 h_cdown = INVALID_HANDLE;
1031 }
1032}
1033
1034public Action:SelectZombie(Handle:timer)
1035{
1036 new pcount;
1037
1038 for(new i=1; i<=MaxClients; i++)
1039 {
1040 if(IsClientConnectedInGame(i))
1041 {
1042 if(GetClientTeam(i) != 1 && IsPlayerAlive(i))
1043 {
1044 pcount++;
1045 }
1046 }
1047 }
1048
1049 new zcount;
1050
1051 if(pcount < 10) zcount = 1;
1052 else if(pcount >= 20) zcount = 3;
1053 else zcount = 2;
1054
1055 for(new i=0; i<zcount; i++)
1056 {
1057 new zselected = GetRandomPlayer(0);
1058
1059 while(zm[zselected] == 1 || GetClientTeam(zselected) == 1)
1060 zselected = GetRandomPlayer(0);
1061
1062 new String:name[32];
1063 GetClientName(zselected, name, sizeof(name));
1064
1065 SetHostZombie(zselected);
1066
1067 new Float:clientposition[3];
1068 GetClientEyePosition(zselected, clientposition);
1069 EmitSoundToAll(ZmnewSound, SOUND_FROM_WORLD, SNDCHAN_AUTO, SNDLEVEL_GUNFIRE, SND_NOFLAGS, SNDVOL_NORMAL, SNDPITCH_NORMAL, -1, clientposition, NULL_VECTOR, true, 0.0);
1070 }
1071
1072 for(new i=1; i<=MaxClients; i++)
1073 {
1074 if(IsClientConnectedInGame(i) == true)
1075 {
1076 if(zm[i] == 0)
1077 CS_SwitchTeam(i, CS_TEAM_CT);
1078 }
1079 }
1080 new vcount = GetClientCount() / 10;
1081
1082 for(new i=0; i<vcount; i++)
1083 {
1084 new vselected = GetRandomPlayer(0);
1085
1086 while(Class[vselected] == 3 || GetClientTeam(vselected) == 1 || zm[vselected] == 1)
1087 vselected = GetRandomPlayer(0);
1088
1089 new String:name[32];
1090 GetClientName(vselected, name, sizeof(name));
1091 Class[vselected] = 3;
1092 ClassSet(vselected);
1093 }
1094}
1095
1096public SetHostZombie(Client)
1097{
1098 zm[Client] = 1;
1099 CS_SwitchTeam(Client, CS_TEAM_T);
1100 SDKHook(Client, SDKHook_WeaponSwitch, OnWeaponSwitch);
1101 SetEntProp(Client, Prop_Data, "m_iHealth", 10000+(GetClientCount()*3000));
1102 SetEntPropFloat(Client, Prop_Data, "m_flLaggedMovementValue", 1.2);
1103 SetEntityModel(Client, zhskin);
1104 SetEntityRenderColor(Client, 255, 255, 255, 255);
1105
1106 if(GetPlayerWeaponSlot(Client, 0) != -1) RemovePlayerItem(Client, GetPlayerWeaponSlot(Client, 0));
1107 if(GetPlayerWeaponSlot(Client, 1) != -1) RemovePlayerItem(Client, GetPlayerWeaponSlot(Client, 1));
1108 if(GetPlayerWeaponSlot(Client, 2) != -1) RemovePlayerItem(Client, GetPlayerWeaponSlot(Client, 2));
1109 if(GetPlayerWeaponSlot(Client, 3) != -1) RemovePlayerItem(Client, GetPlayerWeaponSlot(Client, 3));
1110 if(GetPlayerWeaponSlot(Client, 4) != -1) RemovePlayerItem(Client, GetPlayerWeaponSlot(Client, 4));
1111
1112 GivePlayerItem(Client, "weapon_knife");
1113
1114 Shake(Client, 2.0, 100.0);
1115 strcopy(NCN[Client], 64, "숙주좀비");
1116}
1117
1118public SetZombie(Client)
1119{
1120 zm[Client] = 1;
1121 CS_SwitchTeam(Client, CS_TEAM_T);
1122 SDKHook(Client, SDKHook_WeaponSwitch, OnWeaponSwitch);
1123 SetEntProp(Client, Prop_Data, "m_iHealth", 10000+(GetClientCount()*1000));
1124 SetEntPropFloat(Client, Prop_Data, "m_flLaggedMovementValue", 1.05);
1125 SetEntityModel(Client, zhskin);
1126 SetEntityRenderColor(Client, 255, 255, 255, 255);
1127
1128 if(GetPlayerWeaponSlot(Client, 0) != -1) RemovePlayerItem(Client, GetPlayerWeaponSlot(Client, 0));
1129 if(GetPlayerWeaponSlot(Client, 1) != -1) RemovePlayerItem(Client, GetPlayerWeaponSlot(Client, 1));
1130 if(GetPlayerWeaponSlot(Client, 2) != -1) RemovePlayerItem(Client, GetPlayerWeaponSlot(Client, 2));
1131 if(GetPlayerWeaponSlot(Client, 3) != -1) RemovePlayerItem(Client, GetPlayerWeaponSlot(Client, 3));
1132 if(GetPlayerWeaponSlot(Client, 4) != -1) RemovePlayerItem(Client, GetPlayerWeaponSlot(Client, 4));
1133
1134 GivePlayerItem(Client, "weapon_knife");
1135
1136 Shake(Client, 2.0, 100.0);
1137 strcopy(NCN[Client], 64, "ì¼ë°˜ì¢€ë¹„");
1138}
1139
1140public Action:Zm_Respawn(Handle:timer, any:Client)
1141{
1142 if(roundcheck == 1)
1143 {
1144 zm[Client] = 1;
1145 CS_RespawnPlayer(Client);
1146 SetZombie(Client);
1147 }
1148 else if(roundcheck == 0)
1149 CS_RespawnPlayer(Client);
1150}
1151
1152public Action:Zm_hurting(Handle:timer, Handle:pack)
1153{
1154 if(roundcheck == 1)
1155 {
1156 ResetPack(pack);
1157 new Client = ReadPackCell(pack);
1158 new attacker = ReadPackCell(pack);
1159 if(hurt[Client] > 0 && IsClientConnectedInGame(Client) && IsPlayerAlive(Client) && zm[Client] == 0 && zm[attacker] == 1)
1160 {
1161 new Float:pos[3];
1162 GetClientEyePosition(attacker, pos);
1163
1164 makeDamage(attacker, Client, 3, DMG_POISON, 1.0, pos, "좀비ê°ì—¼ë‹¹í•˜ëŠ”ì¤‘");
1165
1166 hurt[Client] -= 1;
1167
1168 new Float:clientposition[3];
1169 GetClientEyePosition(Client, clientposition);
1170 EmitSoundToAll(ZminfectSound, SOUND_FROM_WORLD, SNDCHAN_AUTO, SNDLEVEL_NORMAL, SND_NOFLAGS, SNDVOL_NORMAL, SNDPITCH_NORMAL, -1, clientposition, NULL_VECTOR, true, 0.0);
1171 }
1172 else
1173 {
1174 KillTimer(hurting[Client]);
1175 hurting[Client] = INVALID_HANDLE;
1176 }
1177 }
1178}
1179
1180public Action:Setting(Handle:timer, any:Client)
1181{
1182 if(GetPlayerWeaponSlot(Client, 0) != -1) RemovePlayerItem(Client, GetPlayerWeaponSlot(Client, 0));
1183 if(GetPlayerWeaponSlot(Client, 1) != -1) RemovePlayerItem(Client, GetPlayerWeaponSlot(Client, 1));
1184 if(GetPlayerWeaponSlot(Client, 2) != -1) RemovePlayerItem(Client, GetPlayerWeaponSlot(Client, 2));
1185 if(GetPlayerWeaponSlot(Client, 3) != -1) RemovePlayerItem(Client, GetPlayerWeaponSlot(Client, 3));
1186 if(GetPlayerWeaponSlot(Client, 4) != -1) RemovePlayerItem(Client, GetPlayerWeaponSlot(Client, 4));
1187
1188 SetEntPropFloat(Client, Prop_Data, "m_flLaggedMovementValue", 1.0);
1189
1190 new Handle:menu = CreateMenu(Menu_SelectClass);
1191
1192 SetMenuTitle(menu, "===í´ëž˜ìŠ¤ë¥¼ ì„ íƒí•˜ì„¸ìš”===");
1193
1194 for(new i=1; i<MAXCLASS; i++)
1195 {
1196 if(i != 3)
1197 {
1198 new String:ssnum[32];
1199 IntToString(ClassNum[i], ssnum, sizeof(ssnum));
1200 AddMenuItem(menu, ssnum, ClassName[i]);
1201 }
1202 }
1203
1204 DisplayMenu(menu, Client, countdown-1);
1205}
1206
1207public Action:SpawnAll(Handle:timer)
1208{
1209 for(new i=1; i<=MaxClients; i++)
1210 {
1211 if(IsClientConnectedInGame(i))
1212 {
1213 if(!IsPlayerAlive(i))
1214 {
1215 if(GetClientTeam(i) == 2 || GetClientTeam(i) == 3)
1216 CS_RespawnPlayer(i);
1217 }
1218 }
1219 }
1220}
1221
1222public Action:Heal(Handle:timer, any:Client)
1223{
1224 new target = GetClientAimTarget(Client);
1225
1226 if(target != -1)
1227 {
1228 new Float:pos1[3], Float:pos2[3];
1229 GetClientEyePosition(Client, pos1);
1230 GetClientEyePosition(target, pos2);
1231 if(GetVectorDistance(pos1, pos2) <= 250.0 && zm[target] == 0 && GetClientHealth(target) < ClassHealth[Class[target]] && Healed[target] <= ClassHealth[Class[target]]*2)
1232 {
1233 if(GetClientHealth(target) < ClassHealth[Class[target]])
1234 {
1235 SetEntProp(target, Prop_Data, "m_iHealth", GetClientHealth(target)+5);
1236 Healed[target] += 5;
1237 hurt[target] = 0;
1238 SetEntityRenderColor(target, 255, 255, 255, 255);
1239 if(GetClientHealth(target) > ClassHealth[Class[target]])
1240 SetEntProp(target, Prop_Data, "m_iHealth", ClassHealth[Class[target]]);
1241 }
1242 }
1243 }
1244}
1245
1246public CreateAmmoBox(Client)
1247{
1248 new bn;
1249
1250 if(UsedBox[Client][0] == 0)
1251 {
1252 bn = 0;
1253 AmmoBox[Client][1][0] = 500;
1254 }
1255 else if(UsedBox[Client][1] == 0)
1256 {
1257 bn = 1;
1258 AmmoBox[Client][1][1] = 500;
1259 }
1260 else bn = -1;
1261
1262 decl Float:vec[3], Float:fpos[3];
1263 GetClientAimVector(Client, vec);
1264 GetClientAbsOrigin(Client, fpos);
1265
1266 if(bn == -1)
1267 {
1268 PrintHintText(Client, "ì´ë¯¸ ëª¨ë“ íƒ„ì•½ì‚ìžë¥¼ 사용하셨습니다");
1269 }
1270
1271 else if(GetVectorDistance(vec, fpos) > 300.0)
1272 {
1273 bn = -2;
1274 PrintHintText(Client, "거리가 너무 멀어서 탄약ìƒìžë¥¼ ì„¤ì¹˜í• ìˆ˜ì—†ìŠµë‹ˆë‹¤");
1275 }
1276
1277 else if(vec[2] - fpos[2] > 10.0 || vec[2] - fpos[2] < -10.0)
1278 {
1279 bn = -3;
1280 PrintHintText(Client, "바닥ì—ë§Œ ì„¤ì¹˜í• ìˆ˜ 있습니다");
1281 }
1282
1283 if(bn > -1)
1284 {
1285 vec[2] += 30;
1286 AmmoBox[Client][0][bn] = CreateEntityByName("prop_physics");
1287 SetEntPropEnt(AmmoBox[Client][0][bn], Prop_Send, "m_hOwnerEntity", Client);
1288 DispatchKeyValue(AmmoBox[Client][0][bn], "model", BoxModel);
1289 DispatchSpawn(AmmoBox[Client][0][bn]);
1290 TeleportEntity(AmmoBox[Client][0][bn], vec, NULL_VECTOR, NULL_VECTOR);
1291 SetEntProp(AmmoBox[Client][0][bn], Prop_Data, "m_CollisionGroup", 1);
1292 SetEntProp(AmmoBox[Client][0][bn], Prop_Data, "m_takedamage", 0, 1);
1293 SetEntPropEnt(AmmoBox[Client][0][bn], Prop_Send, "m_iTeamNum", bn);
1294 new Float:clientposition[3];
1295 GetClientEyePosition(Client, clientposition);
1296 EmitSoundToAll(AmmoSound, SOUND_FROM_WORLD, SNDCHAN_AUTO, SNDLEVEL_GUNFIRE, SND_NOFLAGS, SNDVOL_NORMAL, SNDPITCH_NORMAL, -1, clientposition, NULL_VECTOR, true, 0.0);
1297 UsedBox[Client][bn] = 1;
1298 }
1299}
1300
1301public Action:GoCreateAmmo(Handle:timer, any:Client)
1302{
1303 if(UsingBox[Client] == 1)
1304 {
1305 CreateAmmoBox(Client);
1306 SetEntPropFloat(Client, Prop_Send, "m_flProgressBarStartTime", 0.0);
1307 SetEntProp(Client, Prop_Send, "m_iProgressBarDuration", 0);
1308 }
1309}
1310
1311public Action:UnLimitUseBox(Handle:timer, any:Client)
1312{
1313 LimitUseBox[Client] = 0;
1314}
1315
1316public GetAmmo(Client, Creater, bn)
1317{
1318 new weapon = GetEntPropEnt(Client, Prop_Send, "m_hActiveWeapon");
1319 new iOffset = GetEntProp(weapon, Prop_Send, "m_iPrimaryAmmoType", 1)*4;
1320 new iAmmo = FindSendPropInfo("CCSPlayer", "m_iAmmo");
1321
1322 if(GetEntData(Client, iAmmo+iOffset, 4) < 500)
1323 {
1324 if(AmmoBox[Creater][1][bn] >= 30)
1325 {
1326 AmmoBox[Creater][1][bn] -= 30;
1327 SetEntData(Client, iAmmo+iOffset, GetEntData(Client, iAmmo+iOffset, 4)+30, 4, true);
1328 }
1329 else
1330 {
1331 SetEntData(Client, iAmmo+iOffset, GetEntData(Client, iAmmo+iOffset, 4) + AmmoBox[Creater][1][bn], 4, true);
1332 AmmoBox[Creater][1][bn] = 0;
1333 }
1334 if(GetEntData(Client, iAmmo+iOffset, 4) > 500)
1335 {
1336 AmmoBox[Creater][1][bn] += GetEntData(Client, iAmmo+iOffset, 4)-500;
1337 SetEntData(Client, iAmmo+iOffset, 500, 4, true);
1338 }
1339 }
1340 if(AmmoBox[Creater][1][bn] <= 0)
1341 {
1342 AcceptEntityInput(AmmoBox[Creater][0][bn], "Kill");
1343 }
1344}
1345
1346public CreateBc(Client)
1347{
1348 new bn;
1349
1350 if(UsedBc[Client][0] == 0) bn = 0;
1351 else if(UsedBc[Client][1] == 0) bn = 1;
1352 else if(UsedBc[Client][2] == 0) bn = 2;
1353 else bn = -1;
1354
1355 if(bn > -1)
1356 {
1357 new Float:epos[3], Float:bpos[3], Float:endpos[3];
1358 GetClientEyePosition(Client, epos);
1359 GetClientAimVector(Client, bpos);
1360
1361 if(GetVectorDistance(epos, bpos) > 100.0)
1362 GetClientDistanceAim(Client, 100.0, endpos);
1363 else
1364 endpos = bpos;
1365
1366 Barricade[Client][bn] = CreateEntityByName("prop_physics");
1367 DispatchKeyValue(Barricade[Client][bn], "model", BcModel);
1368 DispatchSpawn(Barricade[Client][bn]);
1369 TeleportEntity(Barricade[Client][bn], endpos, NULL_VECTOR, NULL_VECTOR);
1370 SetEntProp(Barricade[Client][bn], Prop_Send, "m_usSolidFlags", 8);
1371 SetEntityMoveType(Barricade[Client][bn], MOVETYPE_NONE);
1372 SetEntProp(Barricade[Client][bn], Prop_Data, "m_takedamage", 2, 1);
1373 SetEntProp(Barricade[Client][bn], Prop_Data, "m_iHealth", 200, 1);
1374 AcceptEntityInput(Barricade[Client][bn], "EnableCollision");
1375 SetEntProp(Barricade[Client][bn], Prop_Data, "m_CollisionGroup", 1);
1376 SetEntityRenderColor(Barricade[Client][bn], 255, 255, 255, 120);
1377 CreateTimer(1.5, BlockBarricade, Barricade[Client][bn]);
1378 SDKHook(Barricade[Client][bn], SDKHook_OnTakeDamage, OnTakeDamageHookEntity);
1379 new Float:clientposition[3];
1380 GetClientEyePosition(Client, clientposition);
1381 EmitSoundToAll(BcSound, SOUND_FROM_WORLD, SNDCHAN_AUTO, SNDLEVEL_GUNFIRE, SND_NOFLAGS, SNDVOL_NORMAL, SNDPITCH_NORMAL, -1, clientposition, NULL_VECTOR, true, 0.0);
1382 UsedBc[Client][bn] = 1;
1383 }
1384 else
1385 PrintHintText(Client, "ì´ë¯¸ 바리케ì´ë“œë¥¼ 사용하셨습니다");
1386}
1387
1388public Action:GoCreateBc(Handle:timer, any:Client)
1389{
1390 if(UsingBc[Client] == 1)
1391 {
1392 SetEntPropFloat(Client, Prop_Send, "m_flProgressBarStartTime", 0.0);
1393 SetEntProp(Client, Prop_Send, "m_iProgressBarDuration", 0);
1394 CreateBc(Client);
1395 }
1396}
1397
1398public Action:UnLimitUseBc(Handle:timer, any:Client)
1399{
1400 LimitUseBc[Client] = 0;
1401}
1402
1403public Action:BlockBarricade(Handle:timer, any:prop)
1404{
1405 SetEntProp(prop, Prop_Data, "m_CollisionGroup", 0);
1406 SetEntityRenderColor(prop, 255, 255, 255, 255);
1407}
1408
1409public SniperMenu(Client)
1410{
1411 new Handle:menu = CreateMenu(Menu_SniperSelect)
1412
1413 SetMenuTitle(menu, "===탄약목ë¡===");
1414
1415 AddMenuItem(menu, "0", "강화탄");
1416 AddMenuItem(menu, "1", "í발탄");
1417 AddMenuItem(menu, "2", "빙결탄");
1418
1419 DisplayMenu(menu, Client, MENU_TIME_FOREVER);
1420}
1421
1422public ActiveSt(Client)
1423{
1424 if(zm[Client] == 0)
1425 {
1426 if(GetClientHealth(Client) <= ClassHealth[Class[Client]]/3)
1427 {
1428 PrintToChat(Client, "\x04[스팀팩] ì²´ë ¥ì´ ë„ˆë¬´ ì 어서 ìŠ¤íŒ€íŒ©ì„ ë°œë™ì‹œí‚¬ìˆ˜ 없습니다");
1429 }
1430
1431 else
1432 {
1433 new Float:ppos[3];
1434 GetClientEyePosition(Client, ppos);
1435 SetEntityHealth(Client, GetClientHealth(Client) - ClassHealth[Class[Client]]/3)
1436
1437 EmitSoundToAll(StimpackSound1, SOUND_FROM_WORLD, SNDCHAN_AUTO, SNDLEVEL_GUNFIRE, SND_NOFLAGS, SNDVOL_NORMAL, SNDPITCH_NORMAL, -1, ppos, NULL_VECTOR, true, 0.0);
1438
1439 SetEntPropFloat(Client, Prop_Data, "m_flLaggedMovementValue", 1.5);
1440
1441 ActivingSt[Client] = 1;
1442
1443 CreateTimer(7.0, UnActiveSt, Client);
1444 }
1445 }
1446}
1447
1448public Action:GoActiveSt(Handle:timer, any:Client)
1449{
1450 if(UsingSt[Client] == 1)
1451 {
1452 SetEntPropFloat(Client, Prop_Send, "m_flProgressBarStartTime", 0.0);
1453 SetEntProp(Client, Prop_Send, "m_iProgressBarDuration", 0);
1454 ActiveSt(Client);
1455 }
1456}
1457
1458public Action:UnLimitUseSt(Handle:timer, any:Client)
1459{
1460 LimitUseSt[Client] = 0;
1461}
1462
1463public Action:UnActiveSt(Handle:timer, any:Client)
1464{
1465 ActivingSt[Client] = 0;
1466 SetEntPropFloat(Client, Prop_Data, "m_flLaggedMovementValue", ClassSpeed[Class[Client]]);
1467}
1468
1469public ClassSet(Client)
1470{
1471 strcopy(NCN[Client], 64, ClassName[Class[Client]]);
1472 SetEntProp(Client, Prop_Data, "m_iHealth", ClassHealth[Class[Client]]);
1473 SetEntPropFloat(Client, Prop_Data, "m_flLaggedMovementValue", ClassSpeed[Class[Client]]);
1474
1475 if(Class[Client] == 3)
1476 {
1477 if(GetPlayerWeaponSlot(Client, 0) != -1) RemovePlayerItem(Client, GetPlayerWeaponSlot(Client, 0));
1478 if(GetPlayerWeaponSlot(Client, 1) != -1) RemovePlayerItem(Client, GetPlayerWeaponSlot(Client, 1));
1479 if(GetPlayerWeaponSlot(Client, 2) != -1) RemovePlayerItem(Client, GetPlayerWeaponSlot(Client, 2));
1480 if(GetPlayerWeaponSlot(Client, 3) != -1) RemovePlayerItem(Client, GetPlayerWeaponSlot(Client, 3));
1481 if(GetPlayerWeaponSlot(Client, 4) != -1) RemovePlayerItem(Client, GetPlayerWeaponSlot(Client, 4));
1482
1483 GivePlayerItem(Client, "weapon_m249");
1484 GivePlayerItem(Client, "weapon_elite");
1485 GivePlayerItem(Client, "weapon_knife");
1486 }
1487
1488 if(Class[Client] == 6)
1489 {
1490 SniperBullet[Client] = -1;
1491 }
1492}
1493
1494public CheckLevel(Client)
1495{
1496 if(Xp[Client] >= MaxXp[Client])
1497 {
1498 Xp[Client] = Xp[Client] - MaxXp[Client];
1499 MaxXp[Client] += 2*10*Level[Client];
1500 Level[Client] += 1;
1501 PrintToChat(Client, "\x04 ë ˆë²¨ì—…!");
1502 }
1503}
1504
1505public Action:HintText(Handle:timer, any:Client)
1506{
1507 if(IsClientConnectedInGame(Client) && !IsFakeClient(Client))
1508 {
1509 decl String:dod[256];
1510
1511 new Health = GetEntProp(Client, Prop_Data, "m_iHealth");
1512 new PM = PMnum[Client];
1513 new hcount, zcount;
1514
1515 for(new i=1; i<=MaxClients; i++)
1516 {
1517 if(IsClientConnectedInGame(i))
1518 {
1519 if(GetClientTeam(i) != 1 && GetClientTeam(i) != 0)
1520 {
1521 if(zm[i] == 0)
1522 hcount++;
1523 else
1524 zcount++;
1525 }
1526 }
1527 }
1528
1529 if(PJoined[Client] == 1)
1530 {
1531 new String:p1n[32], String:p2n[32], String:p3n[32], String:p4n[32];
1532 new String:p1a[32], String:p2a[32], String:p3a[32], String:p4a[32];
1533 if(PM <= 0)
1534 p1n = "ì—†ìŒ";
1535 else
1536 {
1537 GetClientName(PM, p1n, sizeof(p1n));
1538 if(IsPlayerAlive(PM) && zm[PM] == 0)
1539 strcopy(p1a, sizeof(p1a), ClassName[Class[PM]]);
1540 else
1541 strcopy(p1a, sizeof(p1a), "사ë§");
1542 }
1543
1544 if(P1[PM] <= 0)
1545 p2n = "ì—†ìŒ";
1546 else
1547 {
1548 GetClientName(P1[PM], p2n, sizeof(p2n));
1549 if(IsPlayerAlive(P1[PM]) && zm[P1[PM]] == 0)
1550 strcopy(p2a, sizeof(p2a), ClassName[Class[P1[PM]]]);
1551 else
1552 strcopy(p2a, sizeof(p2a), "사ë§");
1553 }
1554
1555 if(P2[PM] <= 0)
1556 p3n = "ì—†ìŒ";
1557 else
1558 {
1559 GetClientName(P2[PM], p3n, sizeof(p3n));
1560 if(IsPlayerAlive(P1[PM]) && zm[P1[PM]] == 0)
1561 strcopy(p3a, sizeof(p3a), ClassName[Class[P2[PM]]]);
1562 else
1563 strcopy(p3a, sizeof(p3a), "사ë§");
1564 }
1565
1566 if(P3[PM] <= 0)
1567 p4n = "ì—†ìŒ";
1568 else
1569 {
1570 GetClientName(P3[PM], p4n, sizeof(p4n));
1571 if(IsPlayerAlive(P1[PM]) && zm[P1[PM]] == 0)
1572 strcopy(p4a, sizeof(p4a), ClassName[Class[P3[PM]]]);
1573 else
1574 strcopy(p4a, sizeof(p4a), "사ë§");
1575 }
1576
1577 Format(dod, sizeof(dod), "í´ëž˜ìФ : %s\nì²´ë ¥ : %d\në ˆë²¨ : %d\n경험치 : %d\n다ìŒë ˆë²¨ì—…까지 : %d\në‚¨ì€ ì¸ê°„수 : %d\në‚¨ì€ ì¢€ë¹„ìˆ˜ : %d\n\n파티ì›\n%s-%s\n%s-%s\n%s-%s\n%s-%s\n", NCN[Client], Health, Level[Client], Xp[Client], MaxXp[Client], hcount, zcount, p1a, p1n, p2a, p2n, p3a, p3n, p4a, p4n);
1578 }
1579 else
1580 Format(dod, sizeof(dod), "í´ëž˜ìФ : %s\nì²´ë ¥ : %d\në ˆë²¨ : %d\n경험치 : %d\n다ìŒë ˆë²¨ì—…까지 : %d\në‚¨ì€ ì¸ê°„수 : %d\në‚¨ì€ ì¢€ë¹„ìˆ˜ : %d\n", NCN[Client], Health, Level[Client], Xp[Client], MaxXp[Client], hcount, zcount);
1581
1582 new Handle:buffer = StartMessageOne("KeyHintText", Client);
1583
1584 BfWriteByte(buffer, 1);
1585 BfWriteString(buffer, dod);
1586 EndMessage();
1587
1588 new target = GetClientAimTarget(Client, false);
1589
1590 if(target != -1)
1591 {
1592 new Float:epos[3], Float:ppos[3];
1593
1594 GetClientEyePosition(Client, epos);
1595 GetEntPropVector(target, Prop_Send, "m_vecOrigin", ppos);
1596
1597 if(GetVectorDistance(epos, ppos) < 300.0)
1598 {
1599 new String:buffer2[32];
1600 GetEntPropString(target, Prop_Data, "m_ModelName", buffer2, sizeof(buffer2))
1601
1602 if(!StrContains(buffer2, "models/props_interiors/vendingm"))
1603 PrintCenterText(Client, "바리케ì´ë“œì˜ ë‚¨ì€ ì²´ë ¥ : %d", GetEntProp(target, Prop_Data, "m_iHealth"));
1604 if(GetEntPropEnt(target, Prop_Send, "m_iTeamNum") == 0)
1605 PrintCenterText(Client, "ë‚¨ì€ íƒ„ì•½ : %d", AmmoBox[GetEntPropEnt(target, Prop_Send, "m_hOwnerEntity")][1][0]);
1606 if(GetEntPropEnt(target, Prop_Send, "m_iTeamNum") == 1)
1607 PrintCenterText(Client, "ë‚¨ì€ íƒ„ì•½ : %d", AmmoBox[GetEntPropEnt(target, Prop_Send, "m_hOwnerEntity")][1][1]);
1608 }
1609 }
1610 CreateTimer(0.5, HintText, Client);
1611 }
1612}
1613
1614public Action:NoPerson(Handle:timer)
1615{
1616 new pcount;
1617
1618 for(new i=1; i<=MaxClients; i++)
1619 {
1620 if(IsClientConnectedInGame(i))
1621 {
1622 if(GetClientTeam(i) != 1 && GetClientTeam(i) != 0)
1623 {
1624 pcount++;
1625 }
1626 }
1627 }
1628
1629 if(pcount < 2)
1630 {
1631 PrintCenterTextAll("ê²Œìž„ì´ ì‹œìž‘ë ë ¤ë©´ ì¸ì›ì´ 2명ì´ìƒì´ì–´ì•¼ 합니다");
1632 }
1633 CreateTimer(0.5, NoPerson);
1634}
1635
1636public Save(Client)
1637{
1638 if(firstcheck[Client] == 0)
1639 firstcheck[Client] = 1;
1640 if(Level[Client] == 0)
1641 Level[Client] = 0;
1642 if(MaxXp[Client] == 0)
1643 MaxXp[Client] = 100;
1644
1645 new String:auth[32];
1646 GetClientAuthId(Client, AuthId_SteamID64, auth, sizeof(auth));
1647 SQL_SaveClientData(DB, Client);
1648}
1649
1650public Load(Client)
1651{
1652 new String:auth[32];
1653 GetClientAuthId(Client, AuthId_SteamID64, auth, sizeof(auth));
1654 SQL_CheckFirstClient(DB, Client, auth);
1655}
1656
1657public Action:GetTeam(Client, args)
1658{
1659 PrintToChat(Client, "%d", GetEntPropEnt(GetClientAimTarget(Client, false), Prop_Send, "m_iTeamNum"));
1660}
1661
1662public AddItem(Client, code)
1663{
1664 for(new i=0; i<MAXINVEN; i++)
1665 {
1666 if(Inventory[Client][i] == -1)
1667 {
1668 Inventory[Client][i] = code;
1669 break;
1670 }
1671 }
1672}
1673
1674public SetInventoryOrder(Client)
1675{
1676 for(new i=0; i<MAXINVEN-1; i++)
1677 {
1678 if(Inventory[Client][i] == -1)
1679 {
1680 if(Inventory[Client][i+1] != -1)
1681 {
1682 Inventory[Client][i] = Inventory[Client][i+1];
1683 Inventory[Client][i+1] = -1;
1684 }
1685 }
1686 }
1687}
1688
1689public Action:TrailTimer(Handle:timer)
1690{
1691 for(new i=1; i<=MaxClients; i++)
1692 {
1693 if(IsClientConnectedInGame(i))
1694 {
1695 if(IsPlayerAlive(i))
1696 {
1697 DeleteTrail(i);
1698 CreateTrail(i);
1699 }
1700 }
1701 }
1702}
1703
1704//
1705//
1706//========================= ë©”ë‰´ì„ íƒ êµ¬ê°„ =========================
1707//
1708//
1709
1710public Menu_SniperSelect(Handle:menu, MenuAction:action, Client, select)
1711{
1712 if(action == MenuAction_Select)
1713 {
1714 SniperBullet[Client] = select;
1715 }
1716}
1717
1718public Menu_SelectClass(Handle:menu, MenuAction:action, Client, select)
1719{
1720 if(action == MenuAction_Select)
1721 {
1722 if(roundcheck == 0 && zm[Client] == 0)
1723 {
1724 if(UsedBox[Client][0] == 1 || UsedBox[Client][1] == 1 || UsedBc[Client][0] == 1 || UsedBc[Client][1] == 1 || UsedBc[Client][2] == 1)
1725 {
1726 PrintToChat(Client, "\x04[Server] ì´ë¯¸ 바리케ì´ë“œë‚˜ 탄약ìƒìžë¥¼ 사용하셨으므로 변경불가능합니다");
1727 }
1728 else
1729 {
1730 new cclass;
1731 new String:info[32];
1732 GetMenuItem(menu, select, info, sizeof(info));
1733 StringToIntEx(info, cclass);
1734 Class[Client] = cclass;
1735
1736 new Handle:wmenu = CreateMenu(Menu_SelectWeapon);
1737
1738 SetMenuTitle(wmenu, "===주무기를 ì„ íƒí•˜ì„¸ìš”===");
1739
1740 AddMenuItem(wmenu, "0", ClassWeapon[Class[Client]][0]);
1741 AddMenuItem(wmenu, "1", ClassWeapon[Class[Client]][1]);
1742
1743 DisplayMenu(wmenu, Client, MENU_TIME_FOREVER);
1744
1745 ClassSet(Client);
1746
1747 PrintHintText(Client, "%s", ClassInfo[Class[Client]]);
1748 }
1749 }
1750 else
1751 {
1752 if(zm[Client] == 1) PrintToChat(Client, "\x04[Server] 좀비는 ì´ ê¸°ëŠ¥ì„ ì´ìš©í•˜ì‹¤ìˆ˜ 없습니다");
1753 }
1754 }
1755}
1756
1757public Menu_SelectWeapon(Handle:menu, MenuAction:action, Client, select)
1758{
1759 if(action == MenuAction_Select)
1760 {
1761 if(GetPlayerWeaponSlot(Client, 0) != -1) RemovePlayerItem(Client, GetPlayerWeaponSlot(Client, 0));
1762 if(GetPlayerWeaponSlot(Client, 1) != -1) RemovePlayerItem(Client, GetPlayerWeaponSlot(Client, 1));
1763 if(GetPlayerWeaponSlot(Client, 2) != -1) RemovePlayerItem(Client, GetPlayerWeaponSlot(Client, 2));
1764 if(GetPlayerWeaponSlot(Client, 3) != -1) RemovePlayerItem(Client, GetPlayerWeaponSlot(Client, 3));
1765 if(GetPlayerWeaponSlot(Client, 4) != -1) RemovePlayerItem(Client, GetPlayerWeaponSlot(Client, 4));
1766
1767 GivePlayerItem(Client, "weapon_knife");
1768 GivePlayerItem(Client, ClassWeapon[Class[Client]][select]);
1769 GivePlayerItem(Client, ClassWeapon[Class[Client]][2]);
1770 }
1771}
1772
1773public Menu_Party(Handle:menu, MenuAction:action, Client, select)
1774{
1775 if(action == MenuAction_Select)
1776 {
1777 if(select == 0)
1778 Cmd_Pcreate(Client);
1779 if(select == 1)
1780 {
1781 if(Pmaster[Client] == 0 && PJoined[Client] == 0)
1782 {
1783 Cmd_PJoinList(Client);
1784 }
1785 else
1786 {
1787 PrintToChat(Client, "\x05[Party] \x04íŒŒí‹°ì— ê°€ìž…ë˜ì–´ìžˆì§€ 않아야 합니다.");
1788 }
1789 }
1790 if(select == 2)
1791 {
1792 if(Pmaster[Client] == 1)
1793 {
1794 Cmd_PList(Client);
1795 }
1796 else
1797 {
1798 PrintToChat(Client, "\x05[Party] \x04파티장만 가능합니다.");
1799 }
1800 }
1801 if(select == 3)
1802 Cmd_Pout(Client);
1803 }
1804}
1805
1806public Menu_MainMenu(Handle:menu, MenuAction:action, Client, select)
1807{
1808 if(action == MenuAction_Select)
1809 {
1810 if(select == 0)
1811 {
1812 new String:sdollar[32], String:SteamId[32], String:SteamId2[64];
1813 GetClientAuthId(Client, AuthId_Steam2, SteamId, sizeof(SteamId));
1814
1815 Format(sdollar, sizeof(sdollar), "내 달러 : %d", dollar[Client]);
1816 Format(SteamId2, sizeof(SteamId2), "ë‚´ ê³ ìœ ë²ˆí˜¸ : %s", SteamId);
1817
1818
1819 new Handle:mmenu = CreateMenu(Menu_MyInfo);
1820
1821 SetMenuTitle(mmenu, "ë‚´ ì •ë³´");
1822
1823 AddMenuItem(mmenu, "0", sdollar, ITEMDRAW_DISABLED);
1824 AddMenuItem(mmenu, "1", SteamId2, ITEMDRAW_DISABLED);
1825
1826 DisplayMenu(mmenu, Client, MENU_TIME_FOREVER);
1827 }
1828 if(select == 1)
1829 {
1830 new Handle:mmenu = CreateMenu(Menu_Inventory);
1831
1832 SetMenuTitle(mmenu, "ì¸ë²¤í† 리");
1833
1834 if(Inventory[Client][0] == -1)
1835 {
1836 AddMenuItem(mmenu, "0", "ì¸ë²¤í† ë¦¬ì— ì•„ë¬´ê²ƒë„ ì—†ìŠµë‹ˆë‹¤", ITEMDRAW_DISABLED);
1837 }
1838
1839 else
1840 {
1841 for(new i=0; i<MAXINVEN; i++)
1842 {
1843 if(Inventory[Client][i] != -1)
1844 {
1845 new String:buffer[8];
1846 IntToString(i, buffer, sizeof(buffer));
1847 AddMenuItem(mmenu, buffer, ItemName[Inventory[Client][i]]);
1848 }
1849 }
1850 }
1851
1852 DisplayMenu(mmenu, Client, MENU_TIME_FOREVER);
1853 }
1854 if(select == 2)
1855 {
1856 new Handle:emenu = CreateMenu(Menu_EquipSelect);
1857 new String:buffer[32];
1858 new String:info[8];
1859
1860 SetMenuTitle(emenu, "ìž¥ì°©ì¤‘ì¸ ì•„ì´í…œ");
1861
1862 for(new i=0; i<MAXTYPE; i++)
1863 {
1864 if(UsingItem[Client][i] != -1)
1865 {
1866 Format(buffer, sizeof(buffer), "%s : %s", ItemTypeName[ItemType[UsingItem[Client][i]]], ItemName[UsingItem[Client][i]]);
1867 IntToString(UsingItem[Client][i], info, sizeof(info));
1868 AddMenuItem(emenu, info, buffer);
1869 }
1870 else
1871 {
1872 Format(buffer, sizeof(buffer), "%s : ì—†ìŒ", ItemTypeName[i]);
1873 AddMenuItem(emenu, "", buffer, ITEMDRAW_DISABLED);
1874 }
1875 }
1876 DisplayMenu(emenu, Client, MENU_TIME_FOREVER);
1877 }
1878 if(select == 3)
1879 {
1880 new Handle:mmenu = CreateMenu(Menu_ItemMenu);
1881 new String:info[8];
1882
1883 SetMenuTitle(mmenu, "ì•„ì´í…œ 구입");
1884
1885 for(new i=0; i<MAXTYPE; i++)
1886 {
1887 IntToString(i, info, sizeof(info));
1888 AddMenuItem(mmenu, info, ItemTypeName[i]);
1889 }
1890
1891 DisplayMenu(mmenu, Client, MENU_TIME_FOREVER);
1892 }
1893 }
1894}
1895
1896public Menu_MyInfo(Handle:menu, MenuAction:action, Client, select)
1897{
1898}
1899
1900public Menu_Inventory(Handle:menu, MenuAction:action, Client, select)
1901{
1902 if(action == MenuAction_Select)
1903 {
1904 new String:info[8];
1905 GetMenuItem(menu, select, info, sizeof(info));
1906
1907 new Handle:imenu = CreateMenu(Menu_EquipOrDelete);
1908
1909 SetMenuTitle(imenu, "ì¸ë²¤í† 리");
1910
1911 AddMenuItem(imenu, info, "장착");
1912 AddMenuItem(imenu, info, "ì‚ì œ");
1913
1914 DisplayMenu(imenu, Client, MENU_TIME_FOREVER);
1915 }
1916}
1917
1918public Menu_ItemMenu(Handle:menu, MenuAction:action, Client, select)
1919{
1920 if(action == MenuAction_Select)
1921 {
1922 new String:info[32], inum;
1923 GetMenuItem(menu, select, info, sizeof(info));
1924 StringToIntEx(info, inum);
1925
1926 new Handle:imenu = CreateMenu(Menu_BuyItem);
1927
1928 SetMenuTitle(imenu, "í´ëž˜ìФ 좀비서버 달러샵");
1929
1930 for(new i=0; i<MAXITEM; i++)
1931 {
1932 if(ItemType[i] == inum)
1933 {
1934 new String:buffer[60], String:iinfo[8];
1935 Format(buffer, sizeof(buffer), "%s - %d", ItemName[i], ItemPrice[i]);
1936 IntToString(ItemCode[i], iinfo, sizeof(iinfo));
1937 AddMenuItem(imenu, iinfo, buffer);
1938 }
1939 }
1940
1941 DisplayMenu(imenu, Client, MENU_TIME_FOREVER);
1942 }
1943}
1944
1945public Menu_EquipOrDelete(Handle:menu, MenuAction:action, Client, select)
1946{
1947 if(action == MenuAction_Select)
1948 {
1949 new String:info[8], citem;
1950 GetMenuItem(menu, select, info, sizeof(info));
1951 StringToIntEx(info, citem);
1952
1953 if(select == 0)
1954 {
1955 if(UsingItem[Client][ItemType[Inventory[Client][citem]]] != -1)
1956 {
1957 AddItem(Client, UsingItem[Client][ItemType[Inventory[Client][citem]]]);
1958 UsingItem[Client][ItemType[Inventory[Client][citem]]] = -1;
1959 }
1960
1961 UsingItem[Client][ItemType[Inventory[Client][citem]]] = Inventory[Client][citem];
1962 PrintToChat(Client, "ì¸ë²¤í† 리 %d ì¹¸ì— ìžˆëŠ” ì•„ì´í…œ %s 를 착용하셨습니다", citem, ItemName[Inventory[Client][citem]]);
1963 Inventory[Client][citem] = -1;
1964 SetInventoryOrder(Client);
1965 Save(Client);
1966 }
1967
1968 if(select == 1)
1969 {
1970 new Handle:imenu = CreateMenu(Menu_EquipOrDelete2);
1971
1972 SetMenuTitle(imenu, "ì •ë§ë¡œ ì‚ì œí•˜ì‹œê² ìŠµë‹ˆê¹Œ");
1973
1974 AddMenuItem(imenu, info, "예");
1975 AddMenuItem(imenu, info, "아니오");
1976
1977 DisplayMenu(imenu, Client, MENU_TIME_FOREVER);
1978 }
1979 }
1980}
1981
1982public Menu_EquipOrDelete2(Handle:menu, MenuAction:action, Client, select)
1983{
1984 if(action == MenuAction_Select)
1985 {
1986 if(select == 0)
1987 {
1988 new String:info[8], citem;
1989 GetMenuItem(menu, select, info, sizeof(info));
1990 StringToIntEx(info, citem);
1991 Inventory[Client][citem] = -1;
1992 SetInventoryOrder(Client);
1993 PrintToChat(Client, "\x04[달러샵] ì•„ì´í…œì´ ì‚ì œë˜ì—ˆìŠµë‹ˆë‹¤");
1994 Save(Client);
1995 }
1996 else if(select == 1)
1997 {
1998 CloseHandle(menu);
1999 }
2000 }
2001}
2002
2003public Menu_BuyItem(Handle:menu, MenuAction:action, Client, select)
2004{
2005 if(action == MenuAction_Select)
2006 {
2007 new String:info[32], cnum;
2008 GetMenuItem(menu, select, info, sizeof(info));
2009 StringToIntEx(info, cnum);
2010
2011 if(dollar[Client] >= ItemPrice[cnum])
2012 {
2013 AddItem(Client, cnum);
2014 dollar[Client] -= ItemPrice[cnum];
2015 PrintToChat(Client, "\x04[달러샵] ì•„ì´í…œ %s 를 구매하셨습니다", ItemName[cnum]);
2016 Save(Client);
2017 }
2018 else
2019 PrintToChat(Client, "\x04[달러샵] ì•„ì´í…œ %s 를 êµ¬ë§¤í•˜ëŠ”ë° í•„ìš”í•œ 달러가 부족합니다", ItemName[cnum]);
2020 }
2021}
2022
2023public Menu_EquipSelect(Handle:menu, MenuAction:action, Client, select)
2024{
2025 if(action == MenuAction_Select)
2026 {
2027 new String:info[32], cnum;
2028 GetMenuItem(menu, select, info, sizeof(info));
2029 StringToIntEx(info, cnum);
2030
2031 AddItem(Client, cnum);
2032 UsingItem[Client][ItemType[cnum]] = -1;
2033 PrintToChat(Client, "\x04[달러샵] ì•„ì´í…œì´ ì¸ë²¤í† 리로 보내졌습니다");
2034 Save(Client);
2035 }
2036}
2037
2038//
2039//
2040//========================= SDK훅 구간 =========================
2041//
2042//
2043
2044public Action:OnWeaponSwitch(Client, weapon)
2045{
2046 decl String:sWeapon[32];
2047 GetEdictClassname(weapon, sWeapon, sizeof(sWeapon));
2048 if(!StrEqual(sWeapon, "weapon_knife"))
2049 {
2050 if(GetPlayerWeaponSlot(Client, 0) != -1) RemovePlayerItem(Client, GetPlayerWeaponSlot(Client, 0));
2051 if(GetPlayerWeaponSlot(Client, 1) != -1) RemovePlayerItem(Client, GetPlayerWeaponSlot(Client, 1));
2052 if(GetPlayerWeaponSlot(Client, 3) != -1) RemovePlayerItem(Client, GetPlayerWeaponSlot(Client, 3));
2053 if(GetPlayerWeaponSlot(Client, 4) != -1) RemovePlayerItem(Client, GetPlayerWeaponSlot(Client, 4));
2054 return Plugin_Handled;
2055 }
2056 return Plugin_Continue;
2057}
2058
2059public Action:OnTakeDamageHook(Client, &attacker, &inflictor, &Float:damage, &damagetype)
2060{
2061 if(roundcheck == 0 || roundcheck == 2)
2062 {
2063 return Plugin_Handled;
2064 }
2065
2066 if(damagetype & DMG_FALL)
2067 {
2068 damage = damage / 2;
2069
2070 return Plugin_Changed;
2071 }
2072
2073 if(damagetype & DMG_BLAST)
2074 {
2075 if(zm[attacker] == 0 && zm[Client] == 0)
2076 {
2077 return Plugin_Handled;
2078 }
2079 }
2080
2081 if(damagetype & DMG_CLUB)
2082 {
2083 return Plugin_Continue;
2084 }
2085
2086 if(roundcheck == 1)
2087 {
2088 if(zm[Client] == 0)
2089 {
2090 if(zm[attacker] == 1)
2091 {
2092 new pcount;
2093
2094 for(new i=1; i<=MaxClients; i++)
2095 {
2096 if(IsClientConnectedInGame(i) && IsPlayerAlive(i) && GetClientTeam(i) == CS_TEAM_CT && zm[i] == 0)
2097 pcount++;
2098 }
2099
2100 if(damage > 11)
2101 {
2102 if(damage > 50)
2103 {
2104 damage = float(ClassHealth[Class[Client]] / 2);
2105 }
2106
2107 else
2108 damage = 20.0;
2109
2110 hurt[Client] = 9999;
2111 }
2112
2113 if(damage >= float(GetClientHealth(Client)))
2114 {
2115 SetZombie(Client);
2116 FakeDeath(Client, attacker);
2117
2118 new Float:clientposition[3];
2119 GetClientEyePosition(Client, clientposition);
2120 EmitSoundToAll(ZmchangeSound, SOUND_FROM_WORLD, SNDCHAN_AUTO, SNDLEVEL_GUNFIRE, SND_NOFLAGS, SNDVOL_NORMAL, SNDPITCH_NORMAL, -1, clientposition, NULL_VECTOR, true, 0.0);
2121
2122 if(pcount == 1)
2123 CS_TerminateRound(7.0, CSRoundEnd_TerroristWin);
2124
2125 return Plugin_Handled;
2126 }
2127 if(hurting[Client] == INVALID_HANDLE)
2128 {
2129 new Handle:pack;
2130 hurting[Client] = CreateDataTimer(1.0, Zm_hurting, pack, TIMER_REPEAT|TIMER_DATA_HNDL_CLOSE);
2131 WritePackCell(pack, Client);
2132 WritePackCell(pack, attacker);
2133 SetEntityRenderColor(Client, 255, 0, 0, 255);
2134 }
2135 return Plugin_Changed;
2136 }
2137 }
2138 }
2139 return Plugin_Continue;
2140}
2141
2142public Action:OnTakeDamageHookEntity(entity, &attacker, &inflictor, &Float:damage, &damagetype)
2143{
2144 if(zm[attacker] == 1)
2145 {
2146 damage = 10.0;
2147 }
2148 else
2149 {
2150 if(roundcheck != 0)
2151 {
2152 return Plugin_Handled;
2153 }
2154 else
2155 {
2156 damage = 5.0;
2157 }
2158 }
2159 if(damage >= GetEntProp(entity, Prop_Data, "m_iHealth"))
2160 {
2161 PrintToServer("Barricade is broken by %N (ClientNum = %d)", attacker, attacker);
2162 AcceptEntityInput(entity, "Kill");
2163 }
2164
2165 return Plugin_Changed;
2166}
2167
2168//
2169//
2170//========================= SQL 구간 =========================
2171//
2172//
2173
2174SQL_CreateTable(Handle:database)
2175{
2176 if(database != INVALID_HANDLE)
2177 {
2178 PrintToServer("NotError");
2179 new String:Query[256];
2180 SQL_TQuery(database, SQL_CheckError, "CREATE TABLE IF NOT EXISTS cz_data_basic(SteamId BIGINT NOT NULL, Name VARCHAR(64) NOT NULL, Level INT, Xp INT, MaxXp INT, Dollar INT, Firstcheck INT, PRIMARY KEY (SteamId)) ENGINE=MyISAM DEFAULT CHARSET=UTF8;", 0, DBPrio_High);
2181 for(new i=0; i<MAXINVEN; i++)
2182 {
2183 Format(Query, 256, "SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'cz_data_basic' AND COLUMN_NAME = 'Item%d'", i);
2184 SQL_TQuery(database, SQL_ItemColumn, Query, i, DBPrio_High);
2185 }
2186 for(new i=0; i<MAXTYPE; i++)
2187 {
2188 Format(Query, 256, "SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'cz_data_basic' AND COLUMN_NAME = 'Using%d'", i);
2189 SQL_TQuery(database, SQL_UsingColumn, Query, i, DBPrio_High);
2190 }
2191 }
2192}
2193
2194public SQL_ItemColumn(Handle:owner, Handle:handle, const String:error[], any:data)
2195{
2196 if(handle == INVALID_HANDLE)
2197 {
2198 PrintToServer("[BOOOOM] Error : %s", error);
2199 }
2200
2201 else if(SQL_GetRowCount(handle) == 0)
2202 {
2203 new String:Query[256];
2204
2205 if(data == 0)
2206 {
2207 Format(Query, 256, "ALTER TABLE cz_data_basic ADD Item%d INT DEFAULT -1 AFTER Firstcheck;", data);
2208 SQL_TQuery(owner, SQL_CheckError, Query, 0, DBPrio_High);
2209 }
2210 else
2211 {
2212 Format(Query, 256, "ALTER TABLE cz_data_basic ADD Item%d INT DEFAULT -1 AFTER Item%d;", data, data-1);
2213 SQL_TQuery(owner, SQL_CheckError, Query, 0, DBPrio_High);
2214 }
2215 }
2216}
2217
2218public SQL_UsingColumn(Handle:owner, Handle:handle, const String:error[], any:data)
2219{
2220 if(handle == INVALID_HANDLE)
2221 {
2222 PrintToServer("[BOOOOM] Error : %s", error);
2223 }
2224
2225 else if(SQL_GetRowCount(handle) == 0)
2226 {
2227 new String:Query[256];
2228
2229 if(data == 0)
2230 {
2231 Format(Query, 256, "ALTER TABLE cz_data_basic ADD Using%d INT DEFAULT -1 AFTER Item%d;", data, MAXINVEN-1);
2232 SQL_TQuery(owner, SQL_CheckError, Query, 0, DBPrio_High);
2233 }
2234 else
2235 {
2236 Format(Query, 256, "ALTER TABLE cz_data_basic ADD Using%d INT DEFAULT -1 AFTER Using%d;", data, data-1);
2237 SQL_TQuery(owner, SQL_CheckError, Query, 0, DBPrio_High);
2238 }
2239 }
2240}
2241
2242public SQL_Connection(Handle:owner, Handle:handle, const String:error[], any:data)
2243{
2244 if(handle == INVALID_HANDLE)
2245 {
2246 PrintToServer("[BOOOOM] Error : %s", error);
2247 }
2248 else
2249 {
2250 DB = handle;
2251
2252 SQL_TQuery(DB, SQL_CheckError, "SET NAMES UTF8;", 0, DBPrio_High);
2253 SQL_TQuery(DB, SQL_CheckTable, "SHOW TABLES LIKE 'cz_data_basic';", 0, DBPrio_High);
2254 }
2255}
2256
2257public SQL_CheckError(Handle:owner, Handle:handle, const String:error[], any:data)
2258{
2259 if(handle == INVALID_HANDLE)
2260 {
2261 PrintToServer("[BOOOOM] Error : %s", error);
2262 }
2263}
2264
2265public SQL_CheckTable(Handle:owner, Handle:handle, const String:error[], any:data)
2266{
2267 if(handle == INVALID_HANDLE)
2268 {
2269 PrintToServer("[BOOOOM] Error : %s", error);
2270 }
2271
2272 if(SQL_GetRowCount(handle) == 0)
2273 {
2274 SQL_CreateTable(DB);
2275 }
2276}
2277
2278SQL_DisconnectFromDB()
2279{
2280 if(DB != INVALID_HANDLE)
2281 {
2282 CloseHandle(DB);
2283 DB = INVALID_HANDLE;
2284 }
2285}
2286
2287SQL_CheckFirstClient(Handle:database, Client, const String:SteamId[])
2288{
2289 if(database != INVALID_HANDLE)
2290 {
2291 decl String:Query[128];
2292
2293 Format(Query, sizeof(Query), "SELECT * FROM cz_data_basic WHERE SteamId = '%s';", SteamId);
2294 SQL_TQuery(database, SQL_CheckClient, Query, Client, DBPrio_High);
2295 }
2296}
2297
2298public SQL_CheckClient(Handle:owner, Handle:handle, const String:error[], any:Client)
2299{
2300 if(handle == INVALID_HANDLE)
2301 {
2302 PrintToServer("[BOOOOM] Error : %s", error);
2303 }
2304
2305 else if(SQL_GetRowCount(handle))
2306 {
2307 SQL_LoadClientData(DB, Client);
2308 }
2309
2310 else if(SQL_GetRowCount(handle) == 0)
2311 {
2312 SQL_CreateClientData(DB, Client);
2313 }
2314}
2315
2316SQL_CreateClientData(Handle:database, Client)
2317{
2318 if(database != INVALID_HANDLE)
2319 {
2320 decl String:Query[256], String:SteamId[26];
2321 GetClientAuthId(Client, AuthId_SteamID64, SteamId, sizeof(SteamId));
2322
2323 Format(Query, sizeof(Query), "INSERT INTO cz_data_basic(SteamId, Name, Level, Xp, MaxXp, Dollar, Firstcheck) VALUES('%s', '%N', 0, 0, 0, 0, 0);", SteamId, Client);
2324 SQL_TQuery(database, SQL_CheckError, Query, Client, DBPrio_High);
2325
2326 for(new i=0; i<MAXINVEN; i++)
2327 {
2328 Format(Query, sizeof(Query), "INSERT INTO cz_data_basic(Item%d) VALUES(-1);", i);
2329 SQL_TQuery(database, SQL_CheckError, Query, Client, DBPrio_High);
2330 }
2331 for(new i=0; i<MAXTYPE; i++)
2332 {
2333 Format(Query, sizeof(Query), "INSERT INTO cz_data_basic(Using%d) VALUES(-1);", i);
2334 SQL_TQuery(database, SQL_CheckError, Query, Client, DBPrio_High);
2335 }
2336 }
2337}
2338
2339SQL_LoadClientData(Handle:database, Client)
2340{
2341 if(database != INVALID_HANDLE)
2342 {
2343 decl String:Query[256], String:SteamId[26];
2344 GetClientAuthId(Client, AuthId_SteamID64, SteamId, sizeof(SteamId));
2345
2346 Format(Query, sizeof(Query), "SELECT * FROM cz_data_basic WHERE SteamId = '%s';", SteamId);
2347
2348 SQL_TQuery(database, SQL_LoadData, Query, Client, DBPrio_High);
2349 }
2350}
2351
2352SQL_SaveClientData(Handle:database, Client)
2353{
2354 if(database != INVALID_HANDLE)
2355 {
2356 decl String:Query[256], String:SteamId[26];
2357 GetClientAuthId(Client, AuthId_SteamID64, SteamId, sizeof(SteamId));
2358
2359 Format(Query, sizeof(Query), "UPDATE cz_data_basic SET Name = '%N', Level = %i, Xp = %i, MaxXp = %i, Dollar = %i, Firstcheck = %i WHERE SteamId = '%s';", Client, Level[Client], Xp[Client], MaxXp[Client], dollar[Client], firstcheck[Client], SteamId);
2360 SQL_TQuery(database, SQL_CheckError, Query, Client, DBPrio_High);
2361
2362 for(new i=0; i<MAXINVEN; i++)
2363 {
2364 Format(Query, sizeof(Query), "UPDATE cz_data_basic SET Item%d = %i WHERE SteamId = '%s';", i, Inventory[Client][i], SteamId);
2365 SQL_TQuery(database, SQL_CheckError, Query, Client, DBPrio_High);
2366 }
2367 for(new i=0; i<MAXTYPE; i++)
2368 {
2369 Format(Query, sizeof(Query), "UPDATE cz_data_basic SET Using%d = %i WHERE SteamId = '%s';", i, UsingItem[Client][i], SteamId);
2370 SQL_TQuery(database, SQL_CheckError, Query, Client, DBPrio_High);
2371 }
2372 }
2373}
2374
2375public SQL_LoadData(Handle:owner, Handle:handle, const String:error[], any:Client)
2376{
2377 if(handle == INVALID_HANDLE)
2378 {
2379 PrintToChat(Client, "\x05[BOOOOM]\x03 Cannot find your data!");
2380 }
2381 else
2382 {
2383 if(SQL_GetRowCount(handle))
2384 {
2385 if(SQL_HasResultSet(handle))
2386 {
2387 decl String:SteamId[26], String:Check[32];
2388 GetClientAuthId(Client, AuthId_SteamID64, SteamId, sizeof(SteamId));
2389
2390 while(SQL_FetchRow(handle))
2391 {
2392 SQL_FetchString(handle, 0, Check, sizeof(Check));
2393
2394 if(StrEqual(SteamId, Check))
2395 {
2396 Level[Client] = SQL_FetchInt(handle, 2);
2397 Xp[Client] = SQL_FetchInt(handle, 3);
2398 MaxXp[Client] = SQL_FetchInt(handle, 4);
2399 dollar[Client] = SQL_FetchInt(handle, 5);
2400 firstcheck[Client] = SQL_FetchInt(handle, 6);
2401 for(new i=0; i<MAXINVEN; i++)
2402 {
2403 Inventory[Client][i] = SQL_FetchInt(handle, i+7);
2404 }
2405 for(new i=0; i<MAXTYPE; i++)
2406 {
2407 UsingItem[Client][i] = SQL_FetchInt(handle, i+7+MAXINVEN);
2408 }
2409 }
2410 }
2411 }
2412 }
2413 }
2414}
2415
2416//
2417//
2418//========================= 간편함수 구간 =========================
2419//
2420//
2421
2422stock GetRandomPlayer(Team)
2423{
2424 new iList[MAXPLAYERS+1];
2425 new iCount;
2426 for (new i = 1; i <= MaxClients; i++)
2427 {
2428 if(IsClientInGame(i))
2429 {
2430 if(IsPlayerAlive(i))
2431 {
2432 if(GetClientTeam(i) == Team || Team == 0)
2433 {
2434 iList[iCount] = i;
2435 iCount++;
2436 }
2437 }
2438 }
2439 }
2440 if(iCount == 0)
2441 {
2442 return -1;
2443 }
2444 else
2445 {
2446 new iRandomIndex = GetRandomInt(0, iCount-1);
2447 return iList[iRandomIndex];
2448 }
2449}
2450
2451stock bool:IsClientConnectedInGame(Client)
2452{
2453 if(IsClientConnected(Client) && IsClientInGame(Client))
2454 return true;
2455 else
2456 return false;
2457}
2458
2459public SetAutoBalance()
2460{
2461 new ab[3];
2462
2463 for(new i=1; i<=MaxClients; i++)
2464 {
2465 if(IsClientConnectedInGame(i) == true)
2466 {
2467 if(GetClientTeam(i) == CS_TEAM_T)
2468 ab[0] += 1;
2469 else if(GetClientTeam(i) == CS_TEAM_CT)
2470 ab[1] += 1;
2471 }
2472 }
2473
2474 if(ab[0] > ab[1])
2475 ab[2] = (ab[0] - ab[1]) / 2;
2476 else
2477 ab[2] = (ab[1] - ab[0]) / 2;
2478
2479 if(ab[0] > ab[1])
2480 {
2481 for(new i=0; i<ab[2]; i++)
2482 {
2483 new random = GetRandomPlayer(CS_TEAM_T);
2484 CS_SwitchTeam(random, CS_TEAM_CT);
2485 }
2486 }
2487 else
2488 {
2489 for(new i=0; i<ab[2]; i++)
2490 {
2491 new random = GetRandomPlayer(CS_TEAM_CT);
2492 CS_SwitchTeam(random, CS_TEAM_T);
2493 }
2494 }
2495}
2496
2497stock FakeDeath(Client, Attacker)
2498{
2499 fakedead[Client] = 1;
2500 new Handle:event = CreateEvent("player_death");
2501 if(event != INVALID_HANDLE)
2502 {
2503 SetEventInt(event, "userid", GetClientUserId(Client));
2504 SetEventInt(event, "attacker", GetClientUserId(Attacker));
2505 FireEvent(event, false);
2506 }
2507}
2508
2509stock Shake(Client, Float:Length, Float:Severity)
2510{
2511 new Handle:View_Message;
2512 View_Message = StartMessageOne("Shake", Client, 1);
2513 BfWriteByte(View_Message, 0);
2514 BfWriteFloat(View_Message, Severity);
2515 BfWriteFloat(View_Message, 10.0);
2516 BfWriteFloat(View_Message, Length);
2517 EndMessage();
2518}
2519
2520stock GetClientAimVector(client, Float:vector[3])
2521{
2522 new Float:eye_position[3], Float:eye_angle[3], Float:end_vector[3];
2523 GetClientEyePosition(client, eye_position);
2524 GetClientEyeAngles(client, eye_angle);
2525 new Handle:trace_handle = TR_TraceRayFilterEx(eye_position, eye_angle, MASK_SOLID, RayType_Infinite, function_filter, client);
2526 if(TR_DidHit(trace_handle))
2527 {
2528 TR_GetEndPosition(end_vector, trace_handle);
2529 vector[0] = end_vector[0];
2530 vector[1] = end_vector[1];
2531 vector[2] = end_vector[2];
2532 }
2533}
2534
2535public bool:function_filter(entity, mask, any:data)
2536{
2537 if(entity != data)
2538 {
2539 return true;
2540 }
2541 return false;
2542}
2543
2544stock bool:IsPlayerZombie(Client)
2545{
2546 if(IsClientConnectedInGame(Client) && IsPlayerAlive(Client) && zm[Client] == 1 && roundcheck == 1)
2547 return true;
2548 else
2549 return false;
2550}
2551
2552stock bool:IsAmmobox(entity)
2553{
2554 if(IsValidEntity(entity))
2555 {
2556 for(new i=1; i<=MaxClients; i++)
2557 {
2558 for(new j=0; j<2; j++)
2559 {
2560 if(entity == AmmoBox[i][0][j])
2561 {
2562 return true;
2563 }
2564 }
2565 }
2566 }
2567 return false;
2568}
2569
2570stock ShowOverlayToAll(const String:overlaypath[])
2571{
2572 for(new i=1; i<=MaxClients; i++)
2573 {
2574 if(IsClientConnectedInGame(i))
2575 {
2576 ClientCommand(i, "r_screenoverlay \"%s\"", overlaypath);
2577 }
2578 }
2579}
2580
2581stock Action:CreateTrail(Client) //니카님 달러샵 함수
2582{
2583 if(UsingItem[Client][0] != -1)
2584 {
2585 decl Float:Clientposition[3];
2586
2587 GetClientAbsOrigin(Client, Clientposition);
2588 Clientposition[2] = Clientposition[2] + 10.0;
2589
2590 new String:positionstring[128], String:colorstring[128];
2591
2592 Format(positionstring, 128, "%f %f %f", Clientposition[0], Clientposition[1], Clientposition[2]);
2593 Format(colorstring, 128, "%d %d %d %d", 255, 255, 255, 255);
2594
2595 beamfollowentity[Client] = CreateEntityByName("env_spritetrail");
2596 DispatchKeyValue(beamfollowentity[Client],"Origin", positionstring);
2597 DispatchKeyValue(beamfollowentity[Client], "lifetime", "2.5");
2598 DispatchKeyValue(beamfollowentity[Client], "startwidth", "16.0");
2599 DispatchKeyValue(beamfollowentity[Client], "endwidth", "8.0");
2600 DispatchKeyValue(beamfollowentity[Client], "spritename", ItemRoute[UsingItem[Client][0]]);
2601 DispatchKeyValue(beamfollowentity[Client], "renderamt", "255");
2602 DispatchKeyValue(beamfollowentity[Client], "rendercolor", colorstring);
2603 DispatchKeyValue(beamfollowentity[Client], "rendermode", "5");
2604 DispatchSpawn(beamfollowentity[Client]);
2605
2606 SetEntPropFloat(beamfollowentity[Client], Prop_Send, "m_flTextureRes", 0.05);
2607 SetEntPropFloat(beamfollowentity[Client], Prop_Data, "m_flSkyboxScale", 1.0);
2608
2609 SetVariantString("!activator");
2610 AcceptEntityInput(beamfollowentity[Client], "SetParent", Client);
2611 }
2612}
2613
2614stock DeleteTrail(Client) //니카님 달러샵 함수
2615{
2616 if(IsValidEntity(beamfollowentity[Client]) && beamfollowentity[Client] != 0)
2617 {
2618 new String:entityclass[128];
2619 GetEdictClassname(beamfollowentity[Client], entityclass, sizeof(entityclass));
2620
2621 if(StrEqual(entityclass, "env_spritetrail"))
2622 {
2623 AcceptEntityInput(beamfollowentity[Client], "Kill");
2624 beamfollowentity[Client] = 0;
2625 }
2626 }
2627}
2628
2629stock Freeze(Client, Float:time)
2630{
2631 if(IsPlayerAlive(Client) == true)
2632 {
2633 SetEntityMoveType(Client, MOVETYPE_NONE);
2634 SetEntityRenderColor(Client, 0, 0, 255, 255);
2635 CreateTimer(time, UnFreeze, Client);
2636 }
2637}
2638
2639public Action:UnFreeze(Handle:timer, any:Client)
2640{
2641 if(IsPlayerAlive(Client) == true)
2642 {
2643 SetEntityMoveType(Client, MOVETYPE_WALK);
2644 SetEntityRenderColor(Client, 255, 255, 255, 255);
2645 }
2646}
2647
2648//damagetype
2649#define DMG_GENERIC 0 // generic damage was done
2650#define DMG_CRUSH (1 << 0) // crushed by falling or moving object.
2651 // NOTE: It's assumed crush damage is occurring as a result of physics collision, so no extra physics force is generated by crush damage.
2652 // DON'T use DMG_CRUSH when damaging entities unless it's the result of a physics collision. You probably want DMG_CLUB instead.
2653#define DMG_BULLET (1 << 1) // shot
2654#define DMG_SLASH (1 << 2) // cut, clawed, stabbed
2655#define DMG_BURN (1 << 3) // heat burned
2656#define DMG_VEHICLE (1 << 4) // hit by a vehicle
2657#define DMG_FALL (1 << 5) // fell too far
2658#define DMG_BLAST (1 << 6) // explosive blast damage
2659#define DMG_CLUB (1 << 7) // crowbar, punch, headbutt
2660#define DMG_SHOCK (1 << 8) // electric shock
2661#define DMG_SONIC (1 << 9) // sound pulse shockwave
2662#define DMG_ENERGYBEAM (1 << 10) // laser or other high energy beam
2663#define DMG_PREVENT_PHYSICS_FORCE (1 << 11) // Prevent a physics force
2664#define DMG_NEVERGIB (1 << 12) // with this bit OR'd in, no damage type will be able to gib victims upon death
2665#define DMG_ALWAYSGIB (1 << 13) // with this bit OR'd in, any damage type can be made to gib victims upon death.
2666#define DMG_DROWN (1 << 14) // Drowning
2667#define DMG_PARALYZE (1 << 15) // slows affected creature down
2668#define DMG_NERVEGAS (1 << 16) // nerve toxins, very bad
2669#define DMG_POISON (1 << 17) // blood poisoning - heals over time like drowning damage
2670#define DMG_RADIATION (1 << 18) // radiation exposure
2671#define DMG_DROWNRECOVER (1 << 19) // drowning recovery
2672#define DMG_ACID (1 << 20) // toxic chemicals or acid burns
2673#define DMG_SLOWBURN (1 << 21) // in an oven
2674#define DMG_REMOVENORAGDOLL (1 << 22) // with this bit OR'd in, no ragdoll will be created, and the target will be quietly removed.
2675 // use this to kill an entity that you've already got a server-side ragdoll for
2676#define DMG_PHYSGUN (1 << 23) // Hit by manipulator. Usually doesn't do any damage.
2677#define DMG_PLASMA (1 << 24) // Shot by Cremator
2678#define DMG_AIRBOAT (1 << 25) // Hit by the airboat's gun
2679#define DMG_DISSOLVE (1 << 26) // Dissolving!
2680#define DMG_BLAST_SURFACE (1 << 27) // A blast on the surface of water that cannot harm things underwater
2681#define DMG_DIRECT (1 << 28)
2682#define DMG_BUCKSHOT (1 << 29) // not quite a bullet. Little, rounder, different.
2683stock bool:makeDamage(Client, target, damage, damagetype, Float:damageradius, const Float:attackposition[3], const String:weaponname[] = ""){
2684
2685 new pointhurt = CreateEntityByName("point_hurt");
2686
2687 if(pointhurt != -1){
2688
2689 //목표가 ìžˆì„ ê²½ìš° 목표 ìž…ë ¥, 목표가 ì—†ì„ ê²½ìš° 범위 ê³µê²©ì„ í•˜ê²Œëœë‹¤
2690 if(target != -1){
2691
2692 decl String:targetname[64];
2693 Format(targetname, 128, "%f%f", GetEngineTime(), GetRandomFloat());
2694 DispatchKeyValue(target,"TargetName", targetname);
2695 DispatchKeyValue(pointhurt,"DamageTarget", targetname);
2696
2697 }else{
2698
2699 DispatchKeyValue(pointhurt,"DamageTarget", "");
2700
2701 }
2702
2703 //í¬ì¸íŠ¸í—ˆíŠ¸ 위치 ì§€ì •
2704 DispatchKeyValueVector(pointhurt, "Origin", attackposition);
2705
2706 //ë°ë¯¸ì§€ ì§€ì •
2707 decl String:number[64];
2708 IntToString(damage, number, 64);
2709 DispatchKeyValue(pointhurt,"Damage", number);
2710
2711 //ë°ë¯¸ì§€íƒ€ìž… ì§€ì •
2712 IntToString(damagetype, number, 64);
2713 DispatchKeyValue(pointhurt,"DamageType", number);
2714
2715 //ë°ë¯¸ì§€ 범위 ì§€ì •
2716 DispatchKeyValueFloat(pointhurt, "DamageRadius", damageradius);
2717
2718 //웨í°ë„¤ìž„ 오버ë¼ì´ë“œ
2719 if(!StrEqual(weaponname, "", false)){
2720
2721 DispatchKeyValue(pointhurt,"classname", weaponname);
2722
2723 }
2724
2725 DispatchSpawn(pointhurt);
2726
2727 if(IsPlayerAlive(Client)){
2728
2729 AcceptEntityInput(pointhurt, "Hurt", Client);
2730
2731 }else{
2732
2733 AcceptEntityInput(pointhurt, "Hurt", 0);
2734
2735 }
2736
2737 AcceptEntityInput(pointhurt, "Kill");
2738
2739 return true;
2740
2741 }else{
2742
2743 return false;
2744
2745 }
2746
2747}