Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* AMX Mod Plugin
- A3RA - Recording Assistant V2.3
- * Installation *
- Extract .amxx to plugins folder, add plugin to plugins.ini
- Restart server/map change.
- * Client Commands *
- a3_record - Brings up menu of players to record
- a3_stop - Stops recording and leaves recording session
- a3_ac or say /ac - Toggles autocycle of players
- * Server CVARS *
- a3r_revcycle [0|1] - Reverses the way plugin cycles through players (1 reverses)
- a3r_autocycle [1|0] - Sets autocycling on/off. On by default.
- (c) Copyright 2006, Tim Ballantine (Alcedema)
- [email protected] // www.a3-gaming.co.uk // #a3.uk (QN)
- This file is provided as is (no warranties).
- */
- #include <amxmod>
- #include <amxmisc>
- #include <VexdUM>
- new a3r_players[33][3]
- new maxplayers,ontarget
- new g_menuPosition[33]
- new g_menuPlayers[33][32]
- new g_menuPlayersNum[33]
- public plugin_init() {
- register_plugin("a3 record","2.3","A3 Alcedema")
- register_clcmd("a3_record","cmdRecordMenu",0,"- displays record menu")
- register_clcmd("a3_ac","toggleac",0,"")
- register_clcmd("say /ac","toggleac")
- register_clcmd("a3_stop","Recordstop",0,"- stops recording a demo")
- register_menucmd(register_menuid("Record:"),1023,"actionRecordMenu")
- register_clcmd("stop","manualstop")
- register_cvar("a3r_revcycle", "0")
- register_cvar("a3r_autocycle", "1")
- maxplayers = get_maxplayers()
- set_task(0.5, "check_spectated", 45421000, "", 0, "b")
- set_task(1.0, "check_hudmessage", 45421000, "", 0, "b")
- }
- public actionRecordMenu(id,key)
- {
- switch(key){
- case 8: displayRecordMenu(id,++g_menuPosition[id])
- case 9: displayRecordMenu(id,--g_menuPosition[id])
- default:{
- new player = g_menuPlayers[id][g_menuPosition[id] * 8 + key]
- for(new a = 1; a <= maxplayers; ++a)
- {
- if (a3r_players[a][1] == player)
- {
- new line[128], uName[32]
- get_user_name(a,uName,31)
- format (line, 127, "That player is already being recorded by %s", uName)
- set_hudmessage(200, 100, 0, -1.0,0.12, 0,6.0, 6.0, 0.1, 0.2, 3)
- show_hudmessage(id, line)
- return PLUGIN_HANDLED
- }
- }
- new authid[32],authid2[32],name[32]
- get_user_authid(player,authid,31)
- get_user_authid(player,authid2,31)
- replace (authid2, 31, "STEAM_0:1:", "STEAM_0_1_")
- replace (authid2, 31, "STEAM_0:0:", "STEAM_0_0_")
- get_user_name(player,name,31)
- new timestamp = get_systime()
- new demoname[32]
- format(demoname, 31, "%s_%d", authid2, timestamp)
- strtolower(demoname)
- log_message("[ A3R ] RECORD for %s", authid)
- client_cmd(id,"record %s", demoname)
- a3r_players[id][0] = 1
- a3r_players[id][1] = player
- new AC[4]
- if (get_cvar_num("a3r_autocycle") == 1)
- {
- a3r_players[id][2] = 1
- format (AC, 3, "On")
- } else {
- a3r_players[id][2] = 0
- format (AC, 3, "Off")
- }
- set_task(3.0,"record_sbstatus",id)
- set_task(5.0,"record_status",id)
- client_print(id,print_chat,"[ A3R ] * Recording %s (%s) to %s.dem *", name, authid, demoname)
- client_cmd(id, "amx_chat ** Recording player %s (%s) **", name, authid)
- }
- }
- return PLUGIN_HANDLED
- }
- public Recordstop(id, type) {
- if(is_user_connected(id))
- {
- if (a3r_players[id][0] == 1)
- {
- set_hudmessage(200, 100, 0, -1.0,0.12, 0,0.0, 6.0, 0.0, 0.0, 3)
- if (type == 1)
- {
- show_hudmessage(id, "Player Left - Recording Halted")
- } else {
- show_hudmessage(id, "Recording Halted")
- }
- client_cmd(id, "stop")
- } else {
- set_hudmessage(200, 100, 0, -1.0,0.12, 0,0.0, 6.0, 0.0, 0.0, 3)
- show_hudmessage(id, "Not Recording")
- }
- }
- a3r_players[id][0] = 0
- a3r_players[id][1] = 0
- a3r_players[id][2] = 0
- return PLUGIN_HANDLED
- }
- public toggleac(id) {
- if(is_user_connected(id)) {
- if(a3r_players[id][0] == 1)
- {
- new authid[32]
- get_user_authid(a3r_players[id][1],authid,31)
- if(a3r_players[id][2] == 1)
- {
- a3r_players[id][2] = 0
- }
- else
- {
- a3r_players[id][2] = 1
- }
- }
- }
- return PLUGIN_HANDLED
- }
- public manualstop(id) {
- if (a3r_players[id][0] == 1) {
- Recordstop(id, 2)
- }
- return PLUGIN_CONTINUE
- }
- displayRecordMenu(id,pos){
- if (pos < 0) return
- get_players(g_menuPlayers[id],g_menuPlayersNum[id])
- new menuBody[512]
- new b = 0
- new i
- new name[32]
- new start = pos * 8
- if (start >= g_menuPlayersNum[id])
- {
- start = pos = g_menuPosition[id] = 0
- }
- new len = format(menuBody,511,"\yRecord:\R%d/%d^n\w^n",pos+1,( g_menuPlayersNum[id] / 8 + ((g_menuPlayersNum[id] % 8) ? 1 : 0 )) )
- new end = start + 8
- new keys = (1<<9)
- if (end > g_menuPlayersNum[id])
- end = g_menuPlayersNum[id]
- for(new a = start; a < end; ++a)
- {
- i = g_menuPlayers[id][a]
- get_user_name(i,name,31)
- if ( i == id ) {
- ++b
- len += format(menuBody[len],511-len,"\d%d. %s^n\w",b,name)
- }
- else
- {
- keys |= (1<<b)
- len += format(menuBody[len],511-len,"%d. %s^n",++b,name)
- }
- }
- if (end != g_menuPlayersNum[id])
- {
- format(menuBody[len],511-len,"^n9. More...^n0. %s", pos ? "Back" : "Exit")
- keys |= (1<<8)
- }
- else format(menuBody[len],511-len,"^n0. %s", pos ? "Back" : "Exit")
- show_menu(id,keys,menuBody)
- }
- //----------------------------------------------------------------------------------------------
- public cmdRecordMenu(id,level,cid)
- {
- displayRecordMenu(id,g_menuPosition[id] = 0)
- return PLUGIN_HANDLED
- }
- //----------------------------------------------------------------------------------------------
- public record_sbstatus(id)
- {
- client_cmd(id, "sb_status")
- client_print(id, print_chat, "[ A3R ] * sb_status completed *")
- return PLUGIN_CONTINUE
- }
- public record_status(id)
- {
- client_cmd(id, "status")
- client_print(id, print_chat, "[ A3R ] * status completed *")
- return PLUGIN_CONTINUE
- }
- public check_spectated()
- {
- if(get_cvar_num("a3r_autocycle") == 0)
- {
- return PLUGIN_CONTINUE
- }
- for(new id = 1 ; id <= maxplayers ; id++)
- {
- if(is_user_connected(id) && a3r_players[id][2] == 1 && !is_user_alive(id))
- {
- if (is_user_alive(a3r_players[id][1])) {
- if(entity_get_int(id, EV_INT_iuser1) != 4)
- {
- entity_set_int(id, EV_INT_iuser1, 4)
- }
- new spectated = entity_get_int(id, EV_INT_iuser2)
- if (!is_user_connected(id))
- {
- Recordstop(id, 1)
- }
- else
- {
- /*
- Problematic.. On publics this will cause your view to skew, the player
- will seem to be looking in only one direction and your POV will warp
- across the map. But this is what will replace the code below, so cycling
- will be a thing of the past.
- if(a3r_players[id][1] != spectated)
- {
- entity_set_int(id, EV_INT_iuser2, a3r_players[id][1])
- set_hudmessage(200, 100, 0, -1.0,0.14, 0,0.0, 1.0, 0.5, 0.5, 2)
- show_hudmessage(id, "On Target")
- }
- */
- if(a3r_players[id][1] != spectated)
- {
- ontarget = 0
- set_hudmessage(200, 100, 0, -1.0,0.14, 0,0.0, 1.0, 0.5, 0.5, 2)
- show_hudmessage(id, "Clycling...")
- if(get_cvar_num("a3r_revcycle") == 0) {
- client_cmd(id,"+attack2;wait;-attack2")
- } else {
- client_cmd(id,"+attack;wait;-attack")
- }
- }
- else
- {
- if (ontarget == 0)
- {
- set_hudmessage(200, 100, 0, -1.0,0.14, 0,0.0, 1.0, 0.5, 0.5, 2)
- show_hudmessage(id, "On Target")
- ontarget = 1
- }
- }
- }
- }
- }
- }
- return PLUGIN_CONTINUE
- }
- public check_hudmessage() {
- for(new a = 1; a <= maxplayers; ++a) {
- if (a3r_players[a][0] == 1) {
- new authid[32], line[128]
- get_user_authid(a3r_players[a][1],authid,31)
- if(a3r_players[a][2] == 1)
- {
- format (line, 127, "Recording %s | AutoCycle: On", authid)
- }
- else
- {
- format (line, 127, "Recording %s | AutoCycle: Off", authid)
- }
- set_hudmessage(200, 100, 0, -1.0,0.12, 0,6.0, 1.0, 0.5, 0.5, 3)
- show_hudmessage(a, line)
- if (!is_user_alive(a3r_players[a][1])) {
- new line2[128]
- format (line2, 127, "User is dead", authid)
- set_hudmessage(200, 100, 0, -1.0,0.14, 0,0.0, 1.0, 0.5, 0.5, 2)
- show_hudmessage(a, line2)
- }
- }
- }
- return PLUGIN_CONTINUE
- }
- public client_disconnect(id){
- for(new a = 1; a <= maxplayers; ++a) {
- if (a3r_players[a][1] == id) {
- Recordstop(a, 1)
- }
- }
- if (a3r_players[id][0] == 1) {
- Recordstop(id, 2)
- }
- return PLUGIN_CONTINUE
- }
- /* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
- *{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang2057\\ f0\\ fs16 \n\\ par }
- */
Advertisement
Add Comment
Please, Sign In to add comment