Kod: Tümünü seç
/*
* AMX Mod plugin
*
* Admin Revive, v0.2 CS
*
* (c) Copyright 2010 - AMX Mod Team
* This file is provided as is (no warranties).
*
*/
/*
* Description:
* This plugin allows an admin with the ADMIN_LEVEL_B flag to make revive
* a specified player, a team or all players.
* In this latest plugin version, the "respawn" function now works without bugs.
*
* Command:
* amx_revive <name|#userid|authid|@TEAM|*(all)> - makes revive
*
* Requirements:
* AMX Mod 2010.1 or higher to compile or correctly run this plugin on your server.
* Counter-Strike or Condition Zero.
*
* Setup:
* Extract the content of this .zip archive on your computer, then upload the "addons" folder
* in your moddir (folder of your game). The non-existent files will be automatically added.
* Add the plugin name in your plugins.ini file (or in another plugins file).
*
* Configuration:
* You can enable if you want, the AMX logs registered in the AMX log folder.
* To do that, just uncomment the #define USE_LOGS below, save the file, then recompile
* it and replace the new .amx file in your plugins folder.
* For information, this plugin can work with the colored admin activity feature, to enable this
* thing, make sure your #define COLORED_ACTIVITY has been uncommented (amx/examples/include/amxconst.inc)
* then recompile the plugin and replace the new .amx file on your server.
* You can also modify the admin flag required for the command (see below) or use the
* "amx_changecmdaccess" command (put it with the parameters in your amx.cfg for example).
*
* Credit:
* SniperBeamer for made the original plugin.
*
* Changelog:
* 0.2 CS o improved version for CS or CZ only (by the AMX Mod Team)
* - changed system feature of the plugin
* - fixed respawn bugs
* - added supreme admin support
* - added colored admin activity support
* - added #define USE_LOGS to enable/disable AMX logging
* - added "*" argument to the command (to make the action to all players)
* - added plugin auto lock (if the game mod running is not CS or CZ)
* - improved and cleaning up for all codes
* - added multilingual support
* 0.1 o original version
*
*/
/******************************************************************************/
// If you change one of the following settings, do not forget to recompile
// the plugin and to install the new .amx file on your server.
// You can find the list of admin flags in the amx/examples/include/amxconst.inc file.
#define FLAG_AMX_REVIVE ADMIN_LEVEL_B
// Uncomment the following line to enable the AMX logs for this plugin.
//#define USE_LOGS
// Interval delay between command and respawn task done to the specified player(s).
const Float:TASKID_INTERVAL_RevivePlayer = 0.3
/******************************************************************************/
#include <translator>
#include <amxmod>
#include <amxmisc>
#include <cstrike>
#include <fun>
const TASKID_RevivePlayer = 73212
new bool:g_bConnected[33]
public plugin_init() {
load_translations("admin_revive")
if((is_running("cstrike") || is_running("czero")) == false) {
register_plugin(_T("Admin Revive - Auto-Locked"), "0.2 CS", "AMX Mod Team")
log_amx(_T("Admin Revive: Plugin paused and locked (Counter-Strike or Condition Zero not running)."))
pause("ae")
return
}
register_plugin(_T("Admin Revive"), "0.2 CS", "AMX Mod Team")
register_concmd("amx_revive", "cmdRevive", FLAG_AMX_REVIVE, _T("<name|#userid|authid|@TEAM|*(all)> - makes revive"))
}
public client_putinserver(id) {
g_bConnected[id] = true
}
public client_disconnect(id) {
g_bConnected[id] = false
}
public cmdRevive(id, iLevel, iCommandId) {
if(!cmd_access(id, iLevel, iCommandId, 2))
return PLUGIN_HANDLED
new szTarget[32], iPlayer
read_argv(1, szTarget, charsmax(szTarget))
new bool:bHasSupreme = bool:(get_user_flags(id) & ADMIN_SUPREME)
new szAdminName[32], szPlayerName[32]
if(id == 0) szAdminName = "SERVER"
else get_user_name(id, szAdminName, charsmax(szAdminName))
if(szTarget[0] == '*') {
new iPlayers[32], iPlayersNum, iBlockedPlayersNum
get_players(iPlayers, iPlayersNum, "bh")
if(iPlayersNum > 0) {
for(new i = 0; i < iPlayersNum; i++) {
iPlayer = iPlayers[i]
if(CS_TEAM_T <= cs_get_user_team(iPlayer) <= CS_TEAM_CT) {
if((iPlayer != id) && (bHasSupreme == false) && (get_user_flags(iPlayer) & ADMIN_IMMUNITY)) {
get_user_name(iPlayer, szPlayerName, charsmax(szPlayerName))
console_print(id, _T("Player ^"%s^" has immunity."), szPlayerName)
iBlockedPlayersNum++
continue
}
entity_set_int(iPlayer, EV_INT_deadflag, DEAD_RESPAWNABLE)
set_task(TASKID_INTERVAL_RevivePlayer, "taskRevivePlayer", iPlayer + TASKID_RevivePlayer)
}
else iBlockedPlayersNum++
}
if(iBlockedPlayersNum == iPlayersNum) {
console_print(id, _T("That action can't be performed on selected players."))
return PLUGIN_HANDLED
}
console_print(id, _T("All players have been resurrected."))
#if !defined COLORED_ACTIVITY
show_activity(id, szAdminName, _T("make revive all players."))
#else
show_activity_color(id, szAdminName, _T("make revive all players."))
#endif
#if defined USE_LOGS
if(id > 0) {
new szAdminAuthID[24], szAdminIPAddress[24]
get_user_authid(id, szAdminAuthID, charsmax(szAdminAuthID))
get_user_ip(id, szAdminIPAddress, charsmax(szAdminIPAddress), 1)
log_amx("Admin Revive: ^"<%s><%d><%s><%s>^" make revive all players.",
szAdminName, get_user_userid(id), szAdminAuthID, szAdminIPAddress)
}
else {
log_amx("Admin Revive: <SERVER> make revive all players.")
}
#endif
}
else {
console_print(id, _T("No dead player on the server."))
}
}
else if(szTarget[0] == '@') {
new iPlayers[32], iPlayersNum, iBlockedPlayersNum
get_players(iPlayers, iPlayersNum, "begh", szTarget[1])
if(iPlayersNum > 0 && (1 <= str_to_num(szTarget[1]) <= 2
|| szTarget[1] == 'T' || szTarget[1] == 't' || szTarget[1] == 'C' || szTarget[1] == 'c')) {
for(new i = 0; i < iPlayersNum; i++) {
iPlayer = iPlayers[i]
if((iPlayer != id) && (bHasSupreme == false) && (get_user_flags(iPlayer) & ADMIN_IMMUNITY)) {
get_user_name(iPlayer, szPlayerName, charsmax(szPlayerName))
console_print(id, _T("Player ^"%s^" has immunity."), szPlayerName)
iBlockedPlayersNum++
continue
}
entity_set_int(iPlayer, EV_INT_deadflag, DEAD_RESPAWNABLE)
set_task(TASKID_INTERVAL_RevivePlayer, "taskRevivePlayer", iPlayer + TASKID_RevivePlayer)
}
if(iBlockedPlayersNum == iPlayersNum) {
console_print(id, _T("That action can't be performed on selected players."))
return PLUGIN_HANDLED
}
new szTeamName[20]
switch(szTarget[1]) {
//case '0', 'u', 'U': copy(szTeamName, charsmax(szTeamName), "UNASSIGNED")
case '1', 't', 'T': copy(szTeamName, charsmax(szTeamName), "TERRORISTS")
case '2', 'c', 'C': copy(szTeamName, charsmax(szTeamName), "CTs")
//case '3', 's', 'S': copy(szTeamName, charsmax(szTeamName), "SPECTATORS")
}
console_print(id, _T("The %s have been resurrected."), _T(szTeamName))
#if !defined COLORED_ACTIVITY
show_activity(id, szAdminName, _T("make revive the %s."), _T(szTeamName))
#else
show_activity_color(id, szAdminName, _T("make revive the %s."), _T(szTeamName))
#endif
#if defined USE_LOGS
if(id > 0) {
new szAdminAuthID[24], szAdminIPAddress[24]
get_user_authid(id, szAdminAuthID, charsmax(szAdminAuthID))
get_user_ip(id, szAdminIPAddress, charsmax(szAdminIPAddress), 1)
log_amx("Admin Revive: ^"<%s><%d><%s><%s>^" make revive the %s.",
szAdminName, get_user_userid(id), szAdminAuthID, szAdminIPAddress, szTeamName)
}
else {
log_amx("Admin Revive: <SERVER> make revive the %s.", szTeamName)
}
#endif
}
else {
console_print(id, _T("No dead player in this team."))
}
}
else {
iPlayer = cmd_target(id, szTarget, 3)
if(!iPlayer)
return PLUGIN_HANDLED
get_user_name(iPlayer, szPlayerName, charsmax(szPlayerName))
if(!is_user_alive(iPlayer) && (CS_TEAM_T <= cs_get_user_team(iPlayer) <= CS_TEAM_CT)) {
entity_set_int(iPlayer, EV_INT_deadflag, DEAD_RESPAWNABLE)
set_task(TASKID_INTERVAL_RevivePlayer, "taskRevivePlayer", iPlayer + TASKID_RevivePlayer)
console_print(id, _T("Player ^"%s^" resurrected."), szPlayerName)
#if !defined COLORED_ACTIVITY
show_activity(id, szAdminName, _T("make revive %s."), szPlayerName)
#else
show_activity_color(id, szAdminName, _T("make revive %s."), szPlayerName)
#endif
#if defined USE_LOGS
new iPlayerUserID, szPlayerAuthID[24], szPlayerIPAddress[24]
iPlayerUserID = get_user_userid(iPlayer)
get_user_authid(iPlayer, szPlayerAuthID, charsmax(szPlayerAuthID))
get_user_ip(iPlayer, szPlayerIPAddress, charsmax(szPlayerIPAddress), 1)
if(id > 0) {
new iAdminUserID, szAdminAuthID[24], szAdminIPAddress[24]
if(iPlayer != id) {
iAdminUserID = get_user_userid(id)
get_user_authid(id, szAdminAuthID, charsmax(szAdminAuthID))
get_user_ip(id, szAdminIPAddress, charsmax(szAdminIPAddress), 1)
}
else {
iAdminUserID = iPlayerUserID
szAdminAuthID = szPlayerAuthID
szAdminIPAddress = szPlayerIPAddress
}
log_amx("Admin Revive: ^"<%s><%d><%s><%s>^" make revive ^"<%s><%d><%s><%s>^".",
szAdminName, iAdminUserID, szAdminAuthID, szAdminIPAddress,
szPlayerName, iPlayerUserID, szPlayerAuthID, szPlayerIPAddress)
}
else {
log_amx("Admin Revive: <SERVER> make revive ^"<%s><%d><%s><%s>^".",
szPlayerName, iPlayerUserID, szPlayerAuthID, szPlayerIPAddress)
}
#endif
}
else {
console_print(id, _T("Player ^"%s^" is not dead or he is spectator."), szPlayerName)
}
}
return PLUGIN_HANDLED
}
public taskRevivePlayer(id) {
id -= TASKID_RevivePlayer
if(g_bConnected[id]) {
user_spawn(id)
if(!has_user_weapon(id, CSW_KNIFE)) {
give_item(id, "weapon_knife")
}
switch(cs_get_user_team(id)) {
/*case CS_TEAM_UNASSIGNED: {
give_item(id, "weapon_m249") // My favorite weapon! To be a Rambo!
cs_set_user_bpammo(id, CSW_M249, 200)
}*/
case CS_TEAM_T: {
give_item(id, "weapon_glock18")
cs_set_user_bpammo(id, CSW_GLOCK18, 40)
}
case CS_TEAM_CT: {
give_item(id, "weapon_usp")
cs_set_user_bpammo(id, CSW_USP, 24)
}
/*case CS_TEAM_SPECTATOR: {
give_item(id, "weapon_deagle")
cs_set_user_bpammo(id, CSW_DEAGLE, 35)
}*/
}
}
}