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.
|
Guest Message by DevFuse
Wklejka xs8q8aeqndtp dodana przez patryQ1997, 29.09.2014 15:03
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. 292. 293. 294. 295. 296. 297. 298. 299. 300. 301. 302. 303. 304. 305. 306. 307. 308. 309. 310. 311. 312. 313. 314. 315. 316. 317. 318. 319. 320. 321. 322. 323. 324. 325. 326. 327. 328. 329. 330. 331. 332. 333. 334. 335. 336. 337. 338. 339. 340. 341. 342. 343. 344. 345. 346. 347. 348. 349. 350. 351. 352. 353. 354. 355. 356. 357. 358. 359. 360. 361. 362. 363. 364. 365. 366. 367. 368. 369. 370. 371. 372. 373. 374. 375. 376. 377. 378. 379. 380. 381. 382. 383. 384. 385. 386. 387. 388. 389. 390. 391. 392. 393. 394. 395. 396. 397. 398. 399. 400. 401. 402. 403. 404. 405. 406. 407. 408. 409. 410. 411. 412. 413. 414. 415. 416. 417. 418. 419. 420. 421. 422. 423. 424. 425. 426. 427. 428. 429. 430. 431. 432. 433. 434. 435. 436. 437. 438. 439. 440. 441. 442. 443. 444. 445. 446. 447. 448. 449. 450. 451. 452. 453. 454. 455. 456. 457. 458. 459. 460. 461. 462. 463. 464. 465. 466. 467. 468. 469. 470. 471. 472. 473. 474. 475. 476. 477. 478. 479. 480. 481. 482. 483. 484. 485. 486. 487. 488. 489. 490. 491. 492. 493. 494. 495. 496. 497. 498. 499. 500. 501. 502. 503. 504. 505. 506. 507. 508. 509. 510. 511. 512. 513. 514. 515. 516. 517. 518. 519. 520. 521. 522. 523. 524. 525. 526. 527. 528. 529. 530. 531. 532. 533. 534. 535. 536. 537. 538. 539. 540. 541. 542. 543. 544. 545. 546. 547. 548. 549. 550. 551. 552. 553. 554. 555. 556. 557. 558. 559. 560. 561. 562. 563. 564. 565. 566. 567. 568. 569. 570. 571. 572. 573. 574. 575. 576. 577. 578. 579. 580. 581. 582. 583. 584. 585. 586. 587. 588. 589. 590. 591. 592. 593. 594. 595. 596. 597. 598. 599. 600. 601. 602. 603. 604. 605. 606. 607. 608. 609. 610. 611. 612. 613. 614. 615. 616. 617. 618. 619. 620. 621. 622. 623. 624. 625. 626. 627. 628. 629. 630. 631. 632. 633. 634. 635. 636. 637. 638. 639. 640. 641. 642. 643. 644. 645. 646. 647. 648. 649.
// Required admin access level
#define ADMIN_VOICE ADMIN_CHAT
// Delay before a connected player see the text announce
// Comment this out if you don't want that a "no sound" player can hear admins using +adminvoice
// All other player settings are respected whatever this is commented or not.
#define SUPER_ADMIN_PRIORITY
/* ** END OF EDITABLE ** */
/* Changelog
*
* v1.0.2 (04/19/08)
* -few code corrections
* -updated player spawn detection
* -added HLTV & BOT checks
*
* v1.0.1 (03/31/08)
* -added colored chat
* -added chat command /vm that display voices settings
* -inform new players about /vm command
* -display adminlisten status when toggle_adminlisten command is used
* -added support for amx_show_activity cvar on amx_(un)mute command
*
* v1.0.0 (03/26/08)
* First release
*
*/
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#define VERSION "1.0.2"
#define MAX_PLAYERS 32
#define OFFSET_TEAM 114
new g_iClientSettings[MAX_PLAYERS+1][2]
new bool:g_bPlayerNonSpawnEvent[MAX_PLAYERS+1]
new g_iFwFmClientCommandPost
new bool:g_bAlive[MAX_PLAYERS+1]
new g_iAdminVoice
new bool:g_bAdmin[MAX_PLAYERS+1]
new bool:g_bInterAdminVoice[MAX_PLAYERS+1]
new bool:g_bAdminListen[MAX_PLAYERS+1]
new bool:g_bMuted[MAX_PLAYERS+1]
new g_szClientsIp[MAX_PLAYERS+1][22]
new Array:g_aMutedPlayersIps
new g_iMaxPlayers
new g_msgidSayText
new g_pcvarAlivesHear, g_pcvarDeadsHear
new g_amx_show_activity
public plugin_init()
{
register_plugin("Voices Management", VERSION, "ConnorMcLeod")
register_dictionary("voicesmanagement.txt")
register_dictionary("common.txt")
g_pcvarAlivesHear = register_cvar("vm_alives", "1") // 0:alive teamates , 1:alives , 2:all
g_pcvarDeadsHear = register_cvar("vm_deads", "2") // 0:dead teamates , 1:deads , 2:all
register_forward(FM_Voice_SetClientListening, "Forward_SetClientListening")
register_event("VoiceMask", "Event_VoiceMask", "b")
register_event("TextMsg", "Event_TextMsg_Restart", "a", "2=#Game_will_restart_in")
register_event("ResetHUD", "Event_ResetHUD", "b")
register_event("DeathMsg", "Event_DeathMsg", "a")
register_clcmd("+adminvoice", "AdminCommand_VoiceOn")
register_clcmd("-adminvoice", "AdminCommand_VoiceOff")
register_clcmd("+interadminvoice", "AdminCommand_InterAdminOn")
register_clcmd("-interadminvoice", "AdminCommand_InterAdminOff")
register_clcmd("+adminlisten", "AdminCommand_ListenOn")
register_clcmd("-adminlisten", "AdminCommand_ListenOff")
register_clcmd("toggle_adminlisten", "AdminCommand_ListenToggle")
register_concmd("amx_mute", "AdminCommand_Mute", ADMIN_VOICE, "<name/#userid>")
register_concmd("amx_unmute", "AdminCommand_UnMute", ADMIN_VOICE, "<name/#userid>")
register_clcmd("say /vm", "ClientCommand_SayStatus")
register_clcmd("say_team /vm", "ClientCommand_SayStatus")
register_clcmd("fullupdate", "ClientCommand_fullupdate")
}
public plugin_cfg()
{
server_cmd("sv_alltalk 1;alias sv_alltalk")
server_exec()
g_iMaxPlayers = get_maxplayers()
g_aMutedPlayersIps = ArrayCreate(22)
g_msgidSayText = get_user_msgid("SayText")
g_amx_show_activity = get_cvar_pointer("amx_show_activity")
}
public ClientCommand_SayStatus(id)
{
new iDeads = get_pcvar_num(g_pcvarDeadsHear),
iAlives = get_pcvar_num(g_pcvarAlivesHear)
new szDeadsStatus[18], szAlivesStatus[19]
switch( iAlives )
{
case 0:szAlivesStatus = "VM_ALIVES_TEAMATES"
case 1:szAlivesStatus = "VM_ALIVES"
case 2:szAlivesStatus = "VM_ALL"
}
switch( iDeads )
{
case 0:szDeadsStatus = "VM_DEADS_TEAMATES"
case 1:szDeadsStatus = "VM_DEADS"
case 2:szDeadsStatus = "VM_ALL"
}
col_mess(id, id, "%L", id, "VM_ALIVES_STATUS", id, szAlivesStatus)
}
public ClientCommand_fullupdate(id)
{
g_bPlayerNonSpawnEvent[id] = true
static const szFwFmClientCommandPost[] = "fwFmClientCommandPost"
g_iFwFmClientCommandPost = register_forward(FM_ClientCommand, szFwFmClientCommandPost, 1)
return PLUGIN_CONTINUE
}
public fwFmClientCommandPost(iPlayerId) {
unregister_forward(FM_ClientCommand, g_iFwFmClientCommandPost, 1)
g_bPlayerNonSpawnEvent[iPlayerId] = false
return FMRES_HANDLED
}
public Event_TextMsg_Restart()
{
for(new id=1; id <= g_iMaxPlayers; ++id)
{
if(g_bAlive[id])
{
g_bPlayerNonSpawnEvent[id] = true
}
}
}
public Event_ResetHUD(id)
{
if( !is_user_alive(id) )
{
return
}
if(g_bPlayerNonSpawnEvent[id])
{
g_bPlayerNonSpawnEvent[id] = false
return
}
g_bAlive[id] = true
}
public client_authorized(id)
{
g_bAdmin[id] = bool:(get_user_flags(id) & ADMIN_VOICE)
}
public client_putinserver(id)
{
g_bAlive[id] = false
g_bAdminListen[id] = false
g_bInterAdminVoice[id] = false
if(is_user_bot(id) || is_user_hltv(id))
return
static szIp[22]
get_user_ip(id, szIp, 21)
g_szClientsIp[id] = szIp
static szTempIp[22], iArraySize
iArraySize = ArraySize(g_aMutedPlayersIps)
for(new i; i<iArraySize; i++)
{
ArrayGetString(g_aMutedPlayersIps, i, szTempIp, 21)
if( equal(szIp, szTempIp) )
{
ArrayDeleteItem(g_aMutedPlayersIps, i)
g_bMuted[id] = true
break
}
}
}
public client_disconnect(id)
{
if(g_iAdminVoice == id)
{
g_iAdminVoice = 0
}
if(g_bMuted[id])
{
ArrayPushString(g_aMutedPlayersIps, g_szClientsIp[id])
g_bMuted[id] = false
}
}
public Event_DeathMsg()
{
g_bAlive[read_data(2)] = false
}
public Event_VoiceMask(id)
{
g_iClientSettings[id][0] = read_data(1)
g_iClientSettings[id][1] = read_data(2)
}
public Forward_SetClientListening(iReceiver, iSender, bool:bListen)
{
#if defined SUPER_ADMIN_PRIORITY
if(g_iAdminVoice)
{
if(g_iAdminVoice == iSender)
{
engfunc(EngFunc_SetClientListening, iReceiver, iSender, true)
forward_return(FMV_CELL, true)
return FMRES_SUPERCEDE
}
engfunc(EngFunc_SetClientListening, iReceiver, iSender, false)
forward_return(FMV_CELL, false)
return FMRES_SUPERCEDE
}
if( !g_iClientSettings[iReceiver][0] || g_iClientSettings[iReceiver][1] & (1<<(iSender-1)) )
{
return FMRES_IGNORED
}
#else
if( !g_iClientSettings[iReceiver][0] || g_iClientSettings[iReceiver][1] & (1<<(iSender-1)) )
{
return FMRES_IGNORED
}
if(g_iAdminVoice)
{
if(g_iAdminVoice == iSender)
{
engfunc(EngFunc_SetClientListening, iReceiver, iSender, true)
forward_return(FMV_CELL, true)
return FMRES_SUPERCEDE
}
engfunc(EngFunc_SetClientListening, iReceiver, iSender, false)
forward_return(FMV_CELL, false)
return FMRES_SUPERCEDE
}
#endif
if(g_bMuted[iSender])
{
engfunc(EngFunc_SetClientListening, iReceiver, iSender, false)
forward_return(FMV_CELL, false)
return FMRES_SUPERCEDE
}
if(g_bInterAdminVoice[iSender])
{
if(g_bAdmin[iReceiver])
{
engfunc(EngFunc_SetClientListening, iReceiver, iSender, true)
forward_return(FMV_CELL, true)
return FMRES_SUPERCEDE
}
engfunc(EngFunc_SetClientListening, iReceiver, iSender, false)
forward_return(FMV_CELL, false)
return FMRES_SUPERCEDE
}
if(g_bAdminListen[iReceiver])
{
engfunc(EngFunc_SetClientListening, iReceiver, iSender, true)
forward_return(FMV_CELL, true)
return FMRES_SUPERCEDE
}
if(g_bAlive[iReceiver])
{
switch(get_pcvar_num(g_pcvarAlivesHear))
{
case 0:
{
if( g_bAlive[iSender] && get_pdata_int(iReceiver, OFFSET_TEAM) == get_pdata_int(iSender, OFFSET_TEAM) )
{
engfunc(EngFunc_SetClientListening, iReceiver, iSender, true)
forward_return(FMV_CELL, true)
return FMRES_SUPERCEDE
}
}
case 1:
{
if( g_bAlive[iSender] )
{
engfunc(EngFunc_SetClientListening, iReceiver, iSender, true)
forward_return(FMV_CELL, true)
return FMRES_SUPERCEDE
}
}
case 2:
{
engfunc(EngFunc_SetClientListening, iReceiver, iSender, true)
forward_return(FMV_CELL, true)
return FMRES_SUPERCEDE
}
}
}
else
{
switch(get_pcvar_num(g_pcvarDeadsHear))
{
case 0:
{
if( !g_bAlive[iSender] && get_pdata_int(iReceiver, OFFSET_TEAM) == get_pdata_int(iSender, OFFSET_TEAM) )
{
engfunc(EngFunc_SetClientListening, iReceiver, iSender, true)
forward_return(FMV_CELL, true)
return FMRES_SUPERCEDE
}
}
case 1:
{
if( !g_bAlive[iSender] )
{
engfunc(EngFunc_SetClientListening, iReceiver, iSender, true)
forward_return(FMV_CELL, true)
return FMRES_SUPERCEDE
}
}
case 2:
{
engfunc(EngFunc_SetClientListening, iReceiver, iSender, true)
forward_return(FMV_CELL, true)
return FMRES_SUPERCEDE
}
}
}
engfunc(EngFunc_SetClientListening, iReceiver, iSender, false)
forward_return(FMV_CELL, false)
return FMRES_SUPERCEDE
}
public AdminCommand_ListenOn(id)
{
if( !g_bAdmin[id] )
return PLUGIN_HANDLED
g_bAdminListen[id] = true
return PLUGIN_HANDLED
}
public AdminCommand_ListenOff(id)
{
if( g_bAdminListen[id] )
{
g_bAdminListen[id] = false
}
return PLUGIN_HANDLED
}
public AdminCommand_ListenToggle(id)
{
if( !g_bAdmin[id] )
{
return PLUGIN_HANDLED
}
g_bAdminListen[id] = !g_bAdminListen[id]
col_mess(id, id, "%L", id, "VM_LISTEN_STATUS", g_bAdminListen[id] ? "ON" : "OFF")
return PLUGIN_HANDLED
}
public AdminCommand_VoiceOn(id)
{
if(!g_bAdmin[id])
{
return PLUGIN_HANDLED
}
if(g_iAdminVoice)
{
col_mess(id, id, "%L", id, "VM_ALREADY_INUSE")
return PLUGIN_HANDLED
}
g_iAdminVoice = id
new name[32]
pev(id, pev_netname, name, 31)
for(new player = 1; player <= g_iMaxPlayers; player++)
{
if( is_user_connected(player) && !is_user_hltv(player) && !is_user_bot(player) )
{
col_mess(player, id, "%L", player, "VM_ADMIN_TALK", name)
}
}
client_cmd(id, "+voicerecord")
return PLUGIN_HANDLED
}
public AdminCommand_VoiceOff(id)
{
if( !g_bAdmin[id] )
{
return PLUGIN_HANDLED
}
if(g_iAdminVoice != id)
{
client_cmd(id, "-voicerecord")
return PLUGIN_HANDLED
}
client_cmd(id, "-voicerecord")
g_iAdminVoice = 0
return PLUGIN_HANDLED
}
public AdminCommand_InterAdminOn(id)
{
if( !g_bAdmin[id] )
{
return PLUGIN_HANDLED
}
g_bInterAdminVoice[id] = true
client_cmd(id, "+voicerecord")
new name[32]
get_user_name(id, name, 31)
for(new i=1; i<=g_iMaxPlayers; i++)
{
if( !g_bAdmin[i] || !is_user_connected(i) )
{
continue
}
col_mess(i, id, "%L", i, "VM_INTER_START", name)
}
return PLUGIN_HANDLED
}
public AdminCommand_InterAdminOff(id)
{
if(!g_bInterAdminVoice[id])
return PLUGIN_HANDLED
g_bInterAdminVoice[id] = false
client_cmd(id, "-voicerecord")
new name[32]
get_user_name(id, name, 31)
for(new i=1; i<=g_iMaxPlayers; i++)
{
if( !g_bAdmin[i] || !is_user_connected(i) )
{
continue
}
col_mess(i, id, "%L", i, "VM_INTER_STOP", name)
}
return PLUGIN_HANDLED
}
public AdminCommand_Mute(id, level, cid)
{
if( !cmd_access(id, level, cid, 2, true) )
{
return PLUGIN_HANDLED
}
new szPlayer[32]
read_argv(1, szPlayer, 31)
new iPlayer = cmd_target(id, szPlayer, CMDTARGET_OBEY_IMMUNITY | CMDTARGET_NO_BOTS)
if( !iPlayer )
{
return PLUGIN_HANDLED
}
if( g_bAdmin[iPlayer] )
{
client_print(id, print_console, "%L", id ? id : LANG_SERVER, "VM_MUTE_ADMIN")
return PLUGIN_HANDLED
}
if( g_bMuted[iPlayer] )
{
client_print(id, print_console, "%L", id ? id : LANG_SERVER, "VM_AR_MUTED")
return PLUGIN_HANDLED
}
g_bMuted[iPlayer] = true
client_print(id, print_console, "%L", id ? id : LANG_SERVER, "VM_MUTED")
if(g_amx_show_activity)
{
new name[32], name2[32]
get_user_name(id, name, 31)
get_user_name(iPlayer, name2, 31)
show_activity_col(id, name, name2, "VM_MUTE_ACTIVITY")
}
return PLUGIN_HANDLED
}
public AdminCommand_UnMute(id, level, cid)
{
if( !cmd_access(id, level, cid, 2, true) )
{
return PLUGIN_HANDLED
}
new szPlayer[32], iPlayer
read_argv(1, szPlayer, 31)
iPlayer = cmd_target(id, szPlayer, CMDTARGET_OBEY_IMMUNITY | CMDTARGET_NO_BOTS)
if( !iPlayer )
{
return PLUGIN_HANDLED
}
if( !g_bMuted[iPlayer] )
{
client_print(id, print_console, "%L", id ? id : LANG_SERVER, "VM_NOT_MUTED")
return PLUGIN_HANDLED
}
g_bMuted[iPlayer] = false
client_print(id, print_console, "%L", id ? id : LANG_SERVER, "VM_UNMUTED")
if(g_amx_show_activity)
{
new name[32], name2[32]
get_user_name(id, name, 31)
get_user_name(iPlayer, name2, 31)
show_activity_col(id, name, name2, "VM_UNMUTE_ACTIVITY")
}
return PLUGIN_HANDLED
}
col_mess(id, sender, string[], any:...)
{
static szMessage[128]
szMessage[0] = 0x01
vformat(szMessage[1], 127, string, 4)
replace_all(szMessage, 127, "!n", "^x01")
replace_all(szMessage, 127, "!t", "^x03")
replace_all(szMessage, 127, "!g", "^x04")
message_begin(MSG_ONE_UNRELIABLE, g_msgidSayText, _, id)
write_byte(sender)
write_string(szMessage)
message_end()
}
show_activity_col(id, name[], name2[], ML_KEY[])
{
switch(get_pcvar_num(g_amx_show_activity))
{
case 5: // hide name only to admins, show nothing to normal users
{
for (new i=1; i<=g_iMaxPlayers; i++)
{
if (is_user_connected(i) && !is_user_bot(i) && !is_user_hltv(i))
{
if (is_user_admin(i))
{
col_mess(i, id, " ** !g[VM] !n%L: %L", i, "ADMIN", i, ML_KEY, name2)
}
}
}
}
case 4: // show name only to admins, show nothing to normal users
{
for (new i=1; i<=g_iMaxPlayers; i++)
{
if (is_user_connected(i) && !is_user_bot(i) && !is_user_hltv(i))
{
if (is_user_admin(i))
{
col_mess(i, id, " ** !g[VM] !n%L !t%s!n: %L", i, "ADMIN", name, i, ML_KEY, name2)
}
}
}
}
case 3: // show name only to admins, hide name from normal users
{
for (new i=1; i<=g_iMaxPlayers; i++)
{
if (is_user_connected(i) && !is_user_bot(i) && !is_user_hltv(i))
{
if (is_user_admin(i))
{
col_mess(i, id, " ** !g[VM] !n%L !t%s!n: %L", i, "ADMIN", name, i, ML_KEY, name2)
}
else
{
col_mess(i, id, " ** !g[VM] !n%L: %L", i, "ADMIN", i, ML_KEY, name2)
}
}
}
}
case 2: // show name to all
{
for (new i=1; i<=g_iMaxPlayers; i++)
{
if (is_user_connected(i) && !is_user_bot(i) && !is_user_hltv(i))
{
col_mess(i, id, " ** !g[VM] !n%L !t%s!n: %L", i, "ADMIN", name, i, ML_KEY, name2)
}
}
}
case 1: // hide name to all
{
for (new i=1; i<=g_iMaxPlayers; i++)
{
if (is_user_connected(i) && !is_user_bot(i) && !is_user_hltv(i))
{
col_mess(i, id, " ** !g[VM] !n%L: %L", i, "ADMIN", i, ML_KEY, name2)
}
}
}
}
}
Dodanych wklejek: 15354
Powered By (Pav32) Pastebin © 2011


Dodatki SourceMod


