Initial revision
This commit is contained in:
202
plugins/admin.sma
Executable file
202
plugins/admin.sma
Executable file
@@ -0,0 +1,202 @@
|
||||
/* AMX Mod script.
|
||||
*
|
||||
* (c) 2003, OLO
|
||||
* This file is provided as is (no warranties).
|
||||
*/
|
||||
|
||||
#include <amxmod>
|
||||
#include <amxmisc>
|
||||
|
||||
#define MAX_ADMINS 64
|
||||
|
||||
new g_aPassword[MAX_ADMINS][32]
|
||||
new g_aName[MAX_ADMINS][32]
|
||||
new g_aFlags[MAX_ADMINS]
|
||||
new g_aAccess[MAX_ADMINS]
|
||||
new g_aNum
|
||||
new g_logFile[16]
|
||||
#if !defined NO_STEAM
|
||||
new g_cmdLoopback[16]
|
||||
#endif
|
||||
|
||||
public plugin_init()
|
||||
{
|
||||
register_plugin("Admin Base","0.9","default")
|
||||
register_cvar("amx_mode","2.0")
|
||||
register_cvar("amx_password_field","_pw")
|
||||
register_cvar("amx_default_access","")
|
||||
|
||||
get_logfile(g_logFile,15)
|
||||
|
||||
#if !defined NO_STEAM
|
||||
format( g_cmdLoopback, 15, "amxauth%c%c%c%c" ,
|
||||
random_num('A','Z') , random_num('A','Z') ,random_num('A','Z'),random_num('A','Z') )
|
||||
|
||||
register_clcmd( g_cmdLoopback, "ackSignal" )
|
||||
#endif
|
||||
|
||||
remove_user_flags(0,read_flags("z")) // Remove 'user' flag from server rights
|
||||
|
||||
new filename[64]
|
||||
get_basedir( filename , 31 )
|
||||
server_cmd("exec %s/amx.cfg" , filename ) // Execute main configuration file
|
||||
format( filename, 63 , "%s/users.ini" , filename )
|
||||
loadSettings( filename ) // Load admins accounts
|
||||
|
||||
}
|
||||
|
||||
loadSettings(szFilename[])
|
||||
{
|
||||
if (!file_exists(szFilename)) return 0
|
||||
|
||||
new szText[256], szFlags[32], szAccess[32]
|
||||
new a, pos = 0
|
||||
|
||||
while ( g_aNum < MAX_ADMINS && read_file(szFilename,pos++,szText,255,a) )
|
||||
{
|
||||
if ( szText[0] == ';' ) continue
|
||||
|
||||
if ( parse(szText, g_aName[ g_aNum ] ,31,
|
||||
g_aPassword[ g_aNum ], 31, szAccess,31,szFlags,31 ) < 2 ) continue
|
||||
|
||||
g_aAccess[ g_aNum ] = read_flags( szAccess )
|
||||
g_aFlags[ g_aNum ] = read_flags( szFlags )
|
||||
++g_aNum
|
||||
}
|
||||
|
||||
return 1
|
||||
}
|
||||
|
||||
getAccess(id,name[],authid[],ip[], password[])
|
||||
{
|
||||
new index = -1
|
||||
new result = 0
|
||||
for(new i = 0; i < g_aNum; ++i) {
|
||||
if (g_aFlags[i] & FLAG_AUTHID) {
|
||||
if (equal(authid,g_aName[i])) {
|
||||
index = i
|
||||
break
|
||||
}
|
||||
}
|
||||
else if (g_aFlags[i] & FLAG_IP) {
|
||||
new c = strlen( g_aName[i] )
|
||||
if ( g_aName[i][ c - 1 ] == '.' ) { /* check if this is not a xxx.xxx. format */
|
||||
if ( equal( g_aName[i] , ip , c ) ) {
|
||||
index = i
|
||||
break
|
||||
}
|
||||
} /* in other case an IP must just match */
|
||||
else if ( equal(ip,g_aName[i]) ){
|
||||
index = i
|
||||
break
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (g_aFlags[i] & FLAG_TAG) {
|
||||
if (contain(name,g_aName[i])!=-1){
|
||||
index = i
|
||||
break
|
||||
}
|
||||
}
|
||||
else if (equal(name,g_aName[i])) {
|
||||
index = i
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
if (index != -1) {
|
||||
if (g_aFlags[index] & FLAG_NOPASS){
|
||||
result |= 8
|
||||
new sflags[32]
|
||||
get_flags(g_aAccess[index],sflags,31)
|
||||
set_user_flags(id,g_aAccess[index])
|
||||
log_to_file(g_logFile,"Login: ^"%s<%d><%s><>^" become an admin (account ^"%s^") (access ^"%s^") (address ^"%s^")",
|
||||
name,get_user_userid(id),authid,g_aName[index] ,sflags,ip)
|
||||
}
|
||||
else if (equal(password,g_aPassword[index])) {
|
||||
result |= 12
|
||||
set_user_flags(id,g_aAccess[index])
|
||||
new sflags[32]
|
||||
get_flags(g_aAccess[index],sflags,31)
|
||||
log_to_file(g_logFile,"Login: ^"%s<%d><%s><>^" become an admin (account ^"%s^") (access ^"%s^") (address ^"%s^")",
|
||||
name,get_user_userid(id),authid,g_aName[index] ,sflags,ip)
|
||||
}
|
||||
else {
|
||||
result |= 1
|
||||
if (g_aFlags[index] & FLAG_KICK){
|
||||
result |= 2
|
||||
log_to_file(g_logFile,"Login: ^"%s<%d><%s><>^" kicked due to invalid password (account ^"%s^") (address ^"%s^")",
|
||||
name,get_user_userid(id),authid,g_aName[index],ip)
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (get_cvar_float("amx_mode")==2.0) {
|
||||
result |= 2
|
||||
}
|
||||
else {
|
||||
new defaccess[32]
|
||||
get_cvar_string("amx_default_access",defaccess,31)
|
||||
new idefaccess = read_flags(defaccess)
|
||||
if (idefaccess){
|
||||
result |= 8
|
||||
set_user_flags(id,idefaccess)
|
||||
}
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
accessUser( id, name[] = "" )
|
||||
{
|
||||
remove_user_flags(id)
|
||||
new userip[32],userauthid[32],password[32],passfield[32],username[32]
|
||||
get_user_ip(id,userip,31,1)
|
||||
get_user_authid(id,userauthid,31)
|
||||
if ( name[0] ) copy( username , 31, name)
|
||||
else get_user_name(id,username,31 )
|
||||
get_cvar_string("amx_password_field",passfield,31)
|
||||
get_user_info(id,passfield,password,31)
|
||||
new result = getAccess(id,username,userauthid,userip,password)
|
||||
if (result & 1) client_cmd(id,"echo ^"* Invalid Password!^"")
|
||||
if (result & 2) {
|
||||
|
||||
#if !defined NO_STEAM
|
||||
client_cmd(id,"echo ^"* You have no entry to the server...^";%s",g_cmdLoopback)
|
||||
|
||||
#else
|
||||
client_cmd(id,"echo ^"* You have no entry to the server...^";disconnect")
|
||||
#endif
|
||||
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
if (result & 4) client_cmd(id,"echo ^"* Password accepted^"")
|
||||
if (result & 8) client_cmd(id,"echo ^"* Privileges set^"")
|
||||
return PLUGIN_CONTINUE
|
||||
}
|
||||
|
||||
public client_infochanged(id)
|
||||
{
|
||||
if ( !is_user_connected(id) || !get_cvar_num("amx_mode") )
|
||||
return PLUGIN_CONTINUE
|
||||
|
||||
new newname[32], oldname[32]
|
||||
get_user_name(id,oldname,31)
|
||||
get_user_info(id,"name",newname,31)
|
||||
|
||||
if ( !equal(newname,oldname) )
|
||||
accessUser( id, newname )
|
||||
|
||||
return PLUGIN_CONTINUE
|
||||
}
|
||||
|
||||
#if !defined NO_STEAM
|
||||
|
||||
public ackSignal(id)
|
||||
server_cmd("kick #%d", get_user_userid(id) )
|
||||
|
||||
public client_authorized(id)
|
||||
#else
|
||||
public client_connect(id)
|
||||
#endif
|
||||
|
||||
return get_cvar_num( "amx_mode" ) ? accessUser( id ) : PLUGIN_CONTINUE
|
234
plugins/admin_mysql.sma
Executable file
234
plugins/admin_mysql.sma
Executable file
@@ -0,0 +1,234 @@
|
||||
/* AMX Mod script.
|
||||
*
|
||||
* (c) 2003, dJeyL
|
||||
* This file is provided as is (no warranties).
|
||||
*
|
||||
* This AMX plugin requires MySQL module.
|
||||
*
|
||||
* For this to work, you might create your MySQL admins table with this SQL query :
|
||||
|
||||
CREATE TABLE admins (
|
||||
auth varchar(32) NOT NULL default '',
|
||||
password varchar(32) NOT NULL default '',
|
||||
access varchar(32) NOT NULL default '',
|
||||
flags varchar(32) NOT NULL default ''
|
||||
) TYPE=MyISAM;
|
||||
|
||||
* IMPORTANT:
|
||||
* o Check $moddir/addons/amx/mysql.cfg for MySQL access configuration
|
||||
* o Disable admin.amx plugin if you use admin_mysql.amx
|
||||
*
|
||||
*/
|
||||
|
||||
#include <amxmod>
|
||||
#include <amxmisc>
|
||||
#include <mysql>
|
||||
|
||||
#define MAX_ADMINS 64
|
||||
|
||||
new g_aPassword[MAX_ADMINS][32]
|
||||
new g_aName[MAX_ADMINS][32]
|
||||
new g_aFlags[MAX_ADMINS]
|
||||
new g_aAccess[MAX_ADMINS]
|
||||
new g_aNum
|
||||
new g_logFile[16]
|
||||
#if !defined NO_STEAM
|
||||
new g_cmdLoopback[16]
|
||||
#endif
|
||||
|
||||
public plugin_init()
|
||||
{
|
||||
register_plugin("Admin Base for MySQL","0.9","default")
|
||||
|
||||
register_cvar("amx_mode","2.0")
|
||||
register_cvar("amx_password_field","_pw")
|
||||
register_cvar("amx_default_access","")
|
||||
register_srvcmd("amx_sqladmins","adminSql")
|
||||
register_cvar("amx_mysql_host","127.0.0.1")
|
||||
register_cvar("amx_mysql_user","root")
|
||||
register_cvar("amx_mysql_pass","")
|
||||
register_cvar("amx_mysql_db","amx")
|
||||
|
||||
#if !defined NO_STEAM
|
||||
format( g_cmdLoopback, 15, "amxauth%c%c%c%c" ,
|
||||
random_num('A','Z') , random_num('A','Z') ,random_num('A','Z'),random_num('A','Z') )
|
||||
register_clcmd( g_cmdLoopback, "ackSignal" )
|
||||
#endif
|
||||
|
||||
|
||||
remove_user_flags(0,read_flags("z")) // remove 'user' flag from server rights
|
||||
|
||||
get_logfile(g_logFile,15)
|
||||
|
||||
new filename[32]
|
||||
get_basedir( filename , 31 )
|
||||
server_cmd("exec %s/amx.cfg" , filename)
|
||||
server_cmd("exec %s/mysql.cfg;amx_sqladmins" , filename)
|
||||
}
|
||||
|
||||
public adminSql(){
|
||||
new host[64],user[32],pass[32],db[32],error[128]
|
||||
get_cvar_string("amx_mysql_host",host,63)
|
||||
get_cvar_string("amx_mysql_user",user,31)
|
||||
get_cvar_string("amx_mysql_pass",pass,31)
|
||||
get_cvar_string("amx_mysql_db",db,31)
|
||||
|
||||
new mysql = mysql_connect(host,user,pass,db,error,127)
|
||||
if(mysql < 1){
|
||||
server_print("MySQL error: can't connect: '%s'",error)
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
|
||||
if(mysql_query(mysql,"SELECT auth,password,access,flags FROM admins") < 1) {
|
||||
mysql_error(mysql,error,127)
|
||||
server_print("MySQL error: can't load admins: '%s'",error)
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
|
||||
new szFlags[32], szAccess[32]
|
||||
g_aNum = 0 /* reset admins settings */
|
||||
while( mysql_nextrow(mysql) > 0 )
|
||||
{
|
||||
mysql_getfield(mysql, 1, g_aName[ g_aNum ] ,31)
|
||||
mysql_getfield(mysql, 2, g_aPassword[ g_aNum ] ,31)
|
||||
mysql_getfield(mysql, 3, szAccess,31)
|
||||
mysql_getfield(mysql, 4, szFlags,31)
|
||||
g_aAccess[ g_aNum ] = read_flags( szAccess )
|
||||
g_aFlags[ g_aNum ] = read_flags( szFlags )
|
||||
++g_aNum
|
||||
}
|
||||
|
||||
server_print("Loaded %d admin%s from database",g_aNum, (g_aNum == 1) ? "" : "s" )
|
||||
mysql_close(mysql)
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
|
||||
getAccess(id,name[],authid[],ip[], password[]){
|
||||
new index = -1
|
||||
new result = 0
|
||||
for(new i = 0; i < g_aNum; ++i) {
|
||||
if (g_aFlags[i] & FLAG_AUTHID) {
|
||||
if (equal(authid,g_aName[i])) {
|
||||
index = i
|
||||
break
|
||||
}
|
||||
}
|
||||
else if (g_aFlags[i] & FLAG_IP) {
|
||||
new c = strlen( g_aName[i] )
|
||||
if ( g_aName[i][ c - 1 ] == '.' ) { /* check if this is not a xxx.xxx. format */
|
||||
if ( equal( g_aName[i] , ip , c ) ) {
|
||||
index = i
|
||||
break
|
||||
}
|
||||
} /* in other case an IP must just match */
|
||||
else if ( equal(ip,g_aName[i]) ){
|
||||
index = i
|
||||
break
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (g_aFlags[i] & FLAG_TAG) {
|
||||
if (contain(name,g_aName[i])!=-1){
|
||||
index = i
|
||||
break
|
||||
}
|
||||
}
|
||||
else if (equal(name,g_aName[i])) {
|
||||
index = i
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
if (index != -1) {
|
||||
if (g_aFlags[index] & FLAG_NOPASS){
|
||||
result |= 8
|
||||
new sflags[32]
|
||||
get_flags(g_aAccess[index],sflags,31)
|
||||
set_user_flags(id,g_aAccess[index])
|
||||
log_to_file(g_logFile,"Login: ^"%s<%d><%s><>^" become an admin (account ^"%s^") (access ^"%s^") (address ^"%s^")",
|
||||
name,get_user_userid(id),authid,g_aName[index] ,sflags,ip)
|
||||
}
|
||||
else if (equal(password,g_aPassword[index])) {
|
||||
result |= 12
|
||||
set_user_flags(id,g_aAccess[index])
|
||||
new sflags[32]
|
||||
get_flags(g_aAccess[index],sflags,31)
|
||||
log_to_file(g_logFile,"Login: ^"%s<%d><%s><>^" become an admin (account ^"%s^") (access ^"%s^") (address ^"%s^")",
|
||||
name,get_user_userid(id),authid,g_aName[index] ,sflags,ip)
|
||||
}
|
||||
else {
|
||||
result |= 1
|
||||
if (g_aFlags[index] & FLAG_KICK){
|
||||
result |= 2
|
||||
log_to_file(g_logFile,"Login: ^"%s<%d><%s><>^" kicked due to invalid password (account ^"%s^") (address ^"%s^")",
|
||||
name,get_user_userid(id),authid,g_aName[index],ip)
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (get_cvar_float("amx_mode")==2.0) {
|
||||
result |= 2
|
||||
}
|
||||
else {
|
||||
new defaccess[32]
|
||||
get_cvar_string("amx_default_access",defaccess,31)
|
||||
new idefaccess = read_flags(defaccess)
|
||||
if (idefaccess){
|
||||
result |= 8
|
||||
set_user_flags(id,idefaccess)
|
||||
}
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
accessUser( id, name[]="" )
|
||||
{
|
||||
remove_user_flags(id)
|
||||
new userip[32],userauthid[32],password[32],passfield[32],username[32]
|
||||
get_user_ip(id,userip,31,1)
|
||||
get_user_authid(id,userauthid,31)
|
||||
if ( name[0] ) copy( username , 31, name)
|
||||
else get_user_name(id,username,31 )
|
||||
get_cvar_string("amx_password_field",passfield,31)
|
||||
get_user_info(id,passfield,password,31)
|
||||
new result = getAccess(id,username,userauthid,userip,password)
|
||||
if (result & 1) client_cmd(id,"echo ^"* Invalid Password!^"")
|
||||
if (result & 2) {
|
||||
#if !defined NO_STEAM
|
||||
client_cmd(id,"echo ^"* You have no entry to the server...^";%s",g_cmdLoopback)
|
||||
#else
|
||||
client_cmd(id,"echo ^"* You have no entry to the server...^";disconnect")
|
||||
#endif
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
if (result & 4) client_cmd(id,"echo ^"* Password accepted^"")
|
||||
if (result & 8) client_cmd(id,"echo ^"* Privileges set^"")
|
||||
return PLUGIN_CONTINUE
|
||||
}
|
||||
|
||||
public client_infochanged(id)
|
||||
{
|
||||
if ( !is_user_connected(id) || !get_cvar_num("amx_mode") )
|
||||
return PLUGIN_CONTINUE
|
||||
|
||||
new newname[32], oldname[32]
|
||||
get_user_name(id,oldname,31)
|
||||
get_user_info(id,"name",newname,31)
|
||||
|
||||
if ( !equal(newname,oldname) )
|
||||
accessUser( id , newname )
|
||||
|
||||
return PLUGIN_CONTINUE
|
||||
}
|
||||
|
||||
#if !defined NO_STEAM
|
||||
|
||||
public ackSignal(id)
|
||||
server_cmd("kick #%d", get_user_userid(id) )
|
||||
|
||||
public client_authorized(id)
|
||||
#else
|
||||
public client_connect(id)
|
||||
#endif
|
||||
|
||||
return get_cvar_num( "amx_mode" ) ? accessUser( id ) : PLUGIN_CONTINUE
|
204
plugins/adminchat.sma
Executable file
204
plugins/adminchat.sma
Executable file
@@ -0,0 +1,204 @@
|
||||
/* AMX Mod script.
|
||||
*
|
||||
* (c) 2003, OLO
|
||||
* This file is provided as is (no warranties).
|
||||
*/
|
||||
|
||||
#include <amxmod>
|
||||
#include <amxmisc>
|
||||
|
||||
// Uncomment if you want to display
|
||||
// names with hud messages
|
||||
//#define SHOW_NAMES
|
||||
|
||||
new g_logFile[16]
|
||||
new g_msgChannel
|
||||
|
||||
#define MAX_CLR 7
|
||||
new g_Colors[MAX_CLR][] = {"white","red","green","blue","yellow","magenta","cyan"}
|
||||
new g_Values[MAX_CLR][] = {{255,255,255},{255,0,0},{0,255,0},{0,0,255},{255,255,0},{255,0,255},{0,255,255}}
|
||||
new Float:g_Pos[4][] = {{0.0,0.0},{0.05,0.55},{-1.0,0.2},{-1.0,0.7}}
|
||||
|
||||
public plugin_init(){
|
||||
register_plugin("Admin Chat","0.9","default")
|
||||
register_clcmd("say_team","cmdSayAdmin",0,"@<text> - displays message to admins")
|
||||
register_clcmd("say","cmdSayChat",ADMIN_CHAT,"@[@|@|@][w|r|g|b|y|m|c]<text> - displays hud message")
|
||||
register_concmd("amx_say","cmdSay",ADMIN_CHAT,"<message> - sends message to all players")
|
||||
register_concmd("amx_chat","cmdChat",ADMIN_CHAT,"<message> - sends message to admins")
|
||||
register_concmd("amx_psay","cmdPsay",ADMIN_CHAT,"<name or #userid> <message> - sends private message")
|
||||
register_concmd("amx_tsay","cmdTsay",ADMIN_CHAT,"<color> <message> - sends left side hud message to all players")
|
||||
register_concmd("amx_csay","cmdTsay",ADMIN_CHAT,"<color> <message> - sends center hud message to all players")
|
||||
get_logfile(g_logFile,15)
|
||||
}
|
||||
|
||||
public cmdSayChat(id) {
|
||||
if (!(get_user_flags(id)&ADMIN_CHAT)) return PLUGIN_CONTINUE
|
||||
new said[6], i=0
|
||||
read_argv(1,said,5)
|
||||
while (said[i]=='@')
|
||||
i++
|
||||
if ( !i || i > 3 ) return PLUGIN_CONTINUE
|
||||
new message[192], a = 0
|
||||
read_argv(1,message,191)
|
||||
switch(said[i]){
|
||||
case 'r': a = 1
|
||||
case 'g': a = 2
|
||||
case 'b': a = 3
|
||||
case 'y': a = 4
|
||||
case 'm': a = 5
|
||||
case 'c': a = 6
|
||||
}
|
||||
new name[32], authid[32], userid
|
||||
get_user_authid(id,authid,31)
|
||||
get_user_name(id,name,31)
|
||||
userid = get_user_userid(id)
|
||||
log_to_file(g_logFile,"Chat: ^"%s<%d><%s><>^" tsay ^"%s^"",name,userid,authid,message[i+1])
|
||||
log_message("^"%s<%d><%s><>^" triggered ^"amx_tsay^" (text ^"%s^") (color ^"%s^")",
|
||||
name,userid,authid,message[ i+1 ],g_Colors[a])
|
||||
if (++g_msgChannel>6||g_msgChannel<3)
|
||||
g_msgChannel = 3
|
||||
new Float:verpos = g_Pos[i][1] + float(g_msgChannel) / 35.0
|
||||
set_hudmessage(g_Values[a][0], g_Values[a][1], g_Values[a][2],
|
||||
g_Pos[i][0], verpos , 0, 6.0, 6.0, 0.5, 0.15, g_msgChannel )
|
||||
|
||||
#if defined SHOW_NAMES
|
||||
show_hudmessage(0,"%s : %s",name,message[i+1])
|
||||
client_print(0,print_notify,"%s : %s",name,message[i+1])
|
||||
#else
|
||||
show_hudmessage(0,message[i+1])
|
||||
client_print(0,print_notify,message[i+1])
|
||||
#endif
|
||||
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
|
||||
public cmdSayAdmin(id) {
|
||||
new said[2]
|
||||
read_argv(1,said,1)
|
||||
if (said[0]!='@') return PLUGIN_CONTINUE
|
||||
new message[192], name[32],authid[32], userid
|
||||
new players[32], inum
|
||||
read_argv(1,message,191)
|
||||
get_user_authid(id,authid,31)
|
||||
get_user_name(id,name,31)
|
||||
userid = get_user_userid(id)
|
||||
log_to_file(g_logFile,"Chat: ^"%s<%d><%s><>^" chat ^"%s^"",name,userid,authid,message[1])
|
||||
log_message("^"%s<%d><%s><>^" triggered ^"amx_chat^" (text ^"%s^")",name,userid,authid,message[1])
|
||||
format(message,191,"(ADMINS) %s : %s",name,message[1])
|
||||
get_players(players,inum)
|
||||
for(new i=0; i<inum; ++i){
|
||||
if (players[i] != id && get_user_flags(players[i]) & ADMIN_CHAT)
|
||||
client_print(players[i],print_chat,message)
|
||||
}
|
||||
client_print(id,print_chat,message)
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
|
||||
public cmdChat(id,level,cid){
|
||||
if (!cmd_access(id,level,cid,2))
|
||||
return PLUGIN_HANDLED
|
||||
new message[192], name[32], players[32], inum, authid[32], userid
|
||||
read_args(message,191)
|
||||
remove_quotes(message)
|
||||
get_user_authid(id,authid,31)
|
||||
get_user_name(id,name,31)
|
||||
userid = get_user_userid(id)
|
||||
get_players(players,inum)
|
||||
log_to_file(g_logFile,"Chat: ^"%s<%d><%s><>^" chat ^"%s^"",name,userid,authid,message)
|
||||
log_message("^"%s<%d><%s><>^" triggered ^"amx_chat^" (text ^"%s^")",name,userid,authid,message)
|
||||
format(message,191,"(ADMINS) %s : %s",name,message)
|
||||
console_print(id,message)
|
||||
for(new i = 0; i < inum; ++i){
|
||||
if ( get_user_flags(players[i]) & ADMIN_CHAT )
|
||||
client_print(players[i],print_chat,message)
|
||||
}
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
|
||||
public cmdSay(id,level,cid){
|
||||
if (!cmd_access(id,level,cid,2))
|
||||
return PLUGIN_HANDLED
|
||||
new message[192], name[32],authid[32], userid
|
||||
read_args(message,191)
|
||||
remove_quotes(message)
|
||||
get_user_authid(id,authid,31)
|
||||
get_user_name(id,name,31)
|
||||
userid = get_user_userid(id)
|
||||
client_print(0,print_chat,"(ALL) %s : %s",name,message)
|
||||
console_print(id,"(ALL) %s : %s",name,message)
|
||||
log_to_file(g_logFile,"Chat: ^"%s<%d><%s><>^" say ^"%s^"", name,userid,authid,message)
|
||||
log_message("^"%s<%d><%s><>^" triggered ^"amx_say^" (text ^"%s^")",name,userid,authid,message)
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
|
||||
public cmdPsay(id,level,cid){
|
||||
if (!cmd_access(id,level,cid,3))
|
||||
return PLUGIN_HANDLED
|
||||
new name[32]
|
||||
read_argv(1,name,31)
|
||||
new priv = cmd_target(id,name,0)
|
||||
if (!priv) return PLUGIN_HANDLED
|
||||
new length = strlen(name)+1
|
||||
new message[192], name2[32],authid[32],authid2[32], userid, userid2
|
||||
get_user_authid(id,authid,31)
|
||||
get_user_name(id,name2,31)
|
||||
userid = get_user_userid(id)
|
||||
read_args(message,191)
|
||||
if (message[0]=='"' && message[length]=='"'){// HLSW fix
|
||||
message[0]=message[length]=' '
|
||||
length+=2
|
||||
}
|
||||
remove_quotes(message[length])
|
||||
get_user_name(priv,name,31)
|
||||
if (id&&id!=priv) client_print(id,print_chat,"(%s) %s : %s",name,name2,message[length])
|
||||
client_print(priv,print_chat,"(%s) %s : %s",name,name2,message[length])
|
||||
console_print(id,"(%s) %s : %s",name,name2,message[length])
|
||||
get_user_authid(priv,authid2,31)
|
||||
userid2 = get_user_userid(priv)
|
||||
log_to_file(g_logFile,"Chat: ^"%s<%d><%s><>^" psay ^"%s<%d><%s><>^" ^"%s^"",
|
||||
name2,userid,authid,name,userid2,authid2,message[length])
|
||||
log_message("^"%s<%d><%s><>^" triggered ^"amx_psay^" against ^"%s<%d><%s><>^" (text ^"%s^")",
|
||||
name2,userid,authid,name,userid2,authid2,message[length])
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
|
||||
public cmdTsay(id,level,cid){
|
||||
if (!cmd_access(id,level,cid,3))
|
||||
return PLUGIN_HANDLED
|
||||
new cmd[16],color[12], message[192], name[32], authid[32], userid = 0
|
||||
read_argv(0,cmd,15)
|
||||
new bool:tsay = (tolower(cmd[4]) == 't')
|
||||
read_args(message,191)
|
||||
remove_quotes(message)
|
||||
parse(message,color,11)
|
||||
new found = 0,a = 0
|
||||
for(new i=0;i<MAX_CLR;++i)
|
||||
if (equal(color,g_Colors[i])) {
|
||||
a = i
|
||||
found = 1
|
||||
break
|
||||
}
|
||||
new length = found ? (strlen(color) + 1) : 0
|
||||
if (++g_msgChannel>6||g_msgChannel<3)
|
||||
g_msgChannel = 3
|
||||
new Float:verpos = ( tsay ? 0.55 : 0.1 ) + float(g_msgChannel) / 35.0
|
||||
get_user_authid(id,authid,31)
|
||||
get_user_name(id,name,31)
|
||||
userid = get_user_userid(id)
|
||||
set_hudmessage(g_Values[a][0], g_Values[a][1], g_Values[a][2], tsay ? 0.05 : -1.0, verpos, 0, 6.0, 6.0, 0.5, 0.15, g_msgChannel)
|
||||
|
||||
#if defined SHOW_NAMES
|
||||
show_hudmessage(0,"%s : %s",name,message[length])
|
||||
client_print(0,print_notify,"%s : %s",name,message[length])
|
||||
console_print(id,"%s : %s",name,message[length])
|
||||
#else
|
||||
show_hudmessage(0,message[length])
|
||||
client_print(0,print_notify,message[length])
|
||||
console_print(id,message[length])
|
||||
#endif
|
||||
|
||||
log_to_file(g_logFile,"Chat: ^"%s<%d><%s><>^" %s ^"%s^"",name,userid,authid,cmd[4],message[length])
|
||||
log_message("^"%s<%d><%s><>^" triggered ^"%s^" (text ^"%s^") (color ^"%s^")",
|
||||
name,userid,authid,cmd,message[length],g_Colors[a])
|
||||
return PLUGIN_HANDLED
|
||||
}
|
459
plugins/admincmd.sma
Executable file
459
plugins/admincmd.sma
Executable file
@@ -0,0 +1,459 @@
|
||||
/* AMX Mod script.
|
||||
*
|
||||
* (c) 2003, OLO
|
||||
* This file is provided as is (no warranties).
|
||||
*/
|
||||
|
||||
#include <amxmod>
|
||||
#include <amxmisc>
|
||||
|
||||
#define MAXRCONCVARS 16
|
||||
new g_cvarRcon[ MAXRCONCVARS ][32]
|
||||
new g_cvarRconNum
|
||||
new g_logFile[16]
|
||||
new g_pauseCon
|
||||
new Float:g_pausAble
|
||||
new bool:g_Paused
|
||||
new g_addCvar[] = "amx_cvar add %s"
|
||||
|
||||
public plugin_init(){
|
||||
register_plugin("Admin Commands","0.9","default")
|
||||
register_concmd("amx_kick","cmdKick",ADMIN_KICK,"<name or #userid> [reason]")
|
||||
register_concmd("amx_ban","cmdAddBan",ADMIN_BAN,"<minutes> <authid or ip> [reason]")
|
||||
register_concmd("amx_banid","cmdBan",ADMIN_BAN,"<minutes> <name or #userid> [reason]")
|
||||
register_concmd("amx_banip","cmdBan",ADMIN_BAN,"<minutes> <name or #userid> [reason]")
|
||||
register_concmd("amx_unban","cmdUnban",ADMIN_BAN,"<authid or ip>")
|
||||
register_concmd("amx_slay","cmdSlay",ADMIN_SLAY,"<name or #userid>")
|
||||
register_concmd("amx_slap","cmdSlap",ADMIN_SLAY,"<name or #userid> [power]")
|
||||
register_concmd("amx_leave","cmdLeave",ADMIN_KICK,"<tag> [tag] [tag] [tag]")
|
||||
register_concmd("amx_pause","cmdPause",ADMIN_CVAR,"- pause or unpause the game")
|
||||
register_concmd("amx_who","cmdWho",0,"- displays who is on server")
|
||||
register_concmd("amx_cvar","cmdCvar",ADMIN_CVAR,"<cvar> [value]")
|
||||
register_clcmd("amx_map","cmdMap",ADMIN_MAP,"<mapname>")
|
||||
register_clcmd("pauseAck","cmdLBack")
|
||||
register_clcmd("amx_cfg","cmdCfg",ADMIN_CFG,"<fliename>")
|
||||
register_clcmd("amx_rcon","cmdRcon",ADMIN_RCON,"<command line>")
|
||||
register_cvar("amx_show_activity","2")
|
||||
register_cvar("amx_vote_delay","")
|
||||
register_cvar("amx_vote_time","")
|
||||
register_cvar("amx_vote_answers","")
|
||||
register_cvar("amx_vote_ratio","")
|
||||
register_cvar("amx_show_activity","")
|
||||
get_logfile(g_logFile,15)
|
||||
}
|
||||
|
||||
public plugin_cfg(){
|
||||
// Cvars which can be changed only with rcon access
|
||||
server_cmd( g_addCvar ,"rcon_password")
|
||||
server_cmd( g_addCvar ,"amx_show_activity")
|
||||
server_cmd( g_addCvar ,"amx_mode")
|
||||
server_cmd( g_addCvar ,"amx_password_field")
|
||||
server_cmd( g_addCvar ,"amx_default_access")
|
||||
server_cmd( g_addCvar ,"amx_reserved_slots")
|
||||
server_cmd( g_addCvar ,"amx_reservation")
|
||||
server_cmd( g_addCvar ,"amx_conmotd_file")
|
||||
}
|
||||
|
||||
public cmdKick(id,level,cid){
|
||||
if (!cmd_access(id,level,cid,2))
|
||||
return PLUGIN_HANDLED
|
||||
new arg[32]
|
||||
read_argv(1,arg,31)
|
||||
new player = cmd_target(id,arg,1)
|
||||
if (!player) return PLUGIN_HANDLED
|
||||
new authid[32],authid2[32],name2[32],name[32],userid2, arg2[32]
|
||||
get_user_authid(id,authid,31)
|
||||
get_user_authid(player,authid2,31)
|
||||
get_user_name(player,name2,31)
|
||||
get_user_name(id,name,31)
|
||||
userid2 = get_user_userid(player)
|
||||
read_argv(2,arg2,31)
|
||||
log_to_file(g_logFile,"Kick: ^"%s<%d><%s><>^" kick ^"%s<%d><%s><>^" (reason ^"%s^")",
|
||||
name,get_user_userid(id),authid, name2,userid2,authid2,arg2 )
|
||||
switch(get_cvar_num("amx_show_activity")) {
|
||||
case 2: client_print(0,print_chat,"ADMIN %s: kick %s",name,name2)
|
||||
case 1: client_print(0,print_chat,"ADMIN: kick %s",name2)
|
||||
}
|
||||
server_cmd("kick #%d",userid2)
|
||||
console_print(id,"Client ^"%s^" kicked",name2)
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
|
||||
public cmdUnban(id,level,cid){
|
||||
if (!cmd_access(id,level,cid,2))
|
||||
return PLUGIN_HANDLED
|
||||
new arg[32],authid[32],name[32]
|
||||
read_argv(1,arg,31)
|
||||
if (contain(arg,".")!=-1) {
|
||||
server_cmd("removeip ^"%s^";writeip",arg)
|
||||
console_print(id,"Ip ^"%s^" removed from ban list", arg )
|
||||
}
|
||||
else {
|
||||
server_cmd("removeid ^"%s^";writeid",arg)
|
||||
console_print(id,"Authid ^"%s^" removed from ban list", arg )
|
||||
}
|
||||
get_user_name(id,name,31)
|
||||
switch(get_cvar_num("amx_show_activity")) {
|
||||
case 2: client_print(0,print_chat,"ADMIN %s: unban %s",name,arg)
|
||||
case 1: client_print(0,print_chat,"ADMIN: unban %s",arg)
|
||||
}
|
||||
get_user_authid(id,authid,31)
|
||||
log_to_file(g_logFile,"Cmd: ^"%s<%d><%s><>^" unban ^"%s^"",
|
||||
name,get_user_userid(id),authid, arg )
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
|
||||
public cmdAddBan(id,level,cid){
|
||||
if (!cmd_access(id,level,cid,3))
|
||||
return PLUGIN_HANDLED
|
||||
new arg[32],authid[32],name[32],minutes[32],reason[32]
|
||||
read_argv(1,minutes,31)
|
||||
read_argv(2,arg,31)
|
||||
read_argv(3,reason,31)
|
||||
if (contain(arg,".")!=-1) {
|
||||
server_cmd("addip ^"%s^" ^"%s^";wait;writeip",minutes,arg)
|
||||
console_print(id,"Ip ^"%s^" added to ban list", arg )
|
||||
}
|
||||
else {
|
||||
server_cmd("banid ^"%s^" ^"%s^" kick;wait;writeid",minutes,arg)
|
||||
console_print(id,"Authid ^"%s^" added to ban list", arg )
|
||||
}
|
||||
get_user_name(id,name,31)
|
||||
switch(get_cvar_num("amx_show_activity")) {
|
||||
case 2: client_print(0,print_chat,"ADMIN %s: ban %s",name,arg)
|
||||
case 1: client_print(0,print_chat,"ADMIN: ban %s",arg)
|
||||
}
|
||||
get_user_authid(id,authid,31)
|
||||
log_to_file(g_logFile,"Cmd: ^"%s<%d><%s><>^" ban ^"%s^" (minutes ^"%s^") (reason ^"%s^")",
|
||||
name,get_user_userid(id),authid, arg, minutes, reason )
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
|
||||
public cmdBan(id,level,cid){
|
||||
if (!cmd_access(id,level,cid,3))
|
||||
return PLUGIN_HANDLED
|
||||
new arg[32], cmd[32]
|
||||
read_argv(0,cmd,31)
|
||||
read_argv(2,arg,31)
|
||||
new player = cmd_target(id,arg,9)
|
||||
if (!player) return PLUGIN_HANDLED
|
||||
new minutes[32],authid[32],name2[32],authid2[32],name[32], arg3[32]
|
||||
new userid2 = get_user_userid(player)
|
||||
read_argv(1,minutes,31)
|
||||
get_user_authid(player,authid2,31)
|
||||
get_user_authid(id,authid,31)
|
||||
get_user_name(player,name2,31)
|
||||
get_user_name(id,name,31)
|
||||
read_argv(3,arg3,31)
|
||||
log_to_file(g_logFile,"Ban: ^"%s<%d><%s><>^" ban and kick ^"%s<%d><%s><>^" (minutes ^"%s^") (reason ^"%s^")",
|
||||
name,get_user_userid(id),authid, name2,userid2,authid2,minutes,arg3 )
|
||||
|
||||
if ( equal(cmd[7],"ip") || (!equal(cmd[7],"id") && get_cvar_num("sv_lan")) ){
|
||||
new address[32]
|
||||
get_user_ip(player,address,31,1)
|
||||
server_cmd("addip ^"%s^" ^"%s^";wait;writeip",minutes,address)
|
||||
}
|
||||
else
|
||||
server_cmd("banid ^"%s^" ^"%s^" kick;wait;writeid",minutes,authid2)
|
||||
|
||||
new activity = get_cvar_num("amx_show_activity")
|
||||
if (activity) {
|
||||
new temp[64], temp2[64]
|
||||
if (activity == 1)
|
||||
temp = "ADMIN:"
|
||||
else
|
||||
format(temp,63,"ADMIN %s:",name)
|
||||
if (strtonum(minutes))
|
||||
format(temp2,63,"for %s min.",minutes)
|
||||
else
|
||||
temp2 = "permanently"
|
||||
client_print(0,print_chat,"%s ban %s %s",temp,name2,temp2)
|
||||
}
|
||||
|
||||
console_print(id,"Client ^"%s^" banned",name2)
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
|
||||
public cmdSlay(id,level,cid){
|
||||
if (!cmd_access(id,level,cid,2))
|
||||
return PLUGIN_HANDLED
|
||||
new arg[32]
|
||||
read_argv(1,arg,31)
|
||||
new player = cmd_target(id,arg,5)
|
||||
if (!player) return PLUGIN_HANDLED
|
||||
user_kill(player)
|
||||
new authid[32],name2[32],authid2[32],name[32]
|
||||
get_user_authid(id,authid,31)
|
||||
get_user_name(id,name,31)
|
||||
get_user_authid(player,authid2,31)
|
||||
get_user_name(player,name2,31)
|
||||
log_to_file(g_logFile,"Cmd: ^"%s<%d><%s><>^" slay ^"%s<%d><%s><>^"",
|
||||
name,get_user_userid(id),authid, name2,get_user_userid(player),authid2 )
|
||||
|
||||
switch(get_cvar_num("amx_show_activity")) {
|
||||
case 2: client_print(0,print_chat,"ADMIN %s: slay %s",name,name2)
|
||||
case 1: client_print(0,print_chat,"ADMIN: slay %s",name2)
|
||||
}
|
||||
|
||||
console_print(id,"Client ^"%s^" slayed",name2)
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
|
||||
public cmdSlap(id,level,cid){
|
||||
if (!cmd_access(id,level,cid,2))
|
||||
return PLUGIN_HANDLED
|
||||
new arg[32]
|
||||
read_argv(1,arg,31)
|
||||
new player = cmd_target(id,arg,5)
|
||||
if (!player) return PLUGIN_HANDLED
|
||||
new spower[32],authid[32],name2[32],authid2[32],name[32]
|
||||
read_argv(2,spower,31)
|
||||
new damage = strtonum(spower)
|
||||
user_slap(player,damage)
|
||||
get_user_authid(id,authid,31)
|
||||
get_user_name(id,name,31)
|
||||
get_user_authid(player,authid2,31)
|
||||
get_user_name(player,name2,31)
|
||||
log_to_file(g_logFile,"Cmd: ^"%s<%d><%s><>^" slap with %d damage ^"%s<%d><%s><>^"",
|
||||
name,get_user_userid(id),authid, damage,name2,get_user_userid(player),authid2 )
|
||||
|
||||
switch(get_cvar_num("amx_show_activity")) {
|
||||
case 2: client_print(0,print_chat,"ADMIN %s: slap %s with %d damage",name,name2,damage)
|
||||
case 1: client_print(0,print_chat,"ADMIN: slap %s with %d damage",name2,damage)
|
||||
}
|
||||
|
||||
console_print(id,"Client ^"%s^" slaped with %d damage",name2,damage)
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
|
||||
public chMap(map[])
|
||||
server_cmd("changelevel %s",map)
|
||||
|
||||
public cmdMap(id,level,cid){
|
||||
if (!cmd_access(id,level,cid,2))
|
||||
return PLUGIN_HANDLED
|
||||
new arg[32]
|
||||
new arglen = read_argv(1,arg,31)
|
||||
if ( !is_map_valid(arg) ){
|
||||
console_print(id,"Map with that name not found or map is invalid")
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
new authid[32],name[32]
|
||||
get_user_authid(id,authid,31)
|
||||
get_user_name(id,name,31)
|
||||
switch(get_cvar_num("amx_show_activity")) {
|
||||
case 2: client_print(0,print_chat,"ADMIN %s: changelevel %s",name,arg)
|
||||
case 1: client_print(0,print_chat,"ADMIN: changelevel %s",arg)
|
||||
}
|
||||
log_to_file(g_logFile,"Cmd: ^"%s<%d><%s><>^" changelevel ^"%s^"", name,get_user_userid(id),authid, arg)
|
||||
set_task(1.0,"chMap",0,arg,arglen+1)
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
|
||||
onlyRcon( name[] ) {
|
||||
for(new a = 0; a < g_cvarRconNum; ++a)
|
||||
if ( equal( g_cvarRcon[a] , name) )
|
||||
return 1
|
||||
return 0
|
||||
}
|
||||
|
||||
public cmdCvar(id,level,cid){
|
||||
if (!cmd_access(id,level,cid,2))
|
||||
return PLUGIN_HANDLED
|
||||
new arg[32], arg2[64]
|
||||
read_argv(1,arg,31)
|
||||
read_argv(2,arg2,63)
|
||||
if ( equal(arg,"add") && (get_user_flags(id) & ADMIN_RCON) ) {
|
||||
if ( cvar_exists(arg2) ){
|
||||
if ( g_cvarRconNum < MAXRCONCVARS )
|
||||
copy( g_cvarRcon[ g_cvarRconNum++ ] , 31, arg2 )
|
||||
else
|
||||
console_print(id,"Can't add more cvars for rcon access!")
|
||||
}
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
if (!cvar_exists(arg)){
|
||||
console_print(id,"Unknown cvar: %s",arg)
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
if ( onlyRcon(arg) && !(get_user_flags(id) & ADMIN_RCON)){
|
||||
console_print(id,"You have no access to that cvar")
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
else if (equal(arg,"sv_password") && !(get_user_flags(id) & ADMIN_PASSWORD)){
|
||||
console_print(id,"You have no access to that cvar")
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
if (read_argc() < 3){
|
||||
get_cvar_string(arg,arg2,63)
|
||||
console_print(id,"Cvar ^"%s^" is ^"%s^"",arg,arg2)
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
new authid[32],name[32]
|
||||
get_user_authid(id,authid,31)
|
||||
get_user_name(id,name,31)
|
||||
log_to_file(g_logFile,"Cmd: ^"%s<%d><%s><>^" set cvar (name ^"%s^") (value ^"%s^")",
|
||||
name,get_user_userid(id),authid, arg,arg2)
|
||||
set_cvar_string(arg,arg2)
|
||||
|
||||
new activity = get_cvar_num("amx_show_activity")
|
||||
if (activity) {
|
||||
new temp[64]
|
||||
if (activity == 1)
|
||||
temp = "ADMIN:"
|
||||
else
|
||||
format(temp,63,"ADMIN %s:",name)
|
||||
client_print(0,print_chat,"%s set cvar %s to ^"%s^"",temp,arg,equal(arg,"rcon_password") ? "*** PROTECTED ***" : arg2)
|
||||
}
|
||||
|
||||
console_print(id,"Cvar ^"%s^" changed to ^"%s^"",arg,arg2)
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
|
||||
public cmdCfg(id,level,cid){
|
||||
if (!cmd_access(id,level,cid,2))
|
||||
return PLUGIN_HANDLED
|
||||
new arg[128]
|
||||
read_argv(1,arg,127)
|
||||
if (!file_exists(arg)){
|
||||
console_print(id,"File ^"%s^" not found",arg)
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
new authid[32],name[32]
|
||||
get_user_authid(id,authid,31)
|
||||
get_user_name(id,name,31)
|
||||
log_to_file(g_logFile,"Cmd: ^"%s<%d><%s><>^" execute cfg (file ^"%s^")",
|
||||
name,get_user_userid(id),authid, arg)
|
||||
console_print(id,"Executing file ^"%s^"",arg)
|
||||
server_cmd("exec %s",arg)
|
||||
|
||||
switch(get_cvar_num("amx_show_activity")) {
|
||||
case 2: client_print(0,print_chat,"ADMIN %s: execute config %s",name,arg)
|
||||
case 1: client_print(0,print_chat,"ADMIN: execute config %s",arg)
|
||||
}
|
||||
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
|
||||
public cmdLBack(){
|
||||
set_cvar_float("pausable",g_pausAble)
|
||||
console_print(g_pauseCon,"Server %s", g_Paused ? "unpaused" : "paused")
|
||||
g_Paused = !g_Paused
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
|
||||
public cmdPause(id,level,cid){
|
||||
if (!cmd_access(id,level,cid,1))
|
||||
return PLUGIN_HANDLED
|
||||
new authid[32],name[32],slayer = id
|
||||
get_user_authid(id,authid,31)
|
||||
get_user_name(id,name,31)
|
||||
g_pausAble = get_cvar_float("pausable")
|
||||
if (!slayer) slayer = find_player("h")
|
||||
if (!slayer){
|
||||
console_print(id,"Server was unable to pause the game. Real players on server are needed")
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
set_cvar_float("pausable",1.0)
|
||||
client_cmd(slayer,"pause;pauseAck")
|
||||
log_to_file(g_logFile,"Cmd: ^"%s<%d><%s><>^" %s server",
|
||||
name,get_user_userid(id),authid, g_Paused ? "unpause" : "pause" )
|
||||
console_print(id,"Server proceed %s", g_Paused ? "unpausing" : "pausing")
|
||||
|
||||
switch(get_cvar_num("amx_show_activity")) {
|
||||
case 2: client_print(0,print_chat,"ADMIN %s: %s server",name,g_Paused ? "unpause" : "pause")
|
||||
case 1: client_print(0,print_chat,"ADMIN: %s server",g_Paused ? "unpause" : "pause")
|
||||
}
|
||||
|
||||
g_pauseCon = id
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
|
||||
public cmdRcon(id,level,cid){
|
||||
if (!cmd_access(id,level,cid,2))
|
||||
return PLUGIN_HANDLED
|
||||
new arg[128],authid[32],name[32]
|
||||
read_args(arg,127)
|
||||
get_user_authid(id,authid,31)
|
||||
get_user_name(id,name,31)
|
||||
log_to_file(g_logFile,"Cmd: ^"%s<%d><%s><>^" server console (cmdline ^"%s^")",
|
||||
name,get_user_userid(id),authid, arg)
|
||||
console_print(id,"Commmand line ^"%s^" sent to server console",arg)
|
||||
server_cmd(arg)
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
|
||||
public cmdWho(id,level,cid){
|
||||
new players[32], inum, authid[32],name[32], flags, sflags[32]
|
||||
get_players(players,inum)
|
||||
console_print(id,"^nClients on server:^n # %-16.15s %-12s %-8s %-4.3s %-4.3s %s",
|
||||
"nick","authid","userid","imm","res","access")
|
||||
for(new a = 0; a < inum; ++a) {
|
||||
get_user_authid(players[a],authid,31)
|
||||
get_user_name(players[a],name,31)
|
||||
flags = get_user_flags(players[a])
|
||||
get_flags(flags,sflags,31)
|
||||
console_print(id,"%2d %-16.15s %-12s %-8d %-4.3s %-4.3s %s", players[a],name,authid,
|
||||
get_user_userid(players[a]),(flags&ADMIN_IMMUNITY)?"yes":"no",
|
||||
(flags&ADMIN_RESERVATION)?"yes":"no",sflags)
|
||||
}
|
||||
console_print(id,"Total %d",inum)
|
||||
get_user_authid(id,authid,31)
|
||||
get_user_name(id,name,31)
|
||||
log_to_file(g_logFile,"Cmd: ^"%s<%d><%s><>^" ask for players list",name,get_user_userid(id),authid)
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
|
||||
hasTag(name[],tags[4][32],tagsNum){
|
||||
for(new a=0;a<tagsNum;++a)
|
||||
if (contain(name,tags[a])!=-1)
|
||||
return a
|
||||
return -1
|
||||
}
|
||||
|
||||
public cmdLeave(id,level,cid){
|
||||
if (!cmd_access(id,level,cid,2))
|
||||
return PLUGIN_HANDLED
|
||||
new argnum = read_argc()
|
||||
new ltags[4][32]
|
||||
new ltagsnum = 0
|
||||
for(new a=1;a<5;++a){
|
||||
if (a<argnum)
|
||||
read_argv(a,ltags[ltagsnum++],31)
|
||||
else
|
||||
ltags[ltagsnum++][0] = 0
|
||||
}
|
||||
new nick[32], ires, pnum = get_maxplayers() + 1, count = 0
|
||||
for(new b=1;b<pnum;++b){
|
||||
if (!is_user_connected(b)&&!is_user_connecting(b)) continue
|
||||
get_user_name(b,nick,31)
|
||||
ires = hasTag(nick,ltags,ltagsnum)
|
||||
if (ires!=-1){
|
||||
console_print(id,"Skipping ^"%s^" (matching ^"%s^")",nick,ltags[ires])
|
||||
continue
|
||||
}
|
||||
if (get_user_flags(b)&ADMIN_IMMUNITY){
|
||||
console_print(id,"Skipping ^"%s^" (immunity)",nick)
|
||||
continue
|
||||
}
|
||||
console_print(id,"Kicking ^"%s^"",nick)
|
||||
if (is_user_bot(b))
|
||||
server_cmd("kick #%d",get_user_userid(b))
|
||||
else
|
||||
client_cmd(b,"echo * You have been dropped because admin has left only specified group of clients;disconnect")
|
||||
count++
|
||||
}
|
||||
console_print(id,"Kicked %d clients",count)
|
||||
new authid[32],name[32]
|
||||
get_user_authid(id,authid,31)
|
||||
get_user_name(id,name,31)
|
||||
log_to_file(g_logFile,"Kick: ^"%s<%d><%s><>^" leave some group (tag1 ^"%s^") (tag2 ^"%s^") (tag3 ^"%s^") (tag4 ^"%s^")",
|
||||
name,get_user_userid(id),authid,ltags[0],ltags[1],ltags[2],ltags[3] )
|
||||
|
||||
switch(get_cvar_num("amx_show_activity")) {
|
||||
case 2: client_print(0,print_chat,"ADMIN %s: leave %s %s %s %s",name,ltags[0],ltags[1],ltags[2],ltags[3])
|
||||
case 1: client_print(0,print_chat,"ADMIN: leave %s %s %s %s",ltags[0],ltags[1],ltags[2],ltags[3])
|
||||
}
|
||||
|
||||
return PLUGIN_HANDLED
|
||||
}
|
66
plugins/adminhelp.sma
Executable file
66
plugins/adminhelp.sma
Executable file
@@ -0,0 +1,66 @@
|
||||
/* AMX Mod script.
|
||||
*
|
||||
* (c) 2003, tcquest78
|
||||
* This file is provided as is (no warranties).
|
||||
*
|
||||
* Provides help for admin commands with amx_help command
|
||||
*/
|
||||
|
||||
#include <amxmod>
|
||||
|
||||
#define HELPAMOUNT 10 // Number of commands per page
|
||||
|
||||
new g_typeHelp[] = "Type 'amx_help' in the console to see available commands"
|
||||
new g_timeInfo1[] = "Time Left: %d:%02d min. Next Map: %s"
|
||||
new g_timeInfo2[] = "No Time Limit. Next Map: %s"
|
||||
|
||||
public plugin_init() {
|
||||
register_plugin("Admin Help","0.9","tcquest78")
|
||||
register_concmd("amx_help","cmdHelp",0,"- displays this help")
|
||||
setHelp(0)
|
||||
}
|
||||
|
||||
public client_putinserver(id)
|
||||
setHelp(id)
|
||||
|
||||
public cmdHelp(id,level,cid){
|
||||
new arg1[8],flags = get_user_flags(id)
|
||||
new start = read_argv(1,arg1,7) ? strtonum(arg1) : 1
|
||||
if (--start < 0) start = 0
|
||||
new clcmdsnum = get_concmdsnum(flags,id)
|
||||
if (start >= clcmdsnum) start = clcmdsnum - 1
|
||||
console_print(id,"^n----- AMX Help: Commands -----")
|
||||
new info[128], cmd[32], eflags
|
||||
new end = start + HELPAMOUNT
|
||||
if (end > clcmdsnum) end = clcmdsnum
|
||||
for (new i = start; i < end; i++){
|
||||
get_concmd(i,cmd,31,eflags,info,127,flags,id)
|
||||
console_print(id,"%3d: %s %s",i+1,cmd,info)
|
||||
}
|
||||
console_print(id,"----- Entries %d - %d of %d -----",start+1,end,clcmdsnum)
|
||||
if (end < clcmdsnum)
|
||||
console_print(id,"----- Use 'amx_help %d' for more -----",end+1)
|
||||
else
|
||||
console_print(id,"----- Use 'amx_help 1' for begin -----")
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
|
||||
public dispInfo(id){
|
||||
if (id) client_print(id,print_chat, g_typeHelp )
|
||||
else server_print( g_typeHelp )
|
||||
new nextmap[32]
|
||||
get_cvar_string("amx_nextmap",nextmap,31)
|
||||
if (get_cvar_float("mp_timelimit")){
|
||||
new timeleft = get_timeleft()
|
||||
if (timeleft > 0){
|
||||
if (id) client_print(id,print_chat, g_timeInfo1 , timeleft / 60, timeleft % 60,nextmap)
|
||||
else server_print( g_timeInfo1 , timeleft / 60, timeleft % 60,nextmap)
|
||||
}
|
||||
}
|
||||
else if (id) client_print(id,print_chat, g_timeInfo2 ,nextmap)
|
||||
else server_print( g_timeInfo2 ,nextmap)
|
||||
}
|
||||
|
||||
setHelp(id)
|
||||
set_task(15.0,"dispInfo",id)
|
||||
|
88
plugins/adminslots.sma
Executable file
88
plugins/adminslots.sma
Executable file
@@ -0,0 +1,88 @@
|
||||
/* AMX Mod script.
|
||||
*
|
||||
* (c) 2003, OLO
|
||||
* This file is provided as is (no warranties).
|
||||
*
|
||||
* Kick a player without reservation who tries
|
||||
* to enter to one of the reservered slots set
|
||||
* by amx_reservation cvar.
|
||||
*
|
||||
* Cvar:
|
||||
* amx_reservation <value> - sets amount of reserved slots.
|
||||
*/
|
||||
|
||||
#include <amxmod>
|
||||
#include <amxmisc>
|
||||
|
||||
// Comment if you don't want to hide not used reserved slots
|
||||
#define HIDE_RESERVED_SLOTS
|
||||
|
||||
new g_cmdLoopback[16]
|
||||
|
||||
public plugin_init()
|
||||
{
|
||||
register_plugin("Slots Reservation","0.9.7","default")
|
||||
register_cvar("amx_reservation","1")
|
||||
|
||||
format( g_cmdLoopback, 15, "amxres%c%c%c%c" ,
|
||||
random_num('A','Z') , random_num('A','Z') ,random_num('A','Z'),random_num('A','Z') )
|
||||
|
||||
register_clcmd( g_cmdLoopback, "ackSignal" )
|
||||
}
|
||||
|
||||
#if !defined NO_STEAM
|
||||
|
||||
public ackSignal(id)
|
||||
server_cmd("kick #%d", get_user_userid(id) )
|
||||
|
||||
public client_authorized(id)
|
||||
#else
|
||||
public client_connect(id)
|
||||
#endif
|
||||
{
|
||||
new maxplayers = get_maxplayers( )
|
||||
new players = get_playersnum( 1 )
|
||||
new limit = maxplayers - get_cvar_num( "amx_reservation" )
|
||||
|
||||
if ( (get_user_flags(id) & ADMIN_RESERVATION) || (players <= limit) )
|
||||
{
|
||||
#if defined HIDE_RESERVED_SLOTS
|
||||
setVisibleSlots( players , maxplayers, limit )
|
||||
#endif
|
||||
return PLUGIN_CONTINUE
|
||||
}
|
||||
|
||||
#if !defined NO_STEAM
|
||||
client_cmd(id,"echo ^"Dropped due to slot reservation^";%s" , g_cmdLoopback)
|
||||
#else
|
||||
if ( is_user_bot(id) )
|
||||
server_cmd("kick #%d", get_user_userid(id) )
|
||||
else
|
||||
client_cmd(id,"echo ^"Dropped due to slot reservation^";disconnect")
|
||||
#endif
|
||||
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
|
||||
#if defined HIDE_RESERVED_SLOTS
|
||||
public client_disconnect(id)
|
||||
{
|
||||
new maxplayers = get_maxplayers( )
|
||||
setVisibleSlots( get_playersnum(1) - 1 , maxplayers ,
|
||||
maxplayers - get_cvar_num( "amx_reservation" ) )
|
||||
return PLUGIN_CONTINUE
|
||||
}
|
||||
|
||||
setVisibleSlots( players , maxplayers , limit )
|
||||
{
|
||||
new num = players + 1
|
||||
|
||||
if ( players == maxplayers )
|
||||
num = maxplayers
|
||||
else if ( players < limit )
|
||||
num = limit
|
||||
|
||||
set_cvar_num( "sv_visiblemaxplayers" , num )
|
||||
}
|
||||
#endif
|
||||
|
370
plugins/adminvote.sma
Executable file
370
plugins/adminvote.sma
Executable file
@@ -0,0 +1,370 @@
|
||||
/* AMX Mod script.
|
||||
*
|
||||
* (c) 2003, OLO
|
||||
* This file is provided as is (no warranties).
|
||||
*
|
||||
* I. Vote for changing the level:
|
||||
* amx_votemap < map > [ map ] [ map ] [ map ]
|
||||
*
|
||||
* Examples:
|
||||
* amx_votemap "de_dust"
|
||||
* amx_votemap "de_dust" "de_dust2" "cs_italy"
|
||||
*
|
||||
* II. Vote for kicking the player:
|
||||
* amx_votekick <name or #userid>
|
||||
*
|
||||
* Examples:
|
||||
* amx_votekick "Player"
|
||||
*
|
||||
* III. Vote for banning and kicking the player for 30 minutes:
|
||||
* amx_voteban <name or #userid>
|
||||
*
|
||||
* Examples:
|
||||
* amx_voteban "Player"
|
||||
*
|
||||
* IV. Custom voting:
|
||||
* amx_vote < question > < g_Answer1 > < g_Answer2 >
|
||||
*
|
||||
* Examples:
|
||||
* amx_vote "sv_restart" "5" "0"
|
||||
* amx_vote "mp_timelimit" "20" "45"
|
||||
* amx_vote "are you hungry?" "yes" "no"
|
||||
*
|
||||
*/
|
||||
|
||||
#include <amxmod>
|
||||
#include <amxmisc>
|
||||
|
||||
new g_Answer[128]
|
||||
new g_optionName[4][32]
|
||||
new g_voteCount[4]
|
||||
new g_validMaps
|
||||
new g_yesNoVote
|
||||
new g_logFile[16]
|
||||
new g_cstrikeRunning
|
||||
new g_voteCaller
|
||||
new g_Execute[256]
|
||||
new g_execLen
|
||||
new g_alredyVoting[]= "There is already one voting..."
|
||||
new g_notAllowed[] = "Voting not allowed at this time"
|
||||
new g_votingStarted[] = "Voting has started..."
|
||||
new g_playerTag[] = "PLAYER"
|
||||
new g_adminTag[] = "ADMIN"
|
||||
|
||||
new bool:g_execResult
|
||||
new Float:g_voteRatio
|
||||
|
||||
public plugin_init() {
|
||||
register_plugin("Admin Votes","0.9","default")
|
||||
register_menucmd(register_menuid("Change map to ") ,(1<<0)|(1<<1),"voteCount")
|
||||
register_menucmd(register_menuid("Choose map: ") ,(1<<0)|(1<<1)|(1<<2)|(1<<3),"voteCount")
|
||||
register_menucmd(register_menuid("Kick ") ,(1<<0)|(1<<1),"voteCount")
|
||||
register_menucmd(register_menuid("Ban ") ,(1<<0)|(1<<1),"voteCount")
|
||||
register_menucmd(register_menuid("Vote: ") ,(1<<0)|(1<<1),"voteCount")
|
||||
register_menucmd(register_menuid("The result: ") ,(1<<0)|(1<<1),"actionResult")
|
||||
register_concmd("amx_votemap","cmdVoteMap",ADMIN_VOTE,"<map> [map] [map] [map]")
|
||||
register_concmd("amx_votekick","cmdVoteKickBan",ADMIN_VOTE,"<name or #userid>")
|
||||
register_concmd("amx_voteban","cmdVoteKickBan",ADMIN_VOTE,"<name or #userid>")
|
||||
register_concmd("amx_vote","cmdVote",ADMIN_VOTE,"<question> <answer#1> <answer#2>")
|
||||
register_concmd("amx_cancelvote","cmdCancelVote",ADMIN_VOTE,"- cancels last vote")
|
||||
register_cvar("amx_votekick_ratio","0.40")
|
||||
register_cvar("amx_voteban_ratio","0.40")
|
||||
register_cvar("amx_votemap_ratio","0.40")
|
||||
register_cvar("amx_vote_ratio","0.02")
|
||||
register_cvar("amx_vote_time","10")
|
||||
register_cvar("amx_vote_answers","1")
|
||||
register_cvar("amx_vote_delay","60")
|
||||
register_cvar("amx_last_voting","0")
|
||||
set_cvar_float("amx_last_voting",0.0)
|
||||
register_cvar("amx_show_activity","2")
|
||||
g_cstrikeRunning = is_running("cstrike")
|
||||
get_logfile(g_logFile,15)
|
||||
}
|
||||
|
||||
public cmdCancelVote(id,level,cid){
|
||||
if (!cmd_access(id,level,cid,0))
|
||||
return PLUGIN_HANDLED
|
||||
if ( task_exists( 99889988 , 1 ) ) {
|
||||
new authid[32],name[32]
|
||||
get_user_authid(id,authid,31)
|
||||
get_user_name(id,name,31)
|
||||
log_to_file(g_logFile,"Vote: ^"%s<%d><%s><>^" cancel vote session", name,get_user_userid(id),authid)
|
||||
switch(get_cvar_num("amx_show_activity")) {
|
||||
case 2: client_print(0,print_chat,"%s %s: cancel vote", (get_user_flags(id) & ADMIN_USER) ? g_playerTag : g_adminTag, name)
|
||||
case 1: client_print(0,print_chat,"%s: cancel vote", (get_user_flags(id) & ADMIN_USER) ? g_playerTag : g_adminTag)
|
||||
}
|
||||
console_print(id, "Voting canceled" )
|
||||
client_print(0,print_chat,"Voting canceled")
|
||||
remove_task( 99889988 , 1 )
|
||||
set_cvar_float( "amx_last_voting" , get_gametime() )
|
||||
}
|
||||
else
|
||||
console_print(id, "There is no voting to cancel or the vote session can't be canceled with that command" )
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
|
||||
public delayedExec(cmd[])
|
||||
server_cmd(cmd)
|
||||
|
||||
new g_resultRef[] = "Result refused"
|
||||
new g_resultAcpt[] = "Result accepted"
|
||||
new g_votingFailed[] = "Voting failed"
|
||||
new g_votingSuccess[] = "Voting successful"
|
||||
|
||||
public autoRefuse(){
|
||||
log_to_file(g_logFile,"Vote: %s" , g_resultRef)
|
||||
client_print(0,print_chat,g_resultRef )
|
||||
}
|
||||
|
||||
public actionResult(id,key) {
|
||||
remove_task( 4545454 )
|
||||
switch(key){
|
||||
case 0: {
|
||||
set_task(2.0,"delayedExec",0,g_Execute,g_execLen)
|
||||
log_to_file(g_logFile,"Vote: %s",g_resultAcpt)
|
||||
client_print(0,print_chat,g_resultAcpt )
|
||||
}
|
||||
case 1: autoRefuse()
|
||||
}
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
|
||||
public checkVotes() {
|
||||
new best = 0
|
||||
if ( !g_yesNoVote ) {
|
||||
for(new a = 0; a < 4; ++a)
|
||||
if (g_voteCount[a] > g_voteCount[best])
|
||||
best = a
|
||||
}
|
||||
new votesNum = g_voteCount[0] + g_voteCount[1] + g_voteCount[2] + g_voteCount[3]
|
||||
new iRatio = votesNum ? floatround( g_voteRatio * float( votesNum ) ,floatround_ceil) : 1
|
||||
new iResult = g_voteCount[best]
|
||||
if ( iResult < iRatio ){
|
||||
if (g_yesNoVote)
|
||||
client_print(0,print_chat,"%s (yes ^"%d^") (no ^"%d^") (needed ^"%d^")",g_votingFailed, g_voteCount[0], g_voteCount[1] , iRatio )
|
||||
else
|
||||
client_print(0,print_chat,"%s (got ^"%d^") (needed ^"%d^")",g_votingFailed,iResult , iRatio )
|
||||
log_to_file(g_logFile,"Vote: %s (got ^"%d^") (needed ^"%d^")",g_votingFailed,iResult , iRatio )
|
||||
return PLUGIN_CONTINUE
|
||||
}
|
||||
g_execLen = format(g_Execute,255,g_Answer,g_optionName[best]) + 1
|
||||
if (g_execResult){
|
||||
g_execResult = false
|
||||
if ( is_user_connected(g_voteCaller) ) {
|
||||
new menuBody[512]
|
||||
new len = format(menuBody,511,g_cstrikeRunning ? "\yThe result: \w%s^n^n" : "The result: %s^n^n", g_Execute )
|
||||
len += copy( menuBody[len] ,511 - len, g_cstrikeRunning ? "\yDo you want to continue?^n\w" : "Do you want to continue?^n" )
|
||||
copy( menuBody[len] ,511 - len, "^n1. Yes^n2. No")
|
||||
show_menu( g_voteCaller ,0x03 ,menuBody, 10 )
|
||||
set_task(10.0,"autoRefuse",4545454)
|
||||
}
|
||||
else
|
||||
set_task(2.0,"delayedExec",0,g_Execute,g_execLen)
|
||||
}
|
||||
client_print(0,print_chat,"%s (got ^"%d^") (needed ^"%d^"). The result: %s", g_votingSuccess, iResult , iRatio , g_Execute )
|
||||
log_to_file(g_logFile,"Vote: %s (got ^"%d^") (needed ^"%d^") (result ^"%s^")", g_votingSuccess, iResult , iRatio , g_Execute )
|
||||
return PLUGIN_CONTINUE
|
||||
}
|
||||
|
||||
public voteCount(id,key){
|
||||
if ( get_cvar_num("amx_vote_answers") ) {
|
||||
new name[32]
|
||||
get_user_name(id,name,31)
|
||||
if (g_yesNoVote)
|
||||
client_print(0,print_chat,"%s voted %s",name,key ? "against" : "for" )
|
||||
else
|
||||
client_print(0,print_chat,"%s voted for option #%d",name,key+1)
|
||||
}
|
||||
++g_voteCount[key]
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
|
||||
public cmdVoteMap(id,level,cid) {
|
||||
if (!cmd_access(id,level,cid,2))
|
||||
return PLUGIN_HANDLED
|
||||
new Float:voting = get_cvar_float("amx_last_voting")
|
||||
if (voting > get_gametime()){
|
||||
console_print(id, g_alredyVoting )
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
if (voting && voting + get_cvar_float("amx_vote_delay") > get_gametime()) {
|
||||
console_print(id, g_notAllowed )
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
new argc = read_argc()
|
||||
if (argc > 5) argc = 5
|
||||
g_validMaps = 0
|
||||
g_optionName[0][0] = g_optionName[1][0] = g_optionName[2][0] = g_optionName[3][0] = 0
|
||||
for(new i = 1; i < argc; ++i){
|
||||
read_argv(i,g_optionName[g_validMaps],31)
|
||||
if (is_map_valid(g_optionName[g_validMaps]))
|
||||
g_validMaps++;
|
||||
}
|
||||
if (g_validMaps == 0) {
|
||||
console_print(id,"Given %s not valid",(argc==2)?"map is":"maps are")
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
new menu_msg[256]
|
||||
new keys = 0
|
||||
if (g_validMaps > 1){
|
||||
keys = (1<<9)
|
||||
copy(menu_msg,255,g_cstrikeRunning ? "\yChoose map: \w^n^n" : "Choose map: ^n^n")
|
||||
new temp[128]
|
||||
for(new a = 0; a < g_validMaps; ++a){
|
||||
format(temp,127,"%d. %s^n",a+1,g_optionName[a])
|
||||
add(menu_msg,255,temp)
|
||||
keys |= (1<<a)
|
||||
}
|
||||
add(menu_msg,255,"^n0. None")
|
||||
g_yesNoVote = 0
|
||||
}
|
||||
else{
|
||||
format(menu_msg,255,g_cstrikeRunning ? "\yChange map to %s?\w^n^n1. Yes^n2. No"
|
||||
: "Change map to %s?^n^n1. Yes^n2. No",g_optionName[0])
|
||||
keys = (1<<0)|(1<<1)
|
||||
g_yesNoVote = 1
|
||||
}
|
||||
new authid[32],name[32]
|
||||
get_user_authid(id,authid,31)
|
||||
get_user_name(id,name,31)
|
||||
if (argc==2)
|
||||
log_to_file(g_logFile,"Vote: ^"%s<%d><%s><>^" vote map (map ^"%s^")",
|
||||
name,get_user_userid(id),authid,g_optionName[0])
|
||||
else
|
||||
log_to_file(g_logFile,"Vote: ^"%s<%d><%s><>^" vote maps (map#1 ^"%s^") (map#2 ^"%s^") (map#3 ^"%s^") (map#4 ^"%s^")",
|
||||
name,get_user_userid(id),authid,g_optionName[0],g_optionName[1],g_optionName[2],g_optionName[3])
|
||||
|
||||
switch(get_cvar_num("amx_show_activity")) {
|
||||
case 2: client_print(0,print_chat,"%s %s: vote map(s)",name,
|
||||
(get_user_flags(id) & ADMIN_USER) ? g_playerTag : g_adminTag)
|
||||
case 1: client_print(0,print_chat,"%s: vote map(s)",
|
||||
(get_user_flags(id) & ADMIN_USER) ? g_playerTag : g_adminTag)
|
||||
}
|
||||
|
||||
g_execResult = true
|
||||
new Float:vote_time = get_cvar_float("amx_vote_time") + 2.0
|
||||
set_cvar_float("amx_last_voting", get_gametime() + vote_time )
|
||||
g_voteRatio = get_cvar_float("amx_votemap_ratio")
|
||||
g_Answer = "changelevel %s"
|
||||
show_menu(0,keys,menu_msg,floatround(vote_time))
|
||||
set_task(vote_time,"checkVotes" , 99889988 )
|
||||
g_voteCaller = id
|
||||
console_print(id, g_votingStarted )
|
||||
g_voteCount = { 0,0, 0,0 }
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
|
||||
public cmdVote(id,level,cid) {
|
||||
if (!cmd_access(id,level,cid,4))
|
||||
return PLUGIN_HANDLED
|
||||
new Float:voting = get_cvar_float("amx_last_voting")
|
||||
if (voting > get_gametime()){
|
||||
console_print(id, g_alredyVoting )
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
if (voting && voting + get_cvar_float("amx_vote_delay") > get_gametime()) {
|
||||
console_print(id, g_notAllowed )
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
new quest[48]
|
||||
read_argv(1,quest,47)
|
||||
if ((contain(quest,"sv_password")!=-1)||(contain(quest,"rcon_password")!=-1)||
|
||||
(contain(quest,"kick")!=-1)||(contain(quest,"addip")!=-1)||(contain(quest,"ban")!=-1)){
|
||||
console_print(id,"Voting for that has been forbidden")
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
read_argv(2,g_optionName[0],31)
|
||||
read_argv(3,g_optionName[1],31)
|
||||
|
||||
new authid[32],name[32]
|
||||
get_user_authid(id,authid,31)
|
||||
get_user_name(id,name,31)
|
||||
log_to_file(g_logFile,"Vote: ^"%s<%d><%s><>^" vote custom (question ^"%s^") (option#1 ^"%s^") (option#2 ^"%s^")",
|
||||
name,get_user_userid(id),authid,quest,g_optionName[0],g_optionName[1])
|
||||
|
||||
switch(get_cvar_num("amx_show_activity")) {
|
||||
case 2: client_print(0,print_chat,"%s %s: vote custom",
|
||||
(get_user_flags(id) & ADMIN_USER) ? g_playerTag : g_adminTag,name )
|
||||
case 1: client_print(0,print_chat,"%s: vote custom",
|
||||
(get_user_flags(id) & ADMIN_USER) ? g_playerTag : g_adminTag)
|
||||
}
|
||||
|
||||
new menu_msg[256]
|
||||
new keys = (1<<0)|(1<<1)
|
||||
format(menu_msg,255, g_cstrikeRunning ? "\yVote: %s\w^n^n1. %s^n2. %s"
|
||||
: "Vote: %s^n^n1. %s^n2. %s",quest,g_optionName[0],g_optionName[1])
|
||||
g_execResult = false
|
||||
new Float:vote_time = get_cvar_float("amx_vote_time") + 2.0
|
||||
set_cvar_float("amx_last_voting", get_gametime() + vote_time )
|
||||
g_voteRatio = get_cvar_float("amx_vote_ratio")
|
||||
format(g_Answer,127,"%s - %%s",quest)
|
||||
show_menu(0,keys,menu_msg,floatround(vote_time))
|
||||
set_task(vote_time,"checkVotes" , 99889988 )
|
||||
g_voteCaller = id
|
||||
console_print(id, g_votingStarted )
|
||||
g_voteCount ={ 0,0,0,0}
|
||||
g_yesNoVote = 0
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
|
||||
public cmdVoteKickBan(id,level,cid) {
|
||||
if (!cmd_access(id,level,cid,2))
|
||||
return PLUGIN_HANDLED
|
||||
new Float:voting = get_cvar_float("amx_last_voting")
|
||||
if (voting > get_gametime()){
|
||||
console_print(id, g_alredyVoting )
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
if (voting && voting + get_cvar_float("amx_vote_delay") > get_gametime()) {
|
||||
console_print(id, g_notAllowed )
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
new cmd[32]
|
||||
read_argv(0,cmd,31)
|
||||
new voteban = equal(cmd,"amx_voteban")
|
||||
new arg[32]
|
||||
read_argv(1,arg,31)
|
||||
new player = cmd_target(id,arg,1)
|
||||
if (!player) return PLUGIN_HANDLED
|
||||
if (voteban && is_user_bot(player)) {
|
||||
new imname[32]
|
||||
get_user_name(player,imname,31)
|
||||
console_print(id,"That action can't be performed on bot ^"%s^"",imname)
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
|
||||
new keys = (1<<0)|(1<<1)
|
||||
new menu_msg[256]
|
||||
get_user_name(player,arg,31)
|
||||
format(menu_msg,255,g_cstrikeRunning ? "\y%s %s?\w^n^n1. Yes^n2. No"
|
||||
: "%s %s?^n^n1. Yes^n2. No", voteban ? "Ban" : "Kick", arg)
|
||||
g_yesNoVote = 1
|
||||
if (voteban)
|
||||
get_user_authid(player,g_optionName[0],31)
|
||||
else
|
||||
numtostr(get_user_userid(player),g_optionName[0],31)
|
||||
new authid[32],name[32]
|
||||
get_user_authid(id,authid,31)
|
||||
get_user_name(id,name,31)
|
||||
log_to_file(g_logFile,"Vote: ^"%s<%d><%s><>^" vote %s (target ^"%s^")",
|
||||
name,get_user_userid(id),authid,voteban ? "ban" : "kick",arg)
|
||||
|
||||
switch(get_cvar_num("amx_show_activity")) {
|
||||
case 2: client_print(0,print_chat,"%s %s: vote %s for %s",
|
||||
(get_user_flags(id) & ADMIN_USER) ? g_playerTag : g_adminTag,name,voteban ? "ban" : "kick",arg )
|
||||
case 1: client_print(0,print_chat,"%s: vote %s for %s",
|
||||
(get_user_flags(id) & ADMIN_USER) ? g_playerTag : g_adminTag,voteban ? "ban" : "kick",arg)
|
||||
}
|
||||
|
||||
g_execResult = true
|
||||
new Float:vote_time = get_cvar_float("amx_vote_time") + 2.0
|
||||
set_cvar_float("amx_last_voting", get_gametime() + vote_time )
|
||||
g_voteRatio = get_cvar_float(voteban ? "amx_voteban_ratio" : "amx_votekick_ratio")
|
||||
g_Answer = voteban ? "banid 30.0 %s kick" : "kick #%s"
|
||||
show_menu(0,keys,menu_msg,floatround(vote_time))
|
||||
set_task(vote_time,"checkVotes" , 99889988 )
|
||||
g_voteCaller = id
|
||||
console_print(id, g_votingStarted )
|
||||
g_voteCount = {0,0,0,0}
|
||||
return PLUGIN_HANDLED
|
||||
}
|
41
plugins/antiflood.sma
Executable file
41
plugins/antiflood.sma
Executable file
@@ -0,0 +1,41 @@
|
||||
/* AMX Mod script.
|
||||
*
|
||||
* (c) 2003, OLO
|
||||
* This file is provided as is (no warranties).
|
||||
*
|
||||
* Cvar:
|
||||
* amx_flood_time <time in sec.> - set frequency of chating
|
||||
*/
|
||||
|
||||
#include <amxmod>
|
||||
|
||||
new Float:g_Flooding[33]
|
||||
|
||||
public plugin_init()
|
||||
{
|
||||
register_plugin("Anti Flood","0.9","default")
|
||||
register_clcmd("say","chkFlood")
|
||||
register_clcmd("say_team","chkFlood")
|
||||
register_cvar("amx_flood_time","0.75")
|
||||
}
|
||||
|
||||
public chkFlood(id)
|
||||
{
|
||||
new Float:maxChat = get_cvar_float("amx_flood_time")
|
||||
|
||||
if ( maxChat )
|
||||
{
|
||||
new Float:nexTime = get_gametime()
|
||||
|
||||
if ( g_Flooding[id] > nexTime )
|
||||
{
|
||||
client_print( id , print_notify , "** Stop flooding the server!" )
|
||||
g_Flooding[ id ] = nexTime + maxChat + 3.0
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
|
||||
g_Flooding[id] = nexTime + maxChat
|
||||
}
|
||||
|
||||
return PLUGIN_CONTINUE
|
||||
}
|
373
plugins/cmdmenu.sma
Executable file
373
plugins/cmdmenu.sma
Executable file
@@ -0,0 +1,373 @@
|
||||
/* AMX Mod script.
|
||||
*
|
||||
* (c) 2003, OLO
|
||||
* This file is provided as is (no warranties).
|
||||
*
|
||||
*/
|
||||
|
||||
#include <amxmod>
|
||||
#include <amxmisc>
|
||||
|
||||
/* Commands Menus */
|
||||
|
||||
#define MAX_CMDS_LAYERS 3
|
||||
|
||||
new g_cmdMenuName[ MAX_CMDS_LAYERS ][ ] = {
|
||||
"Commands Menu",
|
||||
"Configs Menu",
|
||||
"Speech Menu"
|
||||
}
|
||||
|
||||
new g_cmdMenuCmd[ MAX_CMDS_LAYERS ][ ] = {
|
||||
"amx_cmdmenu",
|
||||
"amx_cfgmenu",
|
||||
"amx_speechmenu"
|
||||
}
|
||||
|
||||
new g_cmdMenuCfg[ MAX_CMDS_LAYERS ][ ] = {
|
||||
"cmds.ini",
|
||||
"configs.ini",
|
||||
"speech.ini"
|
||||
}
|
||||
|
||||
new g_cmdMenuHelp[ MAX_CMDS_LAYERS ][ ] = {
|
||||
"- displays commands menu",
|
||||
"- displays configs menu",
|
||||
"- displays speech menu"
|
||||
}
|
||||
|
||||
/* End of Commands Menu */
|
||||
|
||||
#define MAX_CMDS 32
|
||||
#define MAX_CVARS 32
|
||||
|
||||
new g_cmdName[MAX_CMDS*MAX_CMDS_LAYERS][32]
|
||||
new g_cmdCmd[MAX_CMDS*MAX_CMDS_LAYERS][64]
|
||||
new g_cmdMisc[MAX_CMDS*MAX_CMDS_LAYERS][2]
|
||||
new g_cmdNum[MAX_CMDS_LAYERS]
|
||||
|
||||
new g_cvarNames[MAX_CVARS][32]
|
||||
new g_cvarMisc[MAX_CVARS][3]
|
||||
new g_cvarCmd[MAX_CVARS*5][32]
|
||||
new g_cvarCmdNum
|
||||
new g_cvarNum
|
||||
|
||||
new g_menuPosition[33]
|
||||
new g_menuSelect[33][64]
|
||||
new g_menuSelectNum[33]
|
||||
new g_menuLayer[33]
|
||||
|
||||
new g_cstrikeRunning
|
||||
|
||||
public plugin_init()
|
||||
{
|
||||
register_plugin("Commands Menu","0.9","default")
|
||||
|
||||
new basedir[32], workdir[64]
|
||||
get_basedir( basedir , 31 )
|
||||
for(new a = 0; a < MAX_CMDS_LAYERS; ++a) {
|
||||
register_menucmd(register_menuid( g_cmdMenuName[ a ] ),1023,"actionCmdMenu")
|
||||
register_clcmd( g_cmdMenuCmd[ a ] ,"cmdCmdMenu",ADMIN_MENU, g_cmdMenuHelp[ a ] )
|
||||
format( workdir, 63, "%s/%s" , basedir , g_cmdMenuCfg[ a ] )
|
||||
loadCmdSettings( workdir , a )
|
||||
}
|
||||
|
||||
register_menucmd(register_menuid("Cvars Menu"),1023,"actionCvarMenu")
|
||||
register_clcmd("amx_cvarmenu","cmdCvarMenu",ADMIN_CVAR,"- displays cvars menu")
|
||||
|
||||
format( workdir, 63, "%s/cvars.ini" , basedir )
|
||||
loadCvarSettings( workdir )
|
||||
|
||||
g_cstrikeRunning = is_running("cstrike")
|
||||
}
|
||||
|
||||
/* Commands menu */
|
||||
|
||||
public actionCmdMenu(id,key)
|
||||
{
|
||||
switch(key){
|
||||
case 8: displayCmdMenu(id,++g_menuPosition[id])
|
||||
case 9: displayCmdMenu(id,--g_menuPosition[id])
|
||||
default:{
|
||||
new option = g_menuSelect[ id ][ g_menuPosition[id] * 8 + key ]
|
||||
new flags = g_cmdMisc[ option ][ 1 ]
|
||||
if ( flags & 1)
|
||||
server_cmd( g_cmdCmd[ option ] )
|
||||
else if ( flags & 2)
|
||||
client_cmd(id, g_cmdCmd[ option ] )
|
||||
else if ( flags & 4)
|
||||
client_cmd(0, g_cmdCmd[ option ] )
|
||||
if ( flags & 8 ) displayCmdMenu(id,g_menuPosition[id])
|
||||
}
|
||||
}
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
|
||||
|
||||
displayCmdMenu(id,pos){
|
||||
|
||||
if (pos < 0) return
|
||||
|
||||
new menuBody[512]
|
||||
new b = 0
|
||||
new start = pos * 8
|
||||
|
||||
if (start >= g_menuSelectNum[id])
|
||||
start = pos = g_menuPosition[id] = 0
|
||||
|
||||
new len = format(menuBody,511,g_cstrikeRunning ?
|
||||
"\y%s\R%d/%d^n\w^n" : "%s %d/%d^n^n" , g_cmdMenuName[ g_menuLayer[id] ],
|
||||
pos+1,( g_menuSelectNum[id] / 8 + ((g_menuSelectNum[id] % 8) ? 1 : 0 )) )
|
||||
|
||||
new end = start + 8
|
||||
new keys = (1<<9)
|
||||
|
||||
if (end > g_menuSelectNum[id])
|
||||
end = g_menuSelectNum[id]
|
||||
|
||||
for(new a = start; a < end; ++a)
|
||||
{
|
||||
if ( g_cmdCmd[ g_menuSelect[id][ a ] ][0] == '-' )
|
||||
{
|
||||
if ( g_cstrikeRunning)
|
||||
len += format(menuBody[len],511-len,"\d%s^n\w",g_cmdName[ g_menuSelect[id][ a ] ] )
|
||||
else
|
||||
len += format(menuBody[len],511-len,"%s^n",g_cmdName[ g_menuSelect[id][ a ] ] )
|
||||
++b
|
||||
}
|
||||
else
|
||||
{
|
||||
keys |= (1<<b)
|
||||
len += format(menuBody[len],511-len,"%d. %s^n",++b, g_cmdName[ g_menuSelect[id][ a ] ] )
|
||||
}
|
||||
}
|
||||
|
||||
if (end != g_menuSelectNum[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 cmdCmdMenu(id,level,cid)
|
||||
{
|
||||
if (!cmd_access(id,level,cid,1)) return PLUGIN_HANDLED
|
||||
|
||||
new szCmd[32]
|
||||
read_argv(0, szCmd, 31)
|
||||
|
||||
new lvl = 0
|
||||
|
||||
while( lvl < MAX_CMDS_LAYERS )
|
||||
{
|
||||
if ( equal( g_cmdMenuCmd[ lvl ], szCmd ) )
|
||||
break
|
||||
|
||||
++lvl
|
||||
}
|
||||
|
||||
g_menuLayer[ id ] = lvl
|
||||
|
||||
new flags = get_user_flags(id)
|
||||
|
||||
g_menuSelectNum[id] = 0
|
||||
|
||||
new a = lvl * MAX_CMDS
|
||||
new d , c = 0
|
||||
|
||||
while( c < g_cmdNum[ lvl ] )
|
||||
{
|
||||
d = a + c
|
||||
|
||||
if ( g_cmdMisc[ d ][0] & flags )
|
||||
{
|
||||
g_menuSelect[id][ g_menuSelectNum[id]++ ] = d
|
||||
}
|
||||
|
||||
++c
|
||||
}
|
||||
|
||||
displayCmdMenu(id,g_menuPosition[id] = 0)
|
||||
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
|
||||
|
||||
loadCmdSettings( szFilename[], level )
|
||||
{
|
||||
if ( !file_exists ( szFilename ) )
|
||||
return 0
|
||||
|
||||
new text[256], szFlags[32], szAccess[32]
|
||||
new a, pos = 0, c, d = level * MAX_CMDS
|
||||
|
||||
while ( g_cmdNum[ level ] < MAX_CMDS && read_file (szFilename,pos++,text,255,a) )
|
||||
{
|
||||
if ( text[0] == ';' ) continue
|
||||
|
||||
c = d + g_cmdNum[ level ]
|
||||
|
||||
if ( parse( text , g_cmdName[ c ] , 31 ,
|
||||
g_cmdCmd[ c ] ,63,szFlags,31,szAccess,31 ) > 3 )
|
||||
{
|
||||
while ( replace( g_cmdCmd[ c ] ,63,"\'","^"") ) {
|
||||
// do nothing
|
||||
}
|
||||
|
||||
g_cmdMisc[ c ][ 1 ] = read_flags ( szFlags )
|
||||
g_cmdMisc[ c ][ 0 ] = read_flags ( szAccess )
|
||||
g_cmdNum[ level ]++
|
||||
}
|
||||
}
|
||||
|
||||
return 1
|
||||
}
|
||||
|
||||
|
||||
/* Cvars menu */
|
||||
|
||||
public actionCvarMenu(id,key)
|
||||
{
|
||||
switch(key){
|
||||
case 8: displayCvarMenu(id,++g_menuPosition[id])
|
||||
case 9: displayCvarMenu(id,--g_menuPosition[id])
|
||||
default:{
|
||||
|
||||
new option = g_menuSelect[ id ][ g_menuPosition[id] * 8 + key ]
|
||||
|
||||
new szValue[32]
|
||||
get_cvar_string( g_cvarNames[ option ], szValue ,31)
|
||||
|
||||
new end = g_cvarMisc[ option ][ 2 ]
|
||||
new start = g_cvarMisc[ option ][ 1 ]
|
||||
|
||||
for(new i = start ; ; ++i )
|
||||
{
|
||||
if ( i < end )
|
||||
{
|
||||
if ( equal( szValue , g_cvarCmd[ i ] ) )
|
||||
{
|
||||
if (++i >= end)
|
||||
{
|
||||
i = start
|
||||
}
|
||||
set_cvar_string( g_cvarNames[ option ], g_cvarCmd[ i ] )
|
||||
break
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
set_cvar_string( g_cvarNames[ option ], g_cvarCmd[ start ] )
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
displayCvarMenu(id, g_menuPosition[id] )
|
||||
}
|
||||
}
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
|
||||
|
||||
displayCvarMenu(id,pos){
|
||||
|
||||
if (pos < 0) return
|
||||
|
||||
new menuBody[512]
|
||||
new b = 0
|
||||
new start = pos * 8
|
||||
|
||||
if (start >= g_menuSelectNum[id])
|
||||
start = pos = g_menuPosition[id] = 0
|
||||
|
||||
new len = format(menuBody,511, g_cstrikeRunning ?
|
||||
"\yCvars Menu\R%d/%d^n\w^n" : "Cvars Menu %d/%d^n^n",
|
||||
pos+1,( g_menuSelectNum[id] / 8 + ((g_menuSelectNum[id] % 8) ? 1 : 0 )) )
|
||||
|
||||
new end = start + 8
|
||||
new keys = (1<<9)
|
||||
new szValue[64]
|
||||
|
||||
if (end > g_menuSelectNum[id])
|
||||
end = g_menuSelectNum[id]
|
||||
|
||||
for(new a = start; a < end; ++a)
|
||||
{
|
||||
get_cvar_string( g_cvarNames[ g_menuSelect[id][ a ] ],szValue,31)
|
||||
keys |= (1<<b)
|
||||
++b
|
||||
if ( g_cstrikeRunning )
|
||||
len += format(menuBody[len],511-len,"%d. %s\R%s^n\w", b, g_cvarNames[ g_menuSelect[id][ a ] ], szValue )
|
||||
else
|
||||
len += format(menuBody[len],511-len,"%d. %s %s^n", b, g_cvarNames[ g_menuSelect[id][ a ] ], szValue )
|
||||
}
|
||||
|
||||
if (end != g_menuSelectNum[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 cmdCvarMenu(id,level,cid)
|
||||
{
|
||||
if (!cmd_access(id,level,cid,1)) return PLUGIN_HANDLED
|
||||
|
||||
new flags = get_user_flags(id)
|
||||
|
||||
g_menuSelectNum[id] = 0
|
||||
|
||||
for(new a = 0; a < g_cvarNum; ++a)
|
||||
if ( g_cvarMisc[ a ][0] & flags )
|
||||
g_menuSelect[id][ g_menuSelectNum[id]++ ] = a
|
||||
|
||||
displayCvarMenu(id,g_menuPosition[id] = 0)
|
||||
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
|
||||
loadCvarSettings( szFilename[] )
|
||||
{
|
||||
if ( !file_exists ( szFilename ) )
|
||||
return 0
|
||||
|
||||
new text[256], szValues[12][32]
|
||||
new inum , a, pos = 0
|
||||
new cvar_values = MAX_CVARS * 5
|
||||
// a b c d
|
||||
while ( g_cvarNum < MAX_CVARS && read_file (szFilename,pos++,text,255,a) )
|
||||
{
|
||||
if ( text[0] == ';' ) continue
|
||||
|
||||
inum = parse( text , g_cvarNames[ g_cvarNum ] , 31 ,
|
||||
szValues[0] ,31 , szValues[1] ,31 , szValues[2] ,31 ,
|
||||
szValues[3] ,31 , szValues[4] ,31 , szValues[5] ,31 ,
|
||||
szValues[6] ,31 , szValues[7] ,31 , szValues[8] ,31 ,
|
||||
szValues[9] ,31 , szValues[10] ,31 , szValues[11] ,31 )
|
||||
|
||||
inum -= 2
|
||||
|
||||
if ( inum < 2 ) continue
|
||||
|
||||
g_cvarMisc[ g_cvarNum ][1] = g_cvarCmdNum
|
||||
|
||||
for( a = 0 ; a < inum && g_cvarCmdNum < cvar_values ; ++a )
|
||||
{
|
||||
while ( replace( szValues[ a ] ,31 , "\'" , "^"" ) ) {
|
||||
// do nothing
|
||||
}
|
||||
|
||||
copy ( g_cvarCmd[ g_cvarCmdNum ] , 31 , szValues[ a ] )
|
||||
g_cvarCmdNum++
|
||||
}
|
||||
|
||||
g_cvarMisc[ g_cvarNum ][2] = g_cvarCmdNum
|
||||
g_cvarMisc[ g_cvarNum ][0] = read_flags( szValues[ inum ] )
|
||||
g_cvarNum++
|
||||
|
||||
}
|
||||
|
||||
return 1
|
||||
}
|
12
plugins/compile.bat
Executable file
12
plugins/compile.bat
Executable file
@@ -0,0 +1,12 @@
|
||||
@echo off
|
||||
|
||||
if not exist compiled mkdir compiled
|
||||
if exist temp.txt del temp.txt
|
||||
for %%i in (*.sma) do sc %%i -ocompiled\%%i >> temp.txt
|
||||
copy compiled\*.sma compiled\*.amx
|
||||
del compiled\*.sma
|
||||
cls
|
||||
type temp.txt
|
||||
del temp.txt
|
||||
|
||||
pause
|
6
plugins/compile.sh
Executable file
6
plugins/compile.sh
Executable file
@@ -0,0 +1,6 @@
|
||||
#!/bin/bash
|
||||
test -e compiled || mkdir compiled
|
||||
ls *.sma | xargs -i ./sc \{\} -ocompiled/\{\} > temp.txt
|
||||
ls compiled/*.sma | xargs -i basename \{\} .sma | xargs -i mv compiled/\{\}.sma compiled/\{\}.amx
|
||||
more temp.txt
|
||||
rm temp.txt
|
26
plugins/csstats.sma
Executable file
26
plugins/csstats.sma
Executable file
@@ -0,0 +1,26 @@
|
||||
/* Get Score for CS STATS.
|
||||
*
|
||||
* (c) 2003, OLO
|
||||
* This file is provided as is (no warranties).
|
||||
*
|
||||
* Function calculates position in rank.
|
||||
*
|
||||
* Stats:
|
||||
* 0 - kills
|
||||
* 1 - deaths
|
||||
* 2 - headshots
|
||||
* 3 - teamkilling
|
||||
* 4 - shots
|
||||
* 5 - hits
|
||||
* 6 - damage
|
||||
*
|
||||
* Returning cellmin as value in get_score function
|
||||
* makes that rank won't be saved.
|
||||
*
|
||||
* File location: $moddir/addons/amx
|
||||
*/
|
||||
|
||||
#include <amxmod>
|
||||
|
||||
public get_score( stats[8] , body[8] )
|
||||
return stats[0] - stats[1] // kills - deaths
|
76
plugins/imessage.sma
Executable file
76
plugins/imessage.sma
Executable file
@@ -0,0 +1,76 @@
|
||||
/* AMX Mod script.
|
||||
*
|
||||
* (c) 2003, OLO
|
||||
* This file is provided as is (no warranties).
|
||||
*
|
||||
* Server command:
|
||||
* amx_imessage <msg> <colour in RRRGGGBBB format>
|
||||
*
|
||||
*/
|
||||
|
||||
#include <amxmod>
|
||||
#include <amxmisc>
|
||||
|
||||
#define MAX_MESSAGES 6
|
||||
#define X_POS -1.0
|
||||
#define Y_POS 0.30
|
||||
#define HOLD_TIME 12.0
|
||||
|
||||
new g_Values[MAX_MESSAGES][3]
|
||||
new g_Messages[MAX_MESSAGES][384]
|
||||
new g_MessagesNum
|
||||
new g_Current
|
||||
|
||||
public plugin_init(){
|
||||
register_plugin("Info. Messages","0.9","default")
|
||||
register_srvcmd("amx_imessage","setMessage")
|
||||
register_cvar("amx_freq_imessage","10")
|
||||
new lastinfo[8]
|
||||
get_localinfo("lastinfomsg",lastinfo,7)
|
||||
g_Current = strtonum(lastinfo)
|
||||
set_localinfo("lastinfomsg","")
|
||||
}
|
||||
|
||||
public infoMessage(){
|
||||
if (g_Current >= g_MessagesNum)
|
||||
g_Current = 0
|
||||
set_hudmessage(g_Values[g_Current][0], g_Values[g_Current][1], g_Values[g_Current][2],
|
||||
X_POS, Y_POS, 0, 0.5, HOLD_TIME , 2.0, 2.0, 1)
|
||||
show_hudmessage(0,g_Messages[g_Current])
|
||||
client_print(0,print_console,g_Messages[g_Current])
|
||||
++g_Current
|
||||
new Float:freq_im = get_cvar_float("amx_freq_imessage")
|
||||
if ( freq_im > 0.0 ) set_task( freq_im ,"infoMessage",12345)
|
||||
}
|
||||
|
||||
public setMessage(id,level,cid) {
|
||||
if (!cmd_access(id,level,cid,3))
|
||||
return PLUGIN_HANDLED
|
||||
if (g_MessagesNum >= MAX_MESSAGES) {
|
||||
console_print(id,"Information Messages limit reached!")
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
remove_task(12345)
|
||||
read_argv(1,g_Messages[g_MessagesNum],380)
|
||||
new hostname[64]
|
||||
get_cvar_string("hostname",hostname,63)
|
||||
replace(g_Messages[g_MessagesNum],380,"%hostname%",hostname)
|
||||
while(replace(g_Messages[g_MessagesNum],380,"\n","^n")){}
|
||||
new mycol[12]
|
||||
read_argv(2,mycol,11) // RRRGGGBBB
|
||||
g_Values[g_MessagesNum][2] = strtonum(mycol[6])
|
||||
mycol[6] = 0
|
||||
g_Values[g_MessagesNum][1] = strtonum(mycol[3])
|
||||
mycol[3] = 0
|
||||
g_Values[g_MessagesNum][0] = strtonum(mycol[0])
|
||||
g_MessagesNum++
|
||||
new Float:freq_im = get_cvar_float("amx_freq_imessage")
|
||||
if ( freq_im > 0.0 ) set_task( freq_im ,"infoMessage",12345)
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
|
||||
public plugin_end(){
|
||||
new lastinfo[8]
|
||||
numtostr(g_Current,lastinfo,7)
|
||||
set_localinfo("lastinfomsg",lastinfo)
|
||||
}
|
205
plugins/include/amxconst.inc
Executable file
205
plugins/include/amxconst.inc
Executable file
@@ -0,0 +1,205 @@
|
||||
/* AMX Mod
|
||||
*
|
||||
* (c) 2002-2003, OLO
|
||||
* This file is provided as is (no warranties).
|
||||
*/
|
||||
|
||||
#if defined _amxconst_included
|
||||
#endinput
|
||||
#endif
|
||||
#define _amxconst_included
|
||||
|
||||
// Uncomment if you are not using Steam
|
||||
//#define NO_STEAM
|
||||
|
||||
#define ADMIN_IMMUNITY (1<<0) /* flag "a" */
|
||||
#define ADMIN_RESERVATION (1<<1) /* flag "b" */
|
||||
#define ADMIN_KICK (1<<2) /* flag "c" */
|
||||
#define ADMIN_BAN (1<<3) /* flag "d" */
|
||||
#define ADMIN_SLAY (1<<4) /* flag "e" */
|
||||
#define ADMIN_MAP (1<<5) /* flag "f" */
|
||||
#define ADMIN_CVAR (1<<6) /* flag "g" */
|
||||
#define ADMIN_CFG (1<<7) /* flag "h" */
|
||||
#define ADMIN_CHAT (1<<8) /* flag "i" */
|
||||
#define ADMIN_VOTE (1<<9) /* flag "j" */
|
||||
#define ADMIN_PASSWORD (1<<10) /* flag "k" */
|
||||
#define ADMIN_RCON (1<<11) /* flag "l" */
|
||||
#define ADMIN_LEVEL_A (1<<12) /* flag "m" */
|
||||
#define ADMIN_LEVEL_B (1<<13) /* flag "n" */
|
||||
#define ADMIN_LEVEL_C (1<<14) /* flag "o" */
|
||||
#define ADMIN_LEVEL_D (1<<15) /* flag "p" */
|
||||
#define ADMIN_LEVEL_E (1<<16) /* flag "q" */
|
||||
#define ADMIN_LEVEL_F (1<<17) /* flag "r" */
|
||||
#define ADMIN_LEVEL_G (1<<18) /* flag "s" */
|
||||
|
||||
#define ADMIN_LEVEL_H (1<<19) /* flag "t" */
|
||||
#define ADMIN_MENU (1<<20) /* flag "u" */
|
||||
#define ADMIN_USER (1<<25) /* flag "z" */
|
||||
|
||||
#define FLAG_KICK (1<<0) /* flag "a" */
|
||||
#define FLAG_TAG (1<<1) /* flag "b" */
|
||||
#define FLAG_AUTHID (1<<2) /* flag "c" */
|
||||
#define FLAG_IP (1<<3) /* flag "d" */
|
||||
#define FLAG_NOPASS (1<<4) /* flag "e" */
|
||||
|
||||
#define PLUGIN_CONTINUE 0 /* Results returned by public functions */
|
||||
#define PLUGIN_HANDLED 1 /* stop other plugins */
|
||||
#define PLUGIN_HANDLED_MAIN 2 /* to use in client_command(), continue all plugins but stop the command */
|
||||
|
||||
/* Destination types for message_begin() */
|
||||
#define MSG_BROADCAST 0 /* unreliable to all */
|
||||
#define MSG_ONE 1 /* reliable to one (msg_entity) */
|
||||
#define MSG_ALL 2 /* reliable to all */
|
||||
#define MSG_INIT 3 /* write to the init string */
|
||||
#define MSG_PVS 4 /* Ents in PVS of org */
|
||||
#define MSG_PAS 5 /* Ents in PAS of org */
|
||||
#define MSG_PVS_R 6 /* Reliable to PVS */
|
||||
#define MSG_PAS_R 7 /* Reliable to PAS */
|
||||
#define MSG_ONE_UNRELIABLE 8 /* Send to one client, but don't put in reliable stream, put in unreliable datagram ( could be dropped ) */
|
||||
#define MSG_SPEC 9 /* Sends to all spectator proxies */
|
||||
|
||||
/* Message types for message_begin() */
|
||||
#define SVC_TEMPENTITY 23
|
||||
#define SVC_INTERMISSION 30
|
||||
#define SVC_CDTRACK 32
|
||||
#define SVC_WEAPONANIM 35
|
||||
#define SVC_ROOMTYPE 37
|
||||
#define SVC_ADDANGLE 38 /* [vec3] add this angle to the view angle */
|
||||
#define SVC_NEWUSERMSG 39
|
||||
#define SVC_HLTV 50
|
||||
|
||||
/* Flags for register_cvar() */
|
||||
#define FCVAR_ARCHIVE 1 /* set to cause it to be saved to vars.rc */
|
||||
#define FCVAR_USERINFO 2 /* changes the client's info string */
|
||||
#define FCVAR_SERVER 4 /* notifies players when changed */
|
||||
#define FCVAR_EXTDLL 8 /* defined by external DLL */
|
||||
#define FCVAR_CLIENTDLL 16 /* defined by the client dll */
|
||||
#define FCVAR_PROTECTED 32 /* It's a server cvar, but we don't send the data since it's a password, etc. Sends 1 if it's not bland/zero, 0 otherwise as value */
|
||||
#define FCVAR_SPONLY 64 /* This cvar cannot be changed by clients connected to a multiplayer server. */
|
||||
#define FCVAR_PRINTABLEONLY 128 /* This cvar's string cannot contain unprintable characters ( e.g., used for player name etc ). */
|
||||
#define FCVAR_UNLOGGED 256 /* If this is a FCVAR_SERVER, don't log changes to the log file / console if we are creating a log */
|
||||
|
||||
|
||||
/* Id of weapons in CS */
|
||||
#define CSW_P228 1
|
||||
#define CSW_SCOUT 3
|
||||
#define CSW_HEGRENADE 4
|
||||
#define CSW_XM1014 5
|
||||
#define CSW_C4 6
|
||||
#define CSW_MAC10 7
|
||||
#define CSW_AUG 8
|
||||
#define CSW_SMOKEGRENADE 9
|
||||
#define CSW_ELITE 10
|
||||
#define CSW_FIVESEVEN 11
|
||||
#define CSW_UMP45 12
|
||||
#define CSW_SG550 13
|
||||
#define CSW_GALI 14
|
||||
#define CSW_FAMAS 15
|
||||
#define CSW_USP 16
|
||||
#define CSW_GLOCK18 17
|
||||
#define CSW_AWP 18
|
||||
#define CSW_MP5NAVY 19
|
||||
#define CSW_M249 20
|
||||
#define CSW_M3 21
|
||||
#define CSW_M4A1 22
|
||||
#define CSW_TMP 23
|
||||
#define CSW_G3SG1 24
|
||||
#define CSW_FLASHBANG 25
|
||||
#define CSW_DEAGLE 26
|
||||
#define CSW_SG552 27
|
||||
#define CSW_AK47 28
|
||||
#define CSW_KNIFE 29
|
||||
#define CSW_P90 30
|
||||
|
||||
/* Parts of body for hits */
|
||||
#define HIT_GENERIC 0 /* none */
|
||||
#define HIT_HEAD 1
|
||||
#define HIT_CHEST 2
|
||||
#define HIT_STOMACH 3
|
||||
#define HIT_LEFTARM 4
|
||||
#define HIT_RIGHTARM 5
|
||||
#define HIT_LEFTLEG 6
|
||||
#define HIT_RIGHTLEG 7
|
||||
|
||||
/* Constants for emit_sound() */
|
||||
/* Channels */
|
||||
#define CHAN_AUTO 0
|
||||
#define CHAN_WEAPON 1
|
||||
#define CHAN_VOICE 2
|
||||
#define CHAN_ITEM 3
|
||||
#define CHAN_BODY 4
|
||||
#define CHAN_STREAM 5 /* allocate stream channel from the static or dynamic area */
|
||||
#define CHAN_STATIC 6 /* allocate channel from the static area */
|
||||
#define CHAN_NETWORKVOICE_BASE 7 /* voice data coming across the network */
|
||||
#define CHAN_NETWORKVOICE_END 500 /* network voice data reserves slots (CHAN_NETWORKVOICE_BASE through CHAN_NETWORKVOICE_END). */
|
||||
|
||||
/* Attenuation values */
|
||||
#define ATTN_NONE 0.00
|
||||
#define ATTN_NORM 0.80
|
||||
#define ATTN_IDLE 2.00
|
||||
#define ATTN_STATIC 1.25
|
||||
|
||||
/* Pitch values */
|
||||
#define PITCH_NORM 100 /* non-pitch shifted */
|
||||
#define PITCH_LOW 95 /* other values are possible - 0-255, where 255 is very high */
|
||||
#define PITCH_HIGH 120
|
||||
|
||||
|
||||
/* Volume values */
|
||||
#define VOL_NORM 1.0
|
||||
|
||||
/* Destination types for client_print() */
|
||||
enum {
|
||||
print_notify = 1,
|
||||
print_console,
|
||||
print_chat,
|
||||
print_center,
|
||||
}
|
||||
|
||||
/* Destination types for engclient_print() */
|
||||
enum {
|
||||
engprint_console = 0,
|
||||
engprint_center,
|
||||
engprint_chat,
|
||||
}
|
||||
|
||||
/* Render for set_user_rendering() */
|
||||
enum {
|
||||
kRenderNormal, /* src */
|
||||
kRenderTransColor, /* c*a+dest*(1-a) */
|
||||
kRenderTransTexture, /* src*a+dest*(1-a) */
|
||||
kRenderGlow, /* src*a+dest -- No Z buffer checks */
|
||||
kRenderTransAlpha, /* src*srca+dest*(1-srca) */
|
||||
kRenderTransAdd, /* src*a+dest */
|
||||
}
|
||||
|
||||
/* Fx for set_user_rendering() */
|
||||
enum {
|
||||
kRenderFxNone = 0,
|
||||
kRenderFxPulseSlow,
|
||||
kRenderFxPulseFast,
|
||||
kRenderFxPulseSlowWide,
|
||||
kRenderFxPulseFastWide,
|
||||
kRenderFxFadeSlow,
|
||||
kRenderFxFadeFast,
|
||||
kRenderFxSolidSlow,
|
||||
kRenderFxSolidFast,
|
||||
kRenderFxStrobeSlow,
|
||||
kRenderFxStrobeFast,
|
||||
kRenderFxStrobeFaster,
|
||||
kRenderFxFlickerSlow,
|
||||
kRenderFxFlickerFast,
|
||||
kRenderFxNoDissipation,
|
||||
kRenderFxDistort, /* Distort/scale/translate flicker */
|
||||
kRenderFxHologram, /* kRenderFxDistort + distance fade */
|
||||
kRenderFxDeadPlayer, /* kRenderAmt is the player index */
|
||||
kRenderFxExplode, /* Scale up really big! */
|
||||
kRenderFxGlowShell, /* Glowing Shell */
|
||||
kRenderFxClampMinScale, /* Keep this sprite from getting very small (SPRITES only!) */
|
||||
}
|
||||
|
||||
enum {
|
||||
force_exactfile, /* File on client must exactly match server's file */
|
||||
force_model_samebounds, /* For model files only, the geometry must fit in the same bbox */
|
||||
force_model_specifybounds, /* For model files only, the geometry must fit in the specified bbox */
|
||||
}
|
104
plugins/include/amxmisc.inc
Executable file
104
plugins/include/amxmisc.inc
Executable file
@@ -0,0 +1,104 @@
|
||||
/* AMX Mod misc.
|
||||
*
|
||||
* (c) 2002-2003, OLO
|
||||
* This file is provided as is (no warranties).
|
||||
*/
|
||||
|
||||
#if defined _amxmisc_included
|
||||
#endinput
|
||||
#endif
|
||||
#define _amxmisc_included
|
||||
|
||||
stock cmd_access(a,b,c,d){
|
||||
if ( ((get_user_flags(a)&b)!=b) && (a!=(is_dedicated_server()?0:1)) ){
|
||||
console_print(a,"You have no access to that command")
|
||||
return 0
|
||||
}
|
||||
if (read_argc() < d){
|
||||
new hcmd[32], hinfo[128], hflag
|
||||
get_concmd(c,hcmd,31,hflag,hinfo,127,b)
|
||||
console_print(a,"Usage: %s %s",hcmd,hinfo)
|
||||
return 0
|
||||
}
|
||||
return 1
|
||||
}
|
||||
|
||||
stock access(id,level)
|
||||
return (get_user_flags(id) & level)
|
||||
|
||||
/* Flags:
|
||||
* 1 - obey immunity
|
||||
* 2 - allow yourself
|
||||
* 4 - must be alive
|
||||
* 8 - can't be bot
|
||||
*/
|
||||
stock cmd_target(id,const arg[],flags = 1) {
|
||||
new player = find_player("bl",arg)
|
||||
if (player){
|
||||
if ( player != find_player("blj",arg) ){
|
||||
console_print(id,"There are more clients matching to your argument")
|
||||
return 0
|
||||
}
|
||||
}
|
||||
else if ( ( player = find_player("c",arg) )==0 && arg[0]=='#' && arg[1] )
|
||||
player = find_player("k",strtonum(arg[1]))
|
||||
if (!player){
|
||||
console_print(id,"Client with that name or userid not found")
|
||||
return 0
|
||||
}
|
||||
if (flags & 1){
|
||||
if ((get_user_flags(player)&ADMIN_IMMUNITY) && ((flags&2)?(id!=player):true) ){
|
||||
new imname[32]
|
||||
get_user_name(player,imname,31)
|
||||
console_print(id,"Client ^"%s^" has immunity",imname)
|
||||
return 0
|
||||
}
|
||||
}
|
||||
if (flags & 4){
|
||||
if (!is_user_alive(player)){
|
||||
new imname[32]
|
||||
get_user_name(player,imname,31)
|
||||
console_print(id,"That action can't be performed on dead client ^"%s^"",imname)
|
||||
return 0
|
||||
}
|
||||
}
|
||||
if (flags & 8){
|
||||
if (is_user_bot(player)){
|
||||
new imname[32]
|
||||
get_user_name(player,imname,31)
|
||||
console_print(id,"That action can't be performed on bot ^"%s^"",imname)
|
||||
return 0
|
||||
}
|
||||
}
|
||||
return player
|
||||
}
|
||||
|
||||
stock show_activity( id, const name[], {Float,_}: ... ){
|
||||
new buffer[128]
|
||||
format_args( buffer , 127 , 2 )
|
||||
switch(get_cvar_num("amx_show_activity")) {
|
||||
case 2: client_print(0,print_chat,"%s %s: %s",
|
||||
(get_user_flags(id) & ADMIN_USER) ? "PLAYER" : "ADMIN" , name , buffer )
|
||||
case 1: client_print(0,print_chat,"%s: %s",
|
||||
(get_user_flags(id) & ADMIN_USER) ? "PLAYER" : "ADMIN", buffer )
|
||||
}
|
||||
}
|
||||
|
||||
stock is_running(const arg[]){
|
||||
new mod_name[32]
|
||||
get_modname(mod_name,31)
|
||||
return equal(mod_name,arg)
|
||||
}
|
||||
|
||||
stock build_path( path[] , len , {Float,_}:... ) {
|
||||
new basedir[32]
|
||||
get_localinfo( "amx_basedir", basedir , 31 )
|
||||
format_args( path , len , 2 )
|
||||
return replace( path , len , "$basedir", basedir )
|
||||
}
|
||||
|
||||
stock get_basedir( name[], len )
|
||||
return get_localinfo( "amx_basedir", name , len )
|
||||
|
||||
stock get_logfile( name[], len )
|
||||
return get_time("admin%m%d.log",name,len)
|
560
plugins/include/amxmod.inc
Executable file
560
plugins/include/amxmod.inc
Executable file
@@ -0,0 +1,560 @@
|
||||
/* AMX Mod functions
|
||||
*
|
||||
* (c) 2002-2003, OLO
|
||||
* This file is provided as is (no warranties).
|
||||
*/
|
||||
|
||||
#if defined _amxmod_included
|
||||
#endinput
|
||||
#endif
|
||||
#define _amxmod_included
|
||||
|
||||
#include <core>
|
||||
#include <float>
|
||||
#include <amxconst>
|
||||
#include <string>
|
||||
#include <file>
|
||||
#include <fun>
|
||||
#include <vault>
|
||||
|
||||
/* Function is called just after server activation.
|
||||
* Good place for configuration loading, commands and cvars registration. */
|
||||
forward plugin_init();
|
||||
|
||||
/* Function is called when all plugin_init from plugins
|
||||
* were called, so all commmands and cvars should be already registered. */
|
||||
forward plugin_cfg();
|
||||
|
||||
/* Function called before plugin unloading (server deactivation) */
|
||||
forward plugin_end();
|
||||
|
||||
/* Called on log message. */
|
||||
forward plugin_log();
|
||||
|
||||
/* Use here model_precache() and sound_precache() functions. */
|
||||
forward plugin_precache();
|
||||
|
||||
/* Whenever player info is changed, this function is called. */
|
||||
forward client_infochanged(id);
|
||||
|
||||
/* Called on client connection. */
|
||||
forward client_connect(id);
|
||||
|
||||
/* Called when client gets valid STEAM id (usually
|
||||
* between client_connect() and client_putinserver()). */
|
||||
forward client_authorized(id);
|
||||
|
||||
/* Called when client is disconnecting from server. */
|
||||
forward client_disconnect(id);
|
||||
|
||||
/* Called when client is sending command. */
|
||||
forward client_command(id);
|
||||
|
||||
/* Called when client is entering to a game. */
|
||||
forward client_putinserver(id);
|
||||
|
||||
/* Sets informations about plugin. */
|
||||
native register_plugin(const plugin_name[],const version[],const author[]);
|
||||
|
||||
/* Gets info about plugin by given index.
|
||||
* Function returns -1 if plugin doesn't exist with given index. */
|
||||
native get_plugin(index,filename[],len1,name[],len2,version[],len3,author[],len4,status[],len5);
|
||||
|
||||
/* Returns number of all loaded plugins. */
|
||||
native get_pluginsnum();
|
||||
|
||||
/* Precache model. Can be used only in plugin_precache() function.*/
|
||||
native precache_model(const name[]);
|
||||
|
||||
/* Precache sound. Can be used only in plugin_precache() function.*/
|
||||
native precache_sound(const name[]);
|
||||
|
||||
/* Sets info for player. */
|
||||
native set_user_info(index,const info[],const value[]);
|
||||
|
||||
/* Gets info from player. */
|
||||
native get_user_info(index,const info[],output[],len);
|
||||
|
||||
/* Sets info for server. */
|
||||
native set_localinfo(const info[],const value[]);
|
||||
|
||||
/* Gets info from server. */
|
||||
native get_localinfo(const info[],output[],len);
|
||||
|
||||
/* Shows text in MOTD window. When there is no header, the MOTD title
|
||||
* will be the name of server. If message is filename, then a contents
|
||||
* of this file will be displayed as MOTD. */
|
||||
native show_motd(player,const message[],const header[]="");
|
||||
|
||||
/* Sends message to player. Set index to 0 to send text globaly. */
|
||||
native client_print(index,type,const message[],{Float,_}:...);
|
||||
|
||||
/* Sends message to player by engine. Set index to 0 to send text globaly. */
|
||||
native engclient_print(player,type,const message[],{Float,_}:...);
|
||||
|
||||
/* Sends message to console. */
|
||||
native console_print(id,const message[],{Float,_}:...);
|
||||
|
||||
/* Sends command to console. */
|
||||
native console_cmd(id,const cmd[],{Float,_}:...);
|
||||
|
||||
/* Registers event on which a given function will be called
|
||||
* Flags:
|
||||
* "a" - global event.
|
||||
* "b" - specified.
|
||||
* "c" - send only once when repeated to other players.
|
||||
* "d" - call if is send to dead player.
|
||||
* "e" - to alive.
|
||||
* Examples for conditions:
|
||||
* "2=c4" - 2nd parameter of message must be sting "c4".
|
||||
* "3>10" - 3rd parameter must be greater then 10.
|
||||
* "3!4" - 3rd must be different from 4.
|
||||
* "2&Buy" - 2nd parameter of message must contain "Buy" substring.
|
||||
* "2!Buy" - 2nd parameter of message can't contain "Buy" substring. */
|
||||
native register_event(const event[],const function[],const flags[],cond[]="", ... );
|
||||
|
||||
/* Registers log event on which the given function will be called
|
||||
* Examples for conditions:
|
||||
* "0=World triggered" "1=Game_Commencing"
|
||||
* "1=say"
|
||||
* "3=Terrorists_Win"
|
||||
* "1=entered the game"
|
||||
* "0=Server cvar"
|
||||
*/
|
||||
native register_logevent(const function[], argsnum, ... );
|
||||
|
||||
/* Sets format for hudmessage. */
|
||||
native set_hudmessage(red=200, green=100, blue=0, Float:x=-1.0, Float:y=0.35, effects=0, Float:fxtime=6.0, Float:holdtime=12.0, Float:fadeintime=0.1, Float:fadeouttime=0.2,channel=4);
|
||||
|
||||
/* Displays HUD message to given player. */
|
||||
native show_hudmessage(index,const message[],{Float,_}:...);
|
||||
|
||||
/* Displays menu. Keys have bit values (key 1 is (1<<0), key 5 is (1<<4) etc.). */
|
||||
native show_menu(index,keys,const menu[], time = -1);
|
||||
|
||||
/* Gets value from client messages.
|
||||
* When you are asking for string the array and length is needed (read_data(2,name,len)).
|
||||
* Integer is returned by function (new me = read_data(3)).
|
||||
* Float is set in second parameter (read_data(3,value)). */
|
||||
native read_data(value, {Float,_}:... );
|
||||
|
||||
/* Returns number of values in client message. */
|
||||
native read_datanum();
|
||||
|
||||
/* Gets log message. Can be called only in plugin_log() forward function. */
|
||||
native read_logdata(output[],len);
|
||||
|
||||
/* Returns number of log arguments.
|
||||
* Can be called only in plugin_log() forward function. */
|
||||
native read_logargc();
|
||||
|
||||
/* Gets log argument indexed from 0.
|
||||
* Can be called only in plugin_log() forward function. */
|
||||
native read_logargv(id,output[],len);
|
||||
|
||||
/* Parse log data about user ( "Butcher<5><BOT><TERRORIST>" etc. ). */
|
||||
native parse_loguser(const text[], name[], nlen, &userid = -2, authid[] = "", alen = 0, team[]="", tlen=0);
|
||||
|
||||
/* Prints message to server console.
|
||||
* You may use text formating (f.e. server_print("%-32s %.2f!","hello",7.345)) */
|
||||
native server_print(const message[], {Float,_}:...);
|
||||
|
||||
/* Returns 1 or 0. */
|
||||
native is_map_valid(const mapname[]);
|
||||
|
||||
/* Returns 1 or 0. */
|
||||
native is_user_bot(index);
|
||||
|
||||
/* Returns 1 or 0. */
|
||||
native is_user_hltv(index);
|
||||
|
||||
/* Returns 1 or 0. */
|
||||
native is_user_connected(index);
|
||||
|
||||
/* Returns 1 or 0. */
|
||||
native is_user_connecting(index);
|
||||
|
||||
/* Returns 1 or 0. */
|
||||
native is_user_alive(index);
|
||||
|
||||
/* Returns 1 or 0. */
|
||||
native is_dedicated_server();
|
||||
|
||||
/* Returns 1 or 0. */
|
||||
native is_linux_server();
|
||||
|
||||
/* If player is not attacked function returns 0, in other
|
||||
* case returns index of attacking player. On second and third
|
||||
* parameter you may get info about weapon and body hit place. */
|
||||
native get_user_attacker(index,...);
|
||||
|
||||
/* If player doesn't hit at anything function returns 0.0,
|
||||
* in other case the distance between hit point and player is returned.
|
||||
* If player is aiming at another player then the id and part of body are set. */
|
||||
native Float:get_user_aiming(index,&id,&body,dist=9999);
|
||||
|
||||
/* Returns player frags. */
|
||||
native get_user_frags(index);
|
||||
|
||||
/* Returns player deaths. */
|
||||
native get_user_deaths(index);
|
||||
|
||||
/* Returns player armor. */
|
||||
native get_user_armor(index);
|
||||
|
||||
/* Returns player health. */
|
||||
native get_user_health(index);
|
||||
|
||||
/* Returns index. */
|
||||
native get_user_index(const name[]);
|
||||
|
||||
/* Returns ip. */
|
||||
native get_user_ip(index,ip[],len, without_port = 0);
|
||||
|
||||
/* Returns id of currently carried weapon. Gets also
|
||||
* ammount of ammo in clip and backpack. */
|
||||
native get_user_weapon(index,&clip,&ammo);
|
||||
|
||||
/* Gets ammo and clip from current weapon. */
|
||||
native get_user_ammo(index,weapon,&clip,&ammo);
|
||||
|
||||
/* Converts numbers from range 0 - 999 to words. */
|
||||
native num_to_word(num,output[],len);
|
||||
|
||||
/* Returns team id. When length is greater then 0
|
||||
* then a name of team is set. */
|
||||
native get_user_team(index, team[]="", len = 0);
|
||||
|
||||
/* Returns player playing time in seconds.
|
||||
* If flag is set then result is without connection time. */
|
||||
native get_user_time(index, flag = 0);
|
||||
|
||||
/* Gets ping and loss at current time. */
|
||||
native get_user_ping(index, &ping, &loss);
|
||||
|
||||
/* Gets origin from player.
|
||||
* Modes:
|
||||
* 0 - current position.
|
||||
* 1 - position from eyes (weapon aiming).
|
||||
* 2 - end position from player position.
|
||||
* 3 - end position from eyes (hit point for weapon).
|
||||
* 4 - position of last bullet hit (only CS). */
|
||||
native get_user_origin(index, origin[3], mode = 0);
|
||||
|
||||
/* Returns all carried weapons as bit sum. Gets
|
||||
* also theirs indexes. */
|
||||
native get_user_weapons(index,weapons[32],&num);
|
||||
|
||||
/* Returns weapon name. */
|
||||
native get_weaponname(id,weapon[],len);
|
||||
|
||||
/* Returns player name. */
|
||||
native get_user_name(index,name[],len);
|
||||
|
||||
/* Gets player authid. */
|
||||
native get_user_authid(index, authid[] ,len);
|
||||
|
||||
/* Returns player wonid. */
|
||||
native get_user_wonid(index);
|
||||
|
||||
/* Returns player userid. */
|
||||
native get_user_userid(index);
|
||||
|
||||
/* Slaps player with given power. */
|
||||
native user_slap(index,power,rnddir=1);
|
||||
|
||||
/* Kills player. When flag is set to 1 then death won't decrase frags. */
|
||||
native user_kill(index,flag=0);
|
||||
|
||||
/* Sends message to standard HL logs. */
|
||||
native log_message(const message[],{Float,_}:...);
|
||||
|
||||
/* Sends log message to specified file. */
|
||||
native log_to_file(const file[],const message[],{Float,_}:...);
|
||||
|
||||
/* Returns number of players put in server.
|
||||
* If flag is set then also connecting are counted. */
|
||||
native get_playersnum(flag=0);
|
||||
|
||||
/* Sets indexes of players.
|
||||
* Flags:
|
||||
* "a" - don't collect dead players.
|
||||
* "b" - don't collect alive players.
|
||||
* "c" - skip bots.
|
||||
* "d" - skip real players.
|
||||
* "e" - match with team.
|
||||
* "f" - match with part of name.
|
||||
* "g" - ignore case sensitivity.
|
||||
* Example: Get all alive CTs: get_players(players,num,"ae","CT") */
|
||||
native get_players(players[32], &num ,const flags[]="", const team[]="");
|
||||
|
||||
/* Gets argument from command. */
|
||||
native read_argv(id,output[],len);
|
||||
|
||||
/* Gets line of all arguments. */
|
||||
native read_args(output[],len);
|
||||
|
||||
/* Returns number of arguments (+ one as command). */
|
||||
native read_argc();
|
||||
|
||||
/* Converts string to sum of bits.
|
||||
* Example: "abcd" is a sum of 1, 2, 4 and 8. */
|
||||
native read_flags(const flags[]);
|
||||
|
||||
/* Converts sum of bits to string.
|
||||
* Example: 3 will return "ab". */
|
||||
native get_flags(flags,output[],len);
|
||||
|
||||
/* Find player.
|
||||
* Flags:
|
||||
* "a" - with given name.
|
||||
* "b" - with given part of name.
|
||||
* "c" - with given authid.
|
||||
* "d" - with given ip.
|
||||
* "e" - with given team name.
|
||||
* "f" - don't look in dead players.
|
||||
* "g" - don't look in alive players.
|
||||
* "h" - skip bots.
|
||||
* "i" - skip real players.
|
||||
* "j" - return index of last found player.
|
||||
* "k" - with given userid.
|
||||
* "l" - ignore case sensitivity. */
|
||||
native find_player(const flags[], ... );
|
||||
|
||||
/* Removes quotes from sentence. */
|
||||
native remove_quotes(text[]);
|
||||
|
||||
/* Executes command on player. */
|
||||
native client_cmd(index,const command[],{Float,_}:...);
|
||||
|
||||
/* This is an emulation of a client command (commands aren't send to client!).
|
||||
* It allows to execute some commands on players and bots.
|
||||
* Function is excellent for forcing to do an action related to a game (not settings!).
|
||||
* The command must stand alone but in arguments you can use spaces. */
|
||||
native engclient_cmd(index,const command[],arg1[]="",arg2[]="");
|
||||
|
||||
/* Executes command on a server console. */
|
||||
native server_cmd(const command[],{Float,_}:...);
|
||||
|
||||
/* Sets a cvar to given value. */
|
||||
native set_cvar_string(const cvar[],const value[]);
|
||||
|
||||
/* If a cvar exists returns 1, in other case 0 */
|
||||
native cvar_exists(const cvar[]);
|
||||
|
||||
/* Removes a cvar flags (not allowed for amx_version,
|
||||
* fun_version and sv_cheats cvars). */
|
||||
native remove_cvar_flags(const cvar[],flags = -1);
|
||||
|
||||
/* Sets a cvar flags (not allowed for amx_version,
|
||||
* fun_version and sv_cheats cvars). */
|
||||
native set_cvar_flags(const cvar[],flags);
|
||||
|
||||
/* Returns a cvar flags. */
|
||||
native get_cvar_flags(const cvar[]);
|
||||
|
||||
/* Sets a cvar to given float. */
|
||||
native set_cvar_float(const cvar[],Float:value);
|
||||
|
||||
/* Gets a cvar float. */
|
||||
native Float:get_cvar_float(const cvarname[]);
|
||||
|
||||
/* Gets a cvar integer value. */
|
||||
native get_cvar_num(const cvarname[]);
|
||||
|
||||
/* Sets a cvar with integer value. */
|
||||
native set_cvar_num(const cvarname[],value);
|
||||
|
||||
/* Reads a cvar value. */
|
||||
native get_cvar_string(const cvarname[],output[],iLen);
|
||||
|
||||
/* Returns a name of currently played map. */
|
||||
native get_mapname(name[],len);
|
||||
|
||||
/* Returns time remaining on map in seconds. */
|
||||
native get_timeleft();
|
||||
|
||||
/* Returns a game time. */
|
||||
native Float:get_gametime();
|
||||
|
||||
/* Returns maxplayers setting. */
|
||||
native get_maxplayers();
|
||||
|
||||
/* Returns a name of currently played mod. */
|
||||
native get_modname(name[],len);
|
||||
|
||||
/* Returns time in given format. The most popular is: "%m/%d/%Y - %H:%M:%S". */
|
||||
native get_time(const format[],output[],len);
|
||||
|
||||
/* Returns time in given format. The most popular is: "%m/%d/%Y - %H:%M:%S".
|
||||
* Last parameter sets time to format. */
|
||||
native format_time(output[],len, const format[],time = -1);
|
||||
|
||||
/* Returns system time in seconds elapsed since 00:00:00 on January 1, 1970.
|
||||
* Offset is given in seconds.*/
|
||||
native get_systime(offset = 0);
|
||||
|
||||
/* Returns time in input and additionaly fills missing information
|
||||
* with current time and date. If time is different than -1 then parsed
|
||||
* time is added to given time.
|
||||
* Example:
|
||||
* parset_time( "10:32:54 04/02/2003", "%H:%M:%S %m:%d:%Y" )
|
||||
* For more information see strptime(...) function from C libraries. */
|
||||
native parse_time(const input[],const format[], time = -1);
|
||||
|
||||
/* Calls function on specified time.
|
||||
* Flags:
|
||||
* "a" - repeat.
|
||||
* "b" - loop task.
|
||||
* "c" - do task on time after a map timeleft.
|
||||
* "d" - do task on time before a map timelimit. */
|
||||
native set_task(Float:time,const function[],id = 0,parameter[]="",len = 0,flags[]="", repeat = 0);
|
||||
|
||||
/* Removes all tasks with given id. If outside var is
|
||||
* set then a task can be removed also when
|
||||
* was set in another plugin. */
|
||||
native remove_task(id = 0, outside = 0);
|
||||
|
||||
/* Returns 1 if task under given id exists. */
|
||||
native task_exists(id = 0, outside = 0);
|
||||
|
||||
/* Sets flags for player. Set flags to -1 if you want to clear all flags.
|
||||
* You can use different settings by changing the id, which is from range 0 - 31. */
|
||||
native set_user_flags(index,flags=-1,id=0);
|
||||
|
||||
/* Gets flags from player. Set index to 0 if you want to read flags from server. */
|
||||
native get_user_flags(index,id=0);
|
||||
|
||||
/* Removes flags for player. */
|
||||
native remove_user_flags(index,flags=-1,id=0);
|
||||
|
||||
/* Registers function which will be called from client console. */
|
||||
native register_clcmd(const client_cmd[],const function[],flags=-1, info[]="");
|
||||
|
||||
/* Registers function which will be called from any console. */
|
||||
native register_concmd(const cmd[],const function[],flags=-1, info[]="");
|
||||
|
||||
/* Registers function which will be called from server console. */
|
||||
native register_srvcmd(const server_cmd[],const function[],flags=-1, info[]="");
|
||||
|
||||
/* Gets info about client command. */
|
||||
native get_clcmd(index, command[], len1, &flags, info[], len2, flag);
|
||||
|
||||
/* Returns number of registered client commands. */
|
||||
native get_clcmdsnum(flag);
|
||||
|
||||
/* Gets info about server command. */
|
||||
native get_srvcmd(index,server_cmd[],len1,&flags, info[],len2, flag);
|
||||
|
||||
/* Returns number of registered server commands. */
|
||||
native get_srvcmdsnum(flag);
|
||||
|
||||
/* Gets info about console command. If id is set to 0,
|
||||
then function returns only server cmds, if positive then
|
||||
returns only client cmds. in other case returns all console commands. */
|
||||
native get_concmd(index,cmd[],len1,&flags, info[],len2, flag, id = -1);
|
||||
|
||||
/* Returns number of registered console commands. */
|
||||
native get_concmdsnum(flag,id = -1);
|
||||
|
||||
/* Gets unique id of menu. Outside set to 1 allows
|
||||
* to catch menus outside a plugin where register_menuid is called. */
|
||||
native register_menuid(const menu[], outside=0 );
|
||||
|
||||
/* Calls function when player uses specified menu and proper keys. */
|
||||
native register_menucmd(menuid,keys, const function[] );
|
||||
|
||||
/* Gets what menu the player is watching and what keys for menu he have.
|
||||
* When there is no menu the index is 0. If the id is negative then the menu
|
||||
* is VGUI in other case the id is from register_menuid() function. */
|
||||
native get_user_menu(index,&id,&keys);
|
||||
|
||||
/* Forces server to execute sent server command at current time.
|
||||
* Very useful for map changes, setting cvars and other activities. */
|
||||
native server_exec();
|
||||
|
||||
/* Emits sound. Sample must be precached. */
|
||||
native emit_sound(index, channel, sample[], Float:vol, Float:att,flags, pitch);
|
||||
|
||||
/* Returns distance between two vectors. */
|
||||
native get_distance(origin1[3],origin2[3]);
|
||||
|
||||
/* Registers new cvar for HL engine. */
|
||||
native register_cvar(const name[],const string[],flags = 0,Float:fvalue = 0.0);
|
||||
|
||||
/* Generates random floating point number from a to b. */
|
||||
native Float:random_float(Float:a,Float:b);
|
||||
|
||||
/* Generates random integer from a to b. */
|
||||
native random_num(a,b);
|
||||
|
||||
/* Pauses function or plugin so it won't be executed.
|
||||
* In most cases param1 is name of function and
|
||||
* param2 name of plugin (all depends on flags).
|
||||
* Flags:
|
||||
* "a" - pause whole plugin.
|
||||
* "b" - pause function.
|
||||
* "c" - look outside the plugin (by given plugin name).
|
||||
* "d" - set "stopped" status when pausing whole plugin.
|
||||
* "e" - set "locked" status when pausing whole plugin.
|
||||
* In this status plugin is unpauseable.
|
||||
* Example: pause("ac","myplugin.amx")
|
||||
* pause("bc","myfunc","myplugin.amx") */
|
||||
native pause(flag[], const param1[]="",const param2[]="");
|
||||
|
||||
/* Unpauses function or plugin.
|
||||
* Flags:
|
||||
* "a" - unpause whole plugin.
|
||||
* "b" - unpause function.
|
||||
* "c" - look outside the plugin (by given plugin name). */
|
||||
native unpause(flag[], const param1[]="",const param2[]="");
|
||||
|
||||
/* Returns id of client message.
|
||||
* Example: get_user_msgid("TextMsg"). */
|
||||
native get_user_msgid(const name[]);
|
||||
|
||||
/* These functinos are used to generate client messages.
|
||||
* You may generate menu, smoke, shockwaves, thunderlights,
|
||||
* intermission and many many others messages.
|
||||
* See HL SDK for more examples. */
|
||||
native message_begin( dest, msg_type, origin[3]={0,0,0},player=0);
|
||||
native message_end();
|
||||
native write_byte( x );
|
||||
native write_char( x );
|
||||
native write_short( x );
|
||||
native write_long( x );
|
||||
native write_entity( x );
|
||||
native write_angle( x );
|
||||
native write_coord( x );
|
||||
native write_string( x[] );
|
||||
|
||||
/* Called on inconsistent file. You can put any text
|
||||
* into reason to change an original message. */
|
||||
forward inconsistent_file(id,const filename[], reason[64] );
|
||||
|
||||
/* Forces the client and server to be running with the same
|
||||
* version of the specified file ( e.g., a player model ). */
|
||||
native force_unmodified(force_type, mins[3] , maxs[3], const filename[]);
|
||||
|
||||
/* Checks if public variable with given name exists in loaded plugins. */
|
||||
native xvar_exists( const name[] );
|
||||
|
||||
/* Returns an unique id for public variable specified by name. If such
|
||||
* variable doesn't exist then returned value is -1. */
|
||||
native get_xvar_id( const name[] );
|
||||
|
||||
/* Returns an integer value of a public variable. Id is a value
|
||||
* returned by get_xvar_id(...) native. */
|
||||
native get_xvar_num( id );
|
||||
|
||||
/* Returns a float value of a public variable. Id is a value
|
||||
* returned by get_xvar_id(...) native. */
|
||||
native Float:get_xvar_float( id );
|
||||
|
||||
/* Sets a value of a public variable. Id is a value
|
||||
* returned by get_xvar_id(...) native. */
|
||||
native set_xvar_num( id, value = 0 );
|
||||
|
||||
/* Sets a float value of a public variable. Id is a value
|
||||
* returned by get_xvar_id(...) native. */
|
||||
native set_xvar_float( id, Float:value = 0.0 );
|
39
plugins/include/core.inc
Executable file
39
plugins/include/core.inc
Executable file
@@ -0,0 +1,39 @@
|
||||
/* Core functions
|
||||
*
|
||||
* (c) Copyright 1998-2002, ITB CompuPhase
|
||||
* This file is provided as is (no warranties).
|
||||
*/
|
||||
#if defined _core_included
|
||||
#endinput
|
||||
#endif
|
||||
#define _core_included
|
||||
|
||||
native heapspace();
|
||||
|
||||
native funcidx(const name[]);
|
||||
|
||||
native numargs();
|
||||
native getarg(arg, index=0);
|
||||
native setarg(arg, index=0, value);
|
||||
|
||||
native strlen(const string[]);
|
||||
native strpack(dest[], const source[]);
|
||||
native strunpack(dest[], const source[]);
|
||||
|
||||
native tolower(c);
|
||||
native toupper(c);
|
||||
native swapchars(c);
|
||||
|
||||
native random(max);
|
||||
|
||||
native min(value1, value2);
|
||||
native max(value1, value2);
|
||||
native clamp(value, min=cellmin, max=cellmax);
|
||||
|
||||
native power(value, exponent);
|
||||
native sqroot(value);
|
||||
|
||||
native time(&hour=0,&minute=0,&second=0);
|
||||
native date(&year=0,&month=0,&day=0);
|
||||
|
||||
native tickcount(&granularity=0);
|
55
plugins/include/csstats.inc
Executable file
55
plugins/include/csstats.inc
Executable file
@@ -0,0 +1,55 @@
|
||||
/* CS Stats functions
|
||||
*
|
||||
* (c) 2002-2003, OLO
|
||||
* This file is provided as is (no warranties).
|
||||
*/
|
||||
|
||||
#if defined _csstats_included
|
||||
#endinput
|
||||
#endif
|
||||
#define _csstats_included
|
||||
|
||||
/* Gets stats from given weapon index. If wpnindex is 0
|
||||
* then the stats are from all weapons. If weapon has not been used function
|
||||
* returns 0 in other case 1. Fields in stats are:
|
||||
* 0 - kills
|
||||
* 1 - deaths
|
||||
* 2 - headshots
|
||||
* 3 - teamkilling
|
||||
* 4 - shots
|
||||
* 5 - hits
|
||||
* 6 - damage
|
||||
* For body hits fields see amxconst.inc. */
|
||||
native get_user_wstats(index,wpnindex,stats[8],bodyhits[8]);
|
||||
|
||||
/* Gets round stats from given weapon index.*/
|
||||
native get_user_wrstats(index,wpnindex,stats[8],bodyhits[8]);
|
||||
|
||||
/* Gets overall stats which are stored in file on server
|
||||
* and updated on every respawn or user disconnect.
|
||||
* Function returns the position in stats by diff. kills to deaths. */
|
||||
native get_user_stats(index,stats[8],bodyhits[8]);
|
||||
|
||||
/* Gets round stats of player. */
|
||||
native get_user_rstats(index,stats[8],bodyhits[8]);
|
||||
|
||||
/* Gets stats with which user have killed/hurt his victim. If victim is 0
|
||||
* then stats are from all victims. If victim has not been hurt, function
|
||||
* returns 0 in other case 1. User stats are reset on his respawn. */
|
||||
native get_user_vstats(index,victim,stats[8],bodyhits[8],wpnname[]="",len=0);
|
||||
|
||||
/* Gets stats with which user have been killed/hurt. If killer is 0
|
||||
* then stats are from all attacks. If killer has not hurt user, function
|
||||
* returns 0 in other case 1. User stats are reset on his respawn. */
|
||||
native get_user_astats(index,wpnindex,stats[8],bodyhits[8],wpnname[]="",len=0);
|
||||
|
||||
/* Resets life, weapon, victims and attackers user stats. */
|
||||
native reset_user_wstats(index);
|
||||
|
||||
/* Gets overall stats which stored in stats.dat file in amx folder
|
||||
* and updated on every mapchange or user disconnect.
|
||||
* Function returns next index of stats entry or 0 if no more exists. */
|
||||
native get_stats(index,stats[8],bodyhits[8],name[],len);
|
||||
|
||||
/* Returns number of all entries in stats. */
|
||||
native get_statsnum();
|
34
plugins/include/file.inc
Executable file
34
plugins/include/file.inc
Executable file
@@ -0,0 +1,34 @@
|
||||
/* Files functions
|
||||
*
|
||||
* (c) 2002-2003, OLO
|
||||
* This file is provided as is (no warranties).
|
||||
*/
|
||||
|
||||
#if defined _file_included
|
||||
#endinput
|
||||
#endif
|
||||
#define _file_included
|
||||
|
||||
|
||||
/* Reads content from directory.
|
||||
* Returns index of next element or 0 when end of dir. is reached. */
|
||||
native read_dir(const dirname[],pos,output[],len,&outlen);
|
||||
|
||||
/* Reads line from file. Returns index of next line or 0 when end of file is reached. */
|
||||
native read_file(const file[],line,text[],len,&txtlen);
|
||||
|
||||
/* Writes text to file. Function returns 0 on failure.
|
||||
* When line is set to -1, the text is added at the end of file. */
|
||||
native write_file(const file[],const text[],line = -1);
|
||||
|
||||
/* Deletes file. Function returns 1 on success, 0 on failure. */
|
||||
native delete_file(const file[]);
|
||||
|
||||
/* Checks for file. If file exists function returns 1, in other case 0. */
|
||||
native file_exists(const file[]);
|
||||
|
||||
/* Returns a file size in bytes if flag is set to 0.
|
||||
When flag is set to 1 returns number of lines in the file,
|
||||
and when flags is 2, function returns 1 if the file ends
|
||||
with line feed. If file doesn't exist returns -1.*/
|
||||
native file_size(const file[], flag=0);
|
122
plugins/include/float.inc
Executable file
122
plugins/include/float.inc
Executable file
@@ -0,0 +1,122 @@
|
||||
/* Float arithmetic
|
||||
*
|
||||
* (c) Copyright 1999, Artran, Inc.
|
||||
* Written by Greg Garner (gmg@artran.com)
|
||||
* Modified in March 2001 to include user defined
|
||||
* operators for the floating point functions.
|
||||
*
|
||||
* This file is provided as is (no warranties).
|
||||
*/
|
||||
|
||||
#if defined _float_included
|
||||
#endinput
|
||||
#endif
|
||||
#define _float_included
|
||||
|
||||
native Float:float(value);
|
||||
native Float:floatstr(const string[]);
|
||||
native Float:floatmul(Float:oper1, Float:oper2);
|
||||
native Float:floatdiv(Float:dividend, Float:divisor);
|
||||
native Float:floatadd(Float:dividend, Float:divisor);
|
||||
native Float:floatsub(Float:oper1, Float:oper2);
|
||||
native Float:floatfract(Float:value);
|
||||
|
||||
enum floatround_method {
|
||||
floatround_round,
|
||||
floatround_floor,
|
||||
floatround_ceil
|
||||
}
|
||||
|
||||
native floatround(Float:value, floatround_method:method=floatround_round);
|
||||
native floatcmp(Float:fOne, Float:fTwo);
|
||||
|
||||
#pragma rational Float
|
||||
|
||||
/* user defined operators */
|
||||
native Float:operator*(Float:oper1, Float:oper2) = floatmul;
|
||||
native Float:operator/(Float:oper1, Float:oper2) = floatdiv;
|
||||
native Float:operator+(Float:oper1, Float:oper2) = floatadd;
|
||||
native Float:operator-(Float:oper1, Float:oper2) = floatsub;
|
||||
|
||||
stock Float:operator++(Float:oper)
|
||||
return oper+1.0;
|
||||
|
||||
stock Float:operator--(Float:oper)
|
||||
return oper-1.0;
|
||||
|
||||
stock Float:operator-(Float:oper)
|
||||
return oper^Float:0x80000000; /* IEEE values are sign/magnitude */
|
||||
|
||||
stock Float:operator*(Float:oper1, oper2)
|
||||
return floatmul(oper1, float(oper2)); /* "*" is commutative */
|
||||
|
||||
stock Float:operator/(Float:oper1, oper2)
|
||||
return floatdiv(oper1, float(oper2));
|
||||
|
||||
stock Float:operator/(oper1, Float:oper2)
|
||||
return floatdiv(float(oper1), oper2);
|
||||
|
||||
stock Float:operator+(Float:oper1, oper2)
|
||||
return floatadd(oper1, float(oper2)); /* "+" is commutative */
|
||||
|
||||
stock Float:operator-(Float:oper1, oper2)
|
||||
return floatsub(oper1, float(oper2));
|
||||
|
||||
stock Float:operator-(oper1, Float:oper2)
|
||||
return floatsub(float(oper1), oper2);
|
||||
|
||||
stock bool:operator==(Float:oper1, Float:oper2)
|
||||
return floatcmp(oper1, oper2) == 0;
|
||||
|
||||
stock bool:operator==(Float:oper1, oper2)
|
||||
return floatcmp(oper1, float(oper2)) == 0; /* "==" is commutative */
|
||||
|
||||
stock bool:operator!=(Float:oper1, Float:oper2)
|
||||
return floatcmp(oper1, oper2) != 0;
|
||||
|
||||
stock bool:operator!=(Float:oper1, oper2)
|
||||
return floatcmp(oper1, float(oper2)) != 0; /* "==" is commutative */
|
||||
|
||||
stock bool:operator>(Float:oper1, Float:oper2)
|
||||
return floatcmp(oper1, oper2) > 0;
|
||||
|
||||
stock bool:operator>(Float:oper1, oper2)
|
||||
return floatcmp(oper1, float(oper2)) > 0;
|
||||
|
||||
stock bool:operator>(oper1, Float:oper2)
|
||||
return floatcmp(float(oper1), oper2) > 0;
|
||||
|
||||
stock bool:operator>=(Float:oper1, Float:oper2)
|
||||
return floatcmp(oper1, oper2) >= 0;
|
||||
|
||||
stock bool:operator>=(Float:oper1, oper2)
|
||||
return floatcmp(oper1, float(oper2)) >= 0;
|
||||
|
||||
stock bool:operator>=(oper1, Float:oper2)
|
||||
return floatcmp(float(oper1), oper2) >= 0;
|
||||
|
||||
stock bool:operator<(Float:oper1, Float:oper2)
|
||||
return floatcmp(oper1, oper2) < 0;
|
||||
|
||||
stock bool:operator<(Float:oper1, oper2)
|
||||
return floatcmp(oper1, float(oper2)) < 0;
|
||||
|
||||
stock bool:operator<(oper1, Float:oper2)
|
||||
return floatcmp(float(oper1), oper2) < 0;
|
||||
|
||||
stock bool:operator<=(Float:oper1, Float:oper2)
|
||||
return floatcmp(oper1, oper2) <= 0;
|
||||
|
||||
stock bool:operator<=(Float:oper1, oper2)
|
||||
return floatcmp(oper1, float(oper2)) <= 0;
|
||||
|
||||
stock bool:operator<=(oper1, Float:oper2)
|
||||
return floatcmp(float(oper1), oper2) <= 0;
|
||||
|
||||
stock bool:operator!(Float:oper)
|
||||
return floatcmp(oper, 0.0) == 0;
|
||||
|
||||
/* forbidden operations */
|
||||
forward operator%(Float:oper1, Float:oper2);
|
||||
forward operator%(Float:oper1, oper2);
|
||||
forward operator%(oper1, Float:oper2);
|
86
plugins/include/fun.inc
Executable file
86
plugins/include/fun.inc
Executable file
@@ -0,0 +1,86 @@
|
||||
/* Fun functions
|
||||
*
|
||||
* (c) 2002-2003, OLO
|
||||
* This file is provided as is (no warranties).
|
||||
*/
|
||||
|
||||
#if defined _fun_included
|
||||
#endinput
|
||||
#endif
|
||||
#define _fun_included
|
||||
|
||||
/* Sets who can listen who. Function returns 0
|
||||
* if for some reasons this setting can't be done. */
|
||||
native set_user_listening(receiver,sender,listen);
|
||||
|
||||
/* Returns 1 if receiver hears sender via voice communication. */
|
||||
native get_user_listening(receiver,sender);
|
||||
|
||||
/* Sets player godmode. If you want to disable godmode set only first parameter. */
|
||||
native set_user_godmode(index,godmode = 0);
|
||||
|
||||
/* Returns 1 if godmode is set. */
|
||||
native get_user_godmode(index);
|
||||
|
||||
/* Sets player noclip. If you want to disable noclip set only first parameter. */
|
||||
native set_user_noclip(index,noclip = 0);
|
||||
|
||||
/* Returns 1 if noclip is set. */
|
||||
native get_user_noclip(index);
|
||||
|
||||
/* Sets player frags. */
|
||||
native set_user_frags(index,frags);
|
||||
|
||||
/* Sets player armor. */
|
||||
native set_user_armor(index,armor);
|
||||
|
||||
/* Sets player health. */
|
||||
native set_user_health(index, health);
|
||||
|
||||
/* Move player to origin. */
|
||||
native set_user_origin(index, origin[3]);
|
||||
|
||||
/* Sets player rendering mode. */
|
||||
native set_user_rendering(index,fx = kRenderFxNone, r=255,g=255,b=255, render = kRenderNormal,amount=16);
|
||||
|
||||
/* Gives item to player, name of item can start
|
||||
* with weapon_, ammo_ and item_. This event
|
||||
* is announced with proper message to all players. */
|
||||
native give_item(index,const item[]);
|
||||
|
||||
/* Sets hit zones for player. This event is announced
|
||||
* with proper message to all players.
|
||||
* Parts of body are as bits:
|
||||
* 2 - head
|
||||
* 4 - chest
|
||||
* 8 - stomach
|
||||
* 16 - left arm
|
||||
* 32 - right arm
|
||||
* 64 - left leg
|
||||
* 128 - right leg*/
|
||||
native set_user_hitzones(index=0,target=0,body=255);
|
||||
|
||||
/* Returns hit zones for player. */
|
||||
native get_user_hitzones(index,target);
|
||||
|
||||
/* Makes that player spawns. This event is announced
|
||||
* with proper message to all players. */
|
||||
native user_spawn(index);
|
||||
|
||||
/* Sets users max. speed. */
|
||||
native set_user_maxspeed(index,Float:speed=-1.0);
|
||||
|
||||
/* Returns users max. speed. */
|
||||
native Float:get_user_maxspeed(index);
|
||||
|
||||
/* Sets users gravity. */
|
||||
native set_user_gravity(index,Float:gravity=1.0);
|
||||
|
||||
/* Returns users gravity. */
|
||||
native Float:get_user_gravity(index);
|
||||
|
||||
/* Gives money to user. */
|
||||
native set_user_money(index,money,flash=1);
|
||||
|
||||
/* Returns users money. */
|
||||
native get_user_money(index);
|
30
plugins/include/mysql.inc
Executable file
30
plugins/include/mysql.inc
Executable file
@@ -0,0 +1,30 @@
|
||||
/* MySQL functions
|
||||
*
|
||||
* (c) Copyright 2002, dJeyL
|
||||
* This file is provided as is (no warranties).
|
||||
*/
|
||||
|
||||
#if defined _mysql_included
|
||||
#endinput
|
||||
#endif
|
||||
#define _mysql_included
|
||||
|
||||
/* Opens connection. If already such exists then that will be used.
|
||||
* Function returns sql id to use with other sql natives.
|
||||
* Host can be plain ip or with port seperated with ':' char. */
|
||||
native mysql_connect(host[],user[],pass[],dbname[],error[],maxlength);
|
||||
|
||||
/* Uses an existing connection (sql) to perform a new query (query) (might close previous query if any). */
|
||||
native mysql_query(sql,query[]);
|
||||
|
||||
/* Prepares next row of current query (sql) for read access ; returns the number of the row, 0 at end. */
|
||||
native mysql_nextrow(sql);
|
||||
|
||||
/* Stores specified column (fieldnum) of current query (sql) in (dest) with (maxlength) characters maximum. */
|
||||
native mysql_getfield(sql,fieldnum,dest[],maxlength);
|
||||
|
||||
/* Clears query (sql) and closes connection (if any other plugin doesn't use it). */
|
||||
native mysql_close(sql);
|
||||
|
||||
/* Stores last error of current query/connection (sql) in (dest) with (maxlength) characters maximum. */
|
||||
native mysql_error(sql,dest[],maxlength);
|
85
plugins/include/string.inc
Executable file
85
plugins/include/string.inc
Executable file
@@ -0,0 +1,85 @@
|
||||
/* Strings manipulation
|
||||
*
|
||||
* (c) 2002-2003, OLO
|
||||
* This file is provided as is (no warranties).
|
||||
*/
|
||||
|
||||
#if defined _string_included
|
||||
#endinput
|
||||
#endif
|
||||
#define _string_included
|
||||
|
||||
/* Checks if source contains string. On success function
|
||||
* returns position in source, on failure returns -1. */
|
||||
native contain(const source[],const string[]);
|
||||
|
||||
/* Checks if source contains string with case ignoring. On success function
|
||||
* returns position in source, on failure returns -1. */
|
||||
native containi(const source[],const string[]);
|
||||
|
||||
/* Replaces given string to another in given text. */
|
||||
native replace(text[],len,const what[],const with[]);
|
||||
|
||||
/* Adds one string to another. Last parameter different from 0, specifies
|
||||
* how many chars we want to add. Function returns number of all merged chars. */
|
||||
native add(dest[],len,const src[],max=0);
|
||||
|
||||
/* Fills string with given format and parameters.
|
||||
* Function returns number of copied chars.
|
||||
* Example: format(dest,"Hello %s. You are %d years old","Tom",17). */
|
||||
native format(output[] ,len ,const format[] , {Float,_}:...);
|
||||
|
||||
/* Gets parameters from function as formated string. */
|
||||
native format_args(output[] ,len ,pos = 0);
|
||||
|
||||
/* Converts number to string. */
|
||||
native num_to_str(num,string[],len);
|
||||
native numtostr(num,string[],len);
|
||||
|
||||
/* Returns converted string to number. */
|
||||
native str_to_num(const string[]);
|
||||
native strtonum(const string[]);
|
||||
|
||||
/* Checks if two strings equal. If len var is set
|
||||
* then there are only c chars comapred. */
|
||||
native equal(const a[],const b[],c=0);
|
||||
|
||||
/* Checks if two strings equal with case ignoring.
|
||||
* If len var is set then there are only c chars comapred. */
|
||||
native equali(const a[],const b[],c=0);
|
||||
|
||||
/* Copies one string to another. By len var
|
||||
* you may specify max. number of chars to copy. */
|
||||
native copy(dest[],len,const src[]);
|
||||
|
||||
/* Copies one string to another until char ch is found.
|
||||
* By len var you may specify max. number of chars to copy. */
|
||||
native copyc(dest[],len,const src[],ch);
|
||||
|
||||
/* Sets string with given character. */
|
||||
native setc(src[],len,ch);
|
||||
|
||||
/* Gets parameters from text.
|
||||
* Example: to split text: "^"This is^" the best year",
|
||||
* call function like this: parse(text,arg1,len1,arg2,len2,arg3,len3,arg4,len4)
|
||||
* and you will get: "This is", "the", "best", "year"
|
||||
* Function returns number of parsed parameters. */
|
||||
native parse(const text[], ... );
|
||||
|
||||
/* Converts all chars in string to lower case. */
|
||||
native strtolower(string[]);
|
||||
|
||||
/* Converts all chars in string to upper case. */
|
||||
native strtoupper(string[]);
|
||||
|
||||
/* Returns true when value is digit. */
|
||||
native isdigit(ch);
|
||||
|
||||
/* Returns true when value is letter. */
|
||||
native isalpha(ch);
|
||||
|
||||
/* Returns true when value is space. */
|
||||
native isspace(ch);
|
||||
|
||||
/* Returns true when value is letter or digit. */
|
||||
native isalnum(ch);
|
24
plugins/include/vault.inc
Executable file
24
plugins/include/vault.inc
Executable file
@@ -0,0 +1,24 @@
|
||||
/* Vault
|
||||
*
|
||||
* (c) 2002-2003, OLO
|
||||
* This file is provided as is (no warranties).
|
||||
*/
|
||||
|
||||
#if defined _vault_included
|
||||
#endinput
|
||||
#endif
|
||||
#define _vault_included
|
||||
|
||||
/* Reads a data from given key.
|
||||
* If len is set to zero then get_vaultdata
|
||||
* returns value as an number. */
|
||||
native get_vaultdata(const key[], data[] = "", len = 0);
|
||||
|
||||
/* Sets a data under given key. */
|
||||
native set_vaultdata(const key[], const data[] = "" );
|
||||
|
||||
/* Removes a key from vault.*/
|
||||
native remove_vaultdata(const key[]);
|
||||
|
||||
/* Checks if a key exists in the vault.*/
|
||||
native vaultdata_exists(const key[]);
|
191
plugins/mapchooser.sma
Executable file
191
plugins/mapchooser.sma
Executable file
@@ -0,0 +1,191 @@
|
||||
/* AMX Mod script.
|
||||
*
|
||||
* (c) 2002-2003, OLO
|
||||
* This file is provided as is (no warranties).
|
||||
*
|
||||
* On two minutes before the timelimit plugin
|
||||
* displays menu with 5 random maps to select.
|
||||
* One of the options is also map extending.
|
||||
* Map with most votes becomes the nextmap.
|
||||
*
|
||||
* Maps to selected are in maps.ini file.
|
||||
*
|
||||
* Cvars:
|
||||
* amx_extendmap_max <time in mins.> - max. time for overall extending
|
||||
* amx_extendmap_step <time in mins.> - with what time the map will be extended
|
||||
*
|
||||
* NOTE: Nextmap plugin is required for proper working of this plugin.
|
||||
*/
|
||||
|
||||
#include <amxmod>
|
||||
#include <amxmisc>
|
||||
|
||||
#define MAX_MAPS 128
|
||||
#define SELECTMAPS 5
|
||||
|
||||
new g_mapName[MAX_MAPS][32]
|
||||
new g_mapNums
|
||||
|
||||
new g_nextName[SELECTMAPS]
|
||||
new g_voteCount[SELECTMAPS+2]
|
||||
new g_mapVoteNum
|
||||
new g_teamScore[2]
|
||||
new g_lastMap[32]
|
||||
|
||||
new g_cstrikeRunning
|
||||
new bool:g_selected = false
|
||||
new g_logFile[16]
|
||||
|
||||
public plugin_init()
|
||||
{
|
||||
register_plugin("Nextmap chooser","0.9","default")
|
||||
register_menucmd(register_menuid("AMX Choose nextmap:"),(-1^(-1<<(SELECTMAPS+2))),"countVote")
|
||||
register_cvar("amx_extendmap_max","90")
|
||||
register_cvar("amx_extendmap_step","15")
|
||||
|
||||
if ( ( g_cstrikeRunning = is_running("cstrike") ) != 0 )
|
||||
register_event("TeamScore", "team_score", "a")
|
||||
|
||||
get_localinfo("lastMap",g_lastMap,31)
|
||||
set_localinfo("lastMap","")
|
||||
get_logfile(g_logFile,15)
|
||||
|
||||
new filename[64]
|
||||
build_path( filename , 63 , "$basedir/maps.ini" )
|
||||
if ( loadSettings( filename ) )
|
||||
set_task(15.0,"voteNextmap",987456,"",0,"b")
|
||||
}
|
||||
|
||||
public checkVotes(){
|
||||
new b = 0
|
||||
for(new a = 0; a < g_mapVoteNum; ++a)
|
||||
if (g_voteCount[b] < g_voteCount[a])
|
||||
b = a
|
||||
if ( g_voteCount[SELECTMAPS] > g_voteCount[b] ) {
|
||||
new mapname[32]
|
||||
get_mapname(mapname,31)
|
||||
new Float:steptime = get_cvar_float("amx_extendmap_step")
|
||||
set_cvar_float("mp_timelimit", get_cvar_float("mp_timelimit") + steptime )
|
||||
client_print(0,print_chat,"Choosing finished. Current map will be extended to next %.0f minutes", steptime )
|
||||
log_to_file(g_logFile,"Vote: Voting for the nextmap finished. Map %s will be extended to next %.0f minutes",
|
||||
mapname , steptime )
|
||||
return
|
||||
}
|
||||
if ( g_voteCount[b] && g_voteCount[SELECTMAPS+1] <= g_voteCount[b] )
|
||||
set_cvar_string("amx_nextmap", g_mapName[g_nextName[b]] )
|
||||
new smap[32]
|
||||
get_cvar_string("amx_nextmap",smap,31)
|
||||
client_print(0,print_chat,"Choosing finished. The nextmap will be %s", smap )
|
||||
log_to_file(g_logFile,"Vote: Voting for the nextmap finished. The nextmap will be %s", smap)
|
||||
}
|
||||
|
||||
public countVote(id,key){
|
||||
if ( get_cvar_float("amx_vote_answers") ) {
|
||||
new name[32]
|
||||
get_user_name(id,name,31)
|
||||
if ( key == SELECTMAPS )
|
||||
client_print(0,print_chat,"%s chose map extending", name )
|
||||
else if ( key < SELECTMAPS )
|
||||
client_print(0,print_chat,"%s chose %s", name, g_mapName[g_nextName[key]] )
|
||||
}
|
||||
++g_voteCount[key]
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
|
||||
bool:isInMenu(id){
|
||||
for(new a=0; a<g_mapVoteNum; ++a)
|
||||
if (id==g_nextName[a])
|
||||
return true
|
||||
return false
|
||||
}
|
||||
|
||||
public voteNextmap(){
|
||||
new winlimit = get_cvar_num("mp_winlimit")
|
||||
new maxrounds = get_cvar_num("mp_maxrounds")
|
||||
if ( winlimit ) {
|
||||
new c = winlimit - 2
|
||||
if ( (c > g_teamScore[0]) && (c > g_teamScore[1]) ) {
|
||||
g_selected = false
|
||||
return
|
||||
}
|
||||
}
|
||||
else if ( maxrounds ) {
|
||||
if ( (maxrounds - 2) > (g_teamScore[0] + g_teamScore[1]) ){
|
||||
g_selected = false
|
||||
return
|
||||
}
|
||||
}
|
||||
else {
|
||||
new timeleft = get_timeleft()
|
||||
if (timeleft<1||timeleft>129){
|
||||
g_selected = false
|
||||
return
|
||||
}
|
||||
}
|
||||
if (g_selected)
|
||||
return
|
||||
g_selected = true
|
||||
new menu[512], a, mkeys = (1<<SELECTMAPS+1)
|
||||
new pos = copy(menu,511,g_cstrikeRunning ? "\yAMX Choose nextmap:\w^n^n" : "AMX Choose nextmap:^n^n")
|
||||
new dmax = (g_mapNums > SELECTMAPS) ? SELECTMAPS : g_mapNums
|
||||
for(g_mapVoteNum = 0;g_mapVoteNum<dmax;++g_mapVoteNum){
|
||||
a=random_num(0,g_mapNums-1)
|
||||
while( isInMenu(a) )
|
||||
if (++a >= g_mapNums) a = 0
|
||||
g_nextName[g_mapVoteNum] = a
|
||||
pos += format(menu[pos],511,"%d. %s^n",g_mapVoteNum+1,g_mapName[a])
|
||||
mkeys |= (1<<g_mapVoteNum)
|
||||
g_voteCount[g_mapVoteNum] = 0
|
||||
}
|
||||
menu[pos++]='^n'
|
||||
g_voteCount[SELECTMAPS] = 0
|
||||
g_voteCount[SELECTMAPS+1] = 0
|
||||
new mapname[32]
|
||||
get_mapname(mapname,31)
|
||||
|
||||
if ( (winlimit + maxrounds)==0 && (get_cvar_float("mp_timelimit") < get_cvar_float("amx_extendmap_max"))){
|
||||
pos += format(menu[pos],511,"%d. Extend map %s^n",SELECTMAPS+1,mapname)
|
||||
mkeys |= (1<<SELECTMAPS)
|
||||
}
|
||||
|
||||
format(menu[pos],511,"%d. None",SELECTMAPS+2)
|
||||
show_menu(0,mkeys,menu,15)
|
||||
set_task(15.0,"checkVotes")
|
||||
client_print(0,print_chat,"It's time to choose the nextmap...")
|
||||
client_cmd(0,"spk Gman/Gman_Choose2")
|
||||
log_to_file(g_logFile,"Vote: Voting for the nextmap started")
|
||||
}
|
||||
|
||||
loadSettings(filename[])
|
||||
{
|
||||
if (!file_exists(filename)) return 0
|
||||
|
||||
new szText[32]
|
||||
new a, pos = 0
|
||||
new currentMap[32]
|
||||
get_mapname(currentMap,31)
|
||||
|
||||
while ( (g_mapNums < MAX_MAPS) && read_file(filename,pos++,szText,31,a) )
|
||||
{
|
||||
if ( szText[0] != ';'
|
||||
&& parse(szText, g_mapName[g_mapNums] ,31 )
|
||||
&& is_map_valid( g_mapName[g_mapNums] )
|
||||
&& !equali( g_mapName[g_mapNums] ,g_lastMap)
|
||||
&& !equali( g_mapName[g_mapNums] ,currentMap) )
|
||||
++g_mapNums
|
||||
}
|
||||
|
||||
return g_mapNums
|
||||
}
|
||||
|
||||
public team_score(){
|
||||
new team[2]
|
||||
read_data(1,team,1)
|
||||
g_teamScore[ (team[0]=='C') ? 0 : 1 ] = read_data(2)
|
||||
}
|
||||
|
||||
public plugin_end(){
|
||||
new current_map[32]
|
||||
get_mapname(current_map,31 )
|
||||
set_localinfo("lastMap",current_map)
|
||||
}
|
473
plugins/mapsmenu.sma
Executable file
473
plugins/mapsmenu.sma
Executable file
@@ -0,0 +1,473 @@
|
||||
/* AMX Mod script.
|
||||
*
|
||||
* (c) 2003, OLO
|
||||
* This file is provided as is (no warranties).
|
||||
*
|
||||
* Content for configuation copied from ClanMod cfg. file.
|
||||
*
|
||||
* Admin command:
|
||||
* amx_mapmenu - displays maps menu
|
||||
*
|
||||
* Example configuration in addons/amx/maps.ini
|
||||
|
||||
as_oilrig "OilRig - Assassination"
|
||||
as_tundra "Tundra - Assassination"
|
||||
de_aztec "Aztec - Bomb/Defuse"
|
||||
de_cbble "Cobble - Bomb/Defuse"
|
||||
de_chateau "Chateau - Bomb/Defuse"
|
||||
de_dust "Dust - Bomb/Defuse"
|
||||
de_dust2 "Dust II - Bomb/Defuse"
|
||||
de_inferno "Inferno - Bomb/Defuse"
|
||||
de_nuke "Nuke - Bomb/Defuse"
|
||||
de_prodigy "Prodigy - Bomb/Defuse"
|
||||
de_storm "Storm - Bomb/Defuse"
|
||||
de_survivor "Survivor - Bomb/Defuse"
|
||||
de_train "Trainyard - Bomb/Defuse"
|
||||
de_torn "Torn - Bomb/Defuse"
|
||||
de_vegas "Vegas - Bomb/Defuse"
|
||||
de_vertigo "Vertigo - Bomb/Defuse"
|
||||
cs_747 "747 Hijack - Hostage Rescue"
|
||||
cs_assault "Assault - Hostage Rescue"
|
||||
cs_backalley "Alleyway - Hostage Rescue"
|
||||
cs_estate "Zaphod's Estate - Hostage Rescue"
|
||||
cs_havana "Havana - Hostage Rescue"
|
||||
cs_italy "Italy - Hostage Rescue"
|
||||
cs_militia "Militia - Hostage Rescue"
|
||||
cs_office "The Office Complex - Hostage Rescue"
|
||||
cs_siege "Canyon Siege - Hostage Rescue"
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#include <amxmod>
|
||||
#include <amxmisc>
|
||||
|
||||
#define MAX_MAPS 64
|
||||
|
||||
new g_mapName[MAX_MAPS][32]
|
||||
new g_mapDesc[MAX_MAPS][32]
|
||||
new g_mapNums
|
||||
new g_menuPosition[33]
|
||||
new g_logFile[16]
|
||||
|
||||
new g_voteCount[5]
|
||||
|
||||
new g_voteSelected[33][4]
|
||||
new g_voteSelectedNum[33]
|
||||
|
||||
new g_cstrikeRunning
|
||||
|
||||
new g_choosed
|
||||
|
||||
public plugin_init()
|
||||
{
|
||||
register_plugin("Maps Menu","0.9","default")
|
||||
register_clcmd("amx_mapmenu","cmdMapsMenu",ADMIN_MAP,"- displays changelevel menu")
|
||||
register_clcmd("amx_votemapmenu","cmdVoteMapMenu",ADMIN_MAP,"- displays votemap menu")
|
||||
|
||||
register_menucmd(register_menuid("Changelevel Menu"),1023,"actionMapsMenu")
|
||||
register_menucmd(register_menuid("Which map do you want?"),527,"voteCount")
|
||||
register_menucmd(register_menuid("Change map to"),527,"voteCount")
|
||||
register_menucmd(register_menuid("Votemap Menu"),1023,"actionVoteMapMenu")
|
||||
register_menucmd(register_menuid("The winner: ") ,3,"actionResult")
|
||||
|
||||
new filename[64]
|
||||
build_path( filename , 63 , "$basedir/maps.ini" )
|
||||
load_settings( filename )
|
||||
|
||||
get_logfile(g_logFile,15)
|
||||
|
||||
g_cstrikeRunning = is_running("cstrike")
|
||||
}
|
||||
|
||||
new g_resultAck[] = "Result accepted"
|
||||
new g_resultRef[] = "Result refused"
|
||||
|
||||
public autoRefuse(){
|
||||
log_to_file(g_logFile,"Vote: %s" , g_resultRef)
|
||||
client_print(0,print_chat, g_resultRef )
|
||||
}
|
||||
|
||||
public actionResult(id,key) {
|
||||
remove_task( 4545454 )
|
||||
switch(key){
|
||||
case 0: {
|
||||
message_begin(MSG_ALL, SVC_INTERMISSION)
|
||||
message_end()
|
||||
set_task(2.0,"delayedChange",0, g_mapName[ g_choosed ] , strlen(g_mapName[ g_choosed ]) + 1 )
|
||||
log_to_file(g_logFile,"Vote: %s" , g_resultAck )
|
||||
client_print(0,print_chat, g_resultAck)
|
||||
}
|
||||
case 1: autoRefuse()
|
||||
}
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
|
||||
new g_voteSuccess[] = "Voting successful. Map will be changed to"
|
||||
new g_VoteFailed[] = "Voting failed"
|
||||
|
||||
public checkVotes( id )
|
||||
{
|
||||
id -= 34567
|
||||
new num, ppl[32],a = 0
|
||||
get_players(ppl,num,"c")
|
||||
if (num == 0) num = 1
|
||||
g_choosed = -1
|
||||
for(new i = 0; i < g_voteSelectedNum[id] ; ++i)
|
||||
if ( g_voteCount[a] < g_voteCount[i] )
|
||||
a = i
|
||||
if ( 100 * g_voteCount[a] / num > 50 ) {
|
||||
g_choosed = g_voteSelected[id][a]
|
||||
client_print(0,print_chat, "%s %s" , g_voteSuccess , g_mapName[ g_choosed ] )
|
||||
log_to_file(g_logFile,"Vote: %s %s" , g_voteSuccess , g_mapName[ g_choosed ] )
|
||||
}
|
||||
if ( g_choosed != -1 ) {
|
||||
if ( is_user_connected( id ) ) {
|
||||
new menuBody[512]
|
||||
new len = format(menuBody,511,g_cstrikeRunning ? "\yThe winner: \w%s^n^n" : "The winner: %s^n^n", g_mapName[ g_choosed ] )
|
||||
len += copy( menuBody[len] ,511 - len, g_cstrikeRunning ? "\yDo you want to continue?^n\w" : "Do you want to continue?^n" )
|
||||
copy( menuBody[len] ,511 - len, "^n1. Yes^n2. No")
|
||||
show_menu( id ,0x03 ,menuBody, 10 )
|
||||
set_task(10.0,"autoRefuse",4545454)
|
||||
}
|
||||
else {
|
||||
message_begin(MSG_ALL, SVC_INTERMISSION)
|
||||
message_end()
|
||||
set_task(2.0,"delayedChange",0, g_mapName[ g_choosed ] , strlen(g_mapName[ g_choosed ]) + 1 )
|
||||
}
|
||||
}
|
||||
else {
|
||||
client_print(0,print_chat, g_VoteFailed )
|
||||
log_to_file(g_logFile,"Vote: %s" , g_VoteFailed)
|
||||
}
|
||||
remove_task(34567 + id)
|
||||
}
|
||||
|
||||
public voteCount(id,key)
|
||||
{
|
||||
if (key > 3) {
|
||||
client_print(0,print_chat,"Voting has been canceled")
|
||||
remove_task(34567 + id)
|
||||
set_cvar_float( "amx_last_voting" , get_gametime() )
|
||||
log_to_file(g_logFile,"Vote: Cancel vote session")
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
if (get_cvar_float("amx_vote_answers")) {
|
||||
new name[32]
|
||||
get_user_name(id,name,31)
|
||||
client_print(0,print_chat,"%s voted for option #%d", name , key + 1 )
|
||||
}
|
||||
++g_voteCount[key]
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
|
||||
isMapSelected( id , pos )
|
||||
{
|
||||
for( new a = 0 ; a < g_voteSelectedNum[ id ]; ++a )
|
||||
if ( g_voteSelected[ id ][ a ] == pos )
|
||||
return 1
|
||||
return 0
|
||||
}
|
||||
|
||||
displayVoteMapsMenu(id,pos)
|
||||
{
|
||||
|
||||
if (pos < 0)
|
||||
return
|
||||
|
||||
new menuBody[512], b = 0 , start = pos * 7
|
||||
|
||||
if (start >= g_mapNums)
|
||||
start = pos = g_menuPosition[id] = 0
|
||||
|
||||
new len = format(menuBody,511, g_cstrikeRunning ?
|
||||
"\yVotemap Menu\R%d/%d^n\w^n" : "Votemap Menu %d/%d^n^n",
|
||||
pos+1,( g_mapNums / 7 + (( g_mapNums % 7) ? 1 : 0 )) )
|
||||
|
||||
new end = start + 7, keys = (1<<9)
|
||||
|
||||
if (end > g_mapNums)
|
||||
end = g_mapNums
|
||||
|
||||
for(new a = start; a < end; ++a)
|
||||
{
|
||||
if ( g_voteSelectedNum[id]==4 || isMapSelected( id , pos * 7 + b ) )
|
||||
{
|
||||
++b
|
||||
if ( g_cstrikeRunning)
|
||||
len += format(menuBody[len],511-len,"\d%d. %s^n\w", b ,g_mapDesc[ a ])
|
||||
else
|
||||
len += format(menuBody[len],511-len,"#. %s^n", g_mapDesc[ a ])
|
||||
}
|
||||
else
|
||||
{
|
||||
keys |= (1<<b)
|
||||
len += format(menuBody[len],511-len,"%d. %s^n", ++b ,g_mapDesc[ a ])
|
||||
}
|
||||
}
|
||||
|
||||
if ( g_voteSelectedNum[id] )
|
||||
{
|
||||
keys |= (1<<7)
|
||||
len += format(menuBody[len],511-len,"^n8. Start Voting^n")
|
||||
}
|
||||
else
|
||||
len += format(menuBody[len],511-len, g_cstrikeRunning ?
|
||||
"^n\d8. Start Voting^n\w" : "^n#. Start Voting^n")
|
||||
|
||||
if (end != g_mapNums)
|
||||
{
|
||||
len += format(menuBody[len],511-len,"^n9. More...^n0. %s^n", pos ? "Back" : "Exit")
|
||||
keys |= (1<<8)
|
||||
}
|
||||
else
|
||||
len += format(menuBody[len],511-len,"^n0. %s^n", pos ? "Back" : "Exit")
|
||||
|
||||
len += format(menuBody[len],511-len, g_voteSelectedNum[id] ?
|
||||
( g_cstrikeRunning ? "^n\ySelected Maps:^n\w" : "^nSelected Maps:^n") : "^n^n")
|
||||
|
||||
for(new c = 0; c < 4; c++)
|
||||
{
|
||||
if ( c < g_voteSelectedNum[id] )
|
||||
len += format(menuBody[len],511-len,"%s^n", g_mapDesc[ g_voteSelected[id][ c ] ] )
|
||||
else
|
||||
len += format(menuBody[len],511-len,"^n" )
|
||||
}
|
||||
|
||||
show_menu(id,keys,menuBody)
|
||||
}
|
||||
|
||||
|
||||
public cmdVoteMapMenu(id,level,cid)
|
||||
{
|
||||
if (!cmd_access(id,level,cid,1))
|
||||
return PLUGIN_HANDLED
|
||||
|
||||
if ( get_cvar_float("amx_last_voting") > get_gametime() )
|
||||
{
|
||||
client_print(id,print_chat,"There is already one voting...")
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
|
||||
g_voteSelectedNum[id] = 0
|
||||
|
||||
if ( g_mapNums )
|
||||
{
|
||||
displayVoteMapsMenu(id,g_menuPosition[id] = 0)
|
||||
}
|
||||
else
|
||||
{
|
||||
console_print(id,"There are no maps in menu")
|
||||
client_print(id,print_chat,"There are no maps in menu")
|
||||
}
|
||||
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
|
||||
public cmdMapsMenu(id,level,cid)
|
||||
{
|
||||
if (!cmd_access(id,level,cid,1))
|
||||
return PLUGIN_HANDLED
|
||||
|
||||
if ( g_mapNums )
|
||||
{
|
||||
displayMapsMenu(id,g_menuPosition[id] = 0)
|
||||
}
|
||||
else
|
||||
{
|
||||
console_print(id,"There are no maps in menu")
|
||||
client_print(id,print_chat,"There are no maps in menu")
|
||||
}
|
||||
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
|
||||
public delayedChange(mapname[])
|
||||
server_cmd("changelevel %s",mapname)
|
||||
|
||||
|
||||
public actionVoteMapMenu(id,key)
|
||||
{
|
||||
switch(key){
|
||||
case 7:{
|
||||
|
||||
new Float:voting = get_cvar_float("amx_last_voting")
|
||||
if ( voting > get_gametime() ){
|
||||
client_print(id,print_chat,"There is already one voting...")
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
if (voting && voting + get_cvar_float("amx_vote_delay") > get_gametime()) {
|
||||
client_print(id,print_chat,"Voting not allowed at this time")
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
|
||||
g_voteCount = { 0 , 0 , 0 , 0 , 0 }
|
||||
|
||||
new Float:vote_time = get_cvar_float("amx_vote_time") + 2.0
|
||||
set_cvar_float("amx_last_voting", get_gametime() + vote_time )
|
||||
new iVoteTime = floatround( vote_time )
|
||||
|
||||
set_task( vote_time , "checkVotes",34567 + id)
|
||||
|
||||
new menuBody[512]
|
||||
new players[32]
|
||||
new pnum, keys, len
|
||||
|
||||
get_players(players,pnum)
|
||||
|
||||
if ( g_voteSelectedNum[id] > 1 )
|
||||
{
|
||||
len = format(menuBody,511,g_cstrikeRunning ?
|
||||
"\yWhich map do you want?^n\w^n" : "Which map do you want?^n^n")
|
||||
for(new c = 0; c < g_voteSelectedNum[id] ; ++c)
|
||||
{
|
||||
len += format(menuBody[len],511,"%d. %s^n", c + 1 , g_mapDesc[ g_voteSelected[id][ c ] ] )
|
||||
keys |= (1<<c)
|
||||
}
|
||||
keys |= (1<<8)
|
||||
len += format(menuBody[len],511,"^n9. None^n")
|
||||
}
|
||||
else
|
||||
{
|
||||
len = format(menuBody,511, g_cstrikeRunning ? "\yChange map to^n%s?^n\w^n1. Yes^n2. No^n"
|
||||
: "Change map to^n%s?^n^n1. Yes^n2. No^n" , g_mapDesc[ g_voteSelected[id][ 0 ] ] )
|
||||
keys = (1<<0) | (1<<1)
|
||||
}
|
||||
|
||||
for(new b = 0; b < pnum; ++b)
|
||||
if ( players[b] != id )
|
||||
show_menu(players[b],keys,menuBody, iVoteTime)
|
||||
|
||||
format(menuBody[len],511,"^n0. Cancel Vote")
|
||||
keys |= (1<<9)
|
||||
show_menu(id,keys,menuBody, iVoteTime)
|
||||
|
||||
new authid[32],name[32]
|
||||
get_user_authid(id,authid,31)
|
||||
get_user_name(id,name,31)
|
||||
|
||||
switch(get_cvar_num("amx_show_activity")) {
|
||||
case 2: client_print(0,print_chat,"ADMIN %s: vote map(s)",name)
|
||||
case 1: client_print(0,print_chat,"ADMIN: vote map(s)")
|
||||
}
|
||||
|
||||
log_to_file(g_logFile,"Vote: ^"%s<%d><%s><>^" vote maps (map#1 ^"%s^") (map#2 ^"%s^") (map#3 ^"%s^") (map#4 ^"%s^")",
|
||||
name,get_user_userid(id),authid,
|
||||
g_voteSelectedNum[id] > 0 ? g_mapName[ g_voteSelected[id][ 0 ] ] : "" ,
|
||||
g_voteSelectedNum[id] > 1 ? g_mapName[ g_voteSelected[id][ 1 ] ] : "" ,
|
||||
g_voteSelectedNum[id] > 2 ? g_mapName[ g_voteSelected[id][ 2 ] ] : "",
|
||||
g_voteSelectedNum[id] > 3 ? g_mapName[ g_voteSelected[id][ 3 ] ] : "")
|
||||
}
|
||||
case 8: displayVoteMapsMenu(id,++g_menuPosition[id])
|
||||
case 9: displayVoteMapsMenu(id,--g_menuPosition[id])
|
||||
default:
|
||||
{
|
||||
g_voteSelected[id][ g_voteSelectedNum[id]++ ] = g_menuPosition[id] * 7 + key
|
||||
|
||||
displayVoteMapsMenu(id,g_menuPosition[id])
|
||||
}
|
||||
}
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
|
||||
|
||||
public actionMapsMenu(id,key)
|
||||
{
|
||||
switch(key){
|
||||
case 8: displayMapsMenu(id,++g_menuPosition[id])
|
||||
case 9: displayMapsMenu(id,--g_menuPosition[id])
|
||||
default:
|
||||
{
|
||||
new a = g_menuPosition[id] * 8 + key
|
||||
|
||||
message_begin(MSG_ALL, SVC_INTERMISSION)
|
||||
message_end()
|
||||
|
||||
new authid[32],name[32]
|
||||
get_user_authid(id,authid,31)
|
||||
get_user_name(id,name,31)
|
||||
|
||||
switch(get_cvar_num("amx_show_activity")) {
|
||||
case 2: client_print(0,print_chat,"ADMIN %s: changelevel %s",name,g_mapName[ a ])
|
||||
case 1: client_print(0,print_chat,"ADMIN: changelevel %s",g_mapName[ a ])
|
||||
}
|
||||
|
||||
log_to_file(g_logFile,"Cmd: ^"%s<%d><%s><>^" changelevel ^"%s^"",
|
||||
name,get_user_userid(id),authid, g_mapName[ a ] )
|
||||
|
||||
set_task(2.0,"delayedChange",0, g_mapName[ a ] , strlen(g_mapName[ a ]) + 1 )
|
||||
|
||||
/* displayMapsMenu(id,g_menuPosition[id]) */
|
||||
}
|
||||
}
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
|
||||
displayMapsMenu(id,pos)
|
||||
{
|
||||
|
||||
if (pos < 0)
|
||||
return
|
||||
|
||||
new menuBody[512]
|
||||
new start = pos * 8
|
||||
new b = 0
|
||||
|
||||
if (start >= g_mapNums)
|
||||
start = pos = g_menuPosition[id] = 0
|
||||
|
||||
new len = format(menuBody,511, g_cstrikeRunning ?
|
||||
"\yChangelevel Menu\R%d/%d^n\w^n" : "Changelevel Menu %d/%d^n^n",
|
||||
pos+1,( g_mapNums / 8 + (( g_mapNums % 8) ? 1 : 0 )) )
|
||||
|
||||
new end = start + 8
|
||||
new keys = (1<<9)
|
||||
|
||||
if (end > g_mapNums)
|
||||
end = g_mapNums
|
||||
|
||||
for(new a = start; a < end; ++a)
|
||||
{
|
||||
keys |= (1<<b)
|
||||
len += format(menuBody[len],511-len,"%d. %s^n",++b,g_mapDesc[ a ])
|
||||
}
|
||||
|
||||
if (end != g_mapNums)
|
||||
{
|
||||
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)
|
||||
}
|
||||
|
||||
load_settings(filename[])
|
||||
{
|
||||
if (!file_exists(filename))
|
||||
return 0
|
||||
|
||||
new text[256], szDesc[48]
|
||||
new a , pos = 0
|
||||
|
||||
while ( g_mapNums < MAX_MAPS && read_file(filename,pos++,text,255,a) )
|
||||
{
|
||||
if ( text[0] == ';' ) continue
|
||||
|
||||
if ( parse(text, g_mapName[g_mapNums] ,31, szDesc ,47) < 2 ) continue
|
||||
|
||||
if ( !is_map_valid( g_mapName[g_mapNums] ) ) continue
|
||||
|
||||
if ( strlen( szDesc ) > 31 )
|
||||
{
|
||||
copy(g_mapDesc[g_mapNums],28, szDesc )
|
||||
g_mapDesc[g_mapNums][28] = g_mapDesc[g_mapNums][29] = g_mapDesc[g_mapNums][30] = '.'
|
||||
g_mapDesc[g_mapNums][31] = 0
|
||||
}
|
||||
else copy(g_mapDesc[g_mapNums],31, szDesc )
|
||||
|
||||
g_mapNums++
|
||||
}
|
||||
|
||||
return 1
|
||||
}
|
175
plugins/menufront.sma
Executable file
175
plugins/menufront.sma
Executable file
@@ -0,0 +1,175 @@
|
||||
/* AMX Mod script.
|
||||
*
|
||||
* (c) 2003, OLO
|
||||
* This file is provided as is (no warranties).
|
||||
*
|
||||
*/
|
||||
|
||||
#include <amxmod>
|
||||
#include <amxmisc>
|
||||
|
||||
new g_menuPosition[33]
|
||||
|
||||
#define MENUS_NUMBER 15
|
||||
|
||||
new g_menuBody[MENUS_NUMBER][] = {
|
||||
"Kick Player",
|
||||
"Ban Player",
|
||||
"Slap/Slay Player",
|
||||
"Team Player^n",
|
||||
|
||||
"Changelevel",
|
||||
"Vote for maps^n",
|
||||
|
||||
"Speech Stuff",
|
||||
"Client Commands",
|
||||
|
||||
// Next Page
|
||||
|
||||
"Server Commands",
|
||||
"Cvars Settings",
|
||||
"Configuration",
|
||||
"Stats Settings^n",
|
||||
|
||||
"Pause Plugins",
|
||||
"Restrict Weapons",
|
||||
|
||||
"Teleport Player" /* Last is Teleport menu - if you want to move
|
||||
it change also code in displayMenu (look for fun module check) */
|
||||
|
||||
}
|
||||
|
||||
new g_menuCmd[MENUS_NUMBER][] = {
|
||||
"amx_kickmenu",
|
||||
"amx_banmenu",
|
||||
"amx_slapmenu",
|
||||
"amx_teammenu",
|
||||
|
||||
"amx_mapmenu",
|
||||
"amx_votemapmenu",
|
||||
|
||||
"amx_speechmenu",
|
||||
"amx_clcmdmenu",
|
||||
|
||||
// Next Page
|
||||
|
||||
"amx_cmdmenu",
|
||||
"amx_cvarmenu",
|
||||
"amx_cfgmenu",
|
||||
"amx_statscfgmenu",
|
||||
|
||||
"amx_pausecfgmenu",
|
||||
"amx_restmenu",
|
||||
|
||||
"amx_teleportmenu"
|
||||
}
|
||||
|
||||
// Second value sets if menu is only for CS...
|
||||
new g_menuAccess[MENUS_NUMBER][2] = {
|
||||
{ADMIN_KICK,0},
|
||||
{ADMIN_BAN,0},
|
||||
{ADMIN_SLAY,0},
|
||||
{ADMIN_LEVEL_A,1},
|
||||
|
||||
{ADMIN_MAP,0},
|
||||
{ADMIN_MAP,0},
|
||||
|
||||
{ADMIN_MENU,0},
|
||||
{ADMIN_LEVEL_A,0},
|
||||
|
||||
// Next Page
|
||||
|
||||
{ADMIN_MENU,0},
|
||||
{ADMIN_CVAR,0},
|
||||
{ADMIN_MENU,0},
|
||||
{ADMIN_CFG,1},
|
||||
|
||||
{ADMIN_CFG,0},
|
||||
{ADMIN_CFG,1},
|
||||
|
||||
{ADMIN_LEVEL_A,0}
|
||||
}
|
||||
|
||||
new g_cstrikeRunning
|
||||
new g_funModule
|
||||
|
||||
public plugin_init()
|
||||
{
|
||||
register_plugin("Menus Front-End","0.9","default")
|
||||
|
||||
register_menucmd(register_menuid("AMX Mod Menu"),1023,"actionMenu")
|
||||
register_clcmd("amxmodmenu","cmdMenu",ADMIN_MENU,"- displays menus")
|
||||
|
||||
g_cstrikeRunning = is_running("cstrike")
|
||||
g_funModule = cvar_exists( "fun_version" )
|
||||
}
|
||||
|
||||
public actionMenu(id,key)
|
||||
{
|
||||
switch(key){
|
||||
case 8: displayMenu(id,++g_menuPosition[id])
|
||||
case 9: displayMenu(id,--g_menuPosition[id])
|
||||
default: client_cmd(id, g_menuCmd[ g_menuPosition[id] * 8 + key ] )
|
||||
}
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
|
||||
displayMenu(id,pos){
|
||||
|
||||
if (pos < 0) return
|
||||
|
||||
new menuBody[512]
|
||||
new b = 0
|
||||
new start = pos * 8
|
||||
|
||||
if ( start >= MENUS_NUMBER )
|
||||
start = pos = g_menuPosition[id] = 0
|
||||
|
||||
new len = format(menuBody,511,
|
||||
g_cstrikeRunning ? "\yAMX Mod Menu\R%d/%d^n\w^n" : "AMX Mod Menu %d/%d^n^n" , pos+1, 2 )
|
||||
|
||||
new end = start + 8
|
||||
new keys = (1<<9)
|
||||
|
||||
if (end > MENUS_NUMBER )
|
||||
end = MENUS_NUMBER
|
||||
|
||||
new flags = get_user_flags(id)
|
||||
|
||||
for(new a = start; a < end; ++a)
|
||||
{
|
||||
if ( a == MENUS_NUMBER - 1 && !g_funModule )
|
||||
continue // checks if there is fun module for teleport menu
|
||||
|
||||
if ( (flags & g_menuAccess[a][0]) && ( g_menuAccess[a][1] ? g_cstrikeRunning : 1 ) )
|
||||
{
|
||||
keys |= (1<<b)
|
||||
len += format(menuBody[len],511-len,"%d. %s^n",++b, g_menuBody[ a ] )
|
||||
}
|
||||
else
|
||||
{
|
||||
++b
|
||||
if ( g_cstrikeRunning )
|
||||
len += format(menuBody[len],511-len, "\d%d. %s^n\w",b, g_menuBody[ a ] )
|
||||
else
|
||||
len += format(menuBody[len],511-len, "#. %s^n",g_menuBody[ a ] )
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (end != MENUS_NUMBER )
|
||||
{
|
||||
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 cmdMenu(id,level,cid)
|
||||
{
|
||||
if (cmd_access(id,level,cid,1))
|
||||
displayMenu(id,g_menuPosition[id] = 0)
|
||||
return PLUGIN_HANDLED
|
||||
}
|
514
plugins/miscstats.sma
Executable file
514
plugins/miscstats.sma
Executable file
@@ -0,0 +1,514 @@
|
||||
/* AMX Mod script.
|
||||
*
|
||||
* This file is provided as is (no warranties).
|
||||
*
|
||||
* This plugin contains:
|
||||
* o multikill announcement
|
||||
* o bomb events
|
||||
* o killing streak
|
||||
* o enemy remaining
|
||||
* o round counter
|
||||
* o italy bonus kill
|
||||
* o knife kill
|
||||
* o headshot kill
|
||||
* o greanade kill
|
||||
* o last man
|
||||
* o double kill
|
||||
* o player name
|
||||
* o first blood sound
|
||||
*
|
||||
* To use with AMX 0.9.6 (and higher) and Counter-Strike.
|
||||
* Stats can be enabled with amx_statscfg and amx_statscfgmenu commands.
|
||||
* NOTE: For pernament disable, comment file from plugins.ini
|
||||
* or use amx_pausecfg and amx_pausecfgmenu commands.
|
||||
* Rest of stats can be found in csstats plugin.
|
||||
*/
|
||||
|
||||
#include <amxmod>
|
||||
|
||||
public MultiKill
|
||||
public MultiKillSound
|
||||
public BombPlanting
|
||||
public BombDefusing
|
||||
public BombPlanted
|
||||
public BombDefused
|
||||
public BombFailed
|
||||
public BombPickUp
|
||||
public BombDrop
|
||||
public BombCountVoice
|
||||
public BombCountDef
|
||||
public BombReached
|
||||
public ItalyBonusKill
|
||||
public EnemyRemaining
|
||||
public LastMan
|
||||
public KnifeKill
|
||||
public KnifeKillSound
|
||||
public GrenadeKill
|
||||
public GrenadeSuicide
|
||||
public HeadShotKill
|
||||
public HeadShotKillSound
|
||||
public RoundCounterSound
|
||||
public RoundCounter
|
||||
public KillingStreak
|
||||
public KillingStreakSound
|
||||
public DoubleKill
|
||||
public DoubleKillSound
|
||||
public PlayerName
|
||||
public FirstBloodSound
|
||||
|
||||
new g_streakKills[33][2]
|
||||
new g_multiKills[33][2]
|
||||
new g_Planter
|
||||
new g_Defuser
|
||||
new g_C4Timer
|
||||
new g_Defusing
|
||||
new Float:g_LastOmg
|
||||
new Float:g_LastPlan
|
||||
new g_LastAnnounce
|
||||
new g_roundCount
|
||||
new Float:g_doubleKill
|
||||
new g_doubleKillId
|
||||
new g_friend[33]
|
||||
new g_firstBlood
|
||||
|
||||
new g_MultiKillMsg[7][] = {
|
||||
"Multi-Kill! %s^nwith %d kills (%d hs)",
|
||||
"Ultra-Kill!!! %s^nwith %d kills (%d hs)",
|
||||
"%s IS ON A KILLING SPREE!!!^nwith %d kills (%d hs)",
|
||||
"RAMPAGE!!! %s^nwith %d kills (%d hs)" ,
|
||||
"%s IS UNSTOPPABLE!!!^nwith %d kills (%d hs)" ,
|
||||
"%s IS A MONSTER!^nwith %d kills (%d hs)",
|
||||
"%s IS GODLIKE!!!!^nwith %d kills (%d hs)"
|
||||
}
|
||||
new g_Sounds[7][] = {
|
||||
"multikill",
|
||||
"ultrakill",
|
||||
"killingspree",
|
||||
"rampage",
|
||||
"unstoppable",
|
||||
"monsterkill",
|
||||
"godlike"
|
||||
}
|
||||
new g_KillingMsg[7][] = {
|
||||
"%s: Multi-Kill!",
|
||||
"%s: Ultra-Kill!!!",
|
||||
"%s IS ON A KILLING SPREE!!!",
|
||||
"%s: RAMPAGE!!!",
|
||||
"%s IS UNSTOPPABLE!!!",
|
||||
"%s IS A MONSTER!",
|
||||
"%s IS GODLIKE!!!"
|
||||
}
|
||||
new g_KinfeMsg[4][] = {
|
||||
"%s sliced and diced %s",
|
||||
"%s pulled out knife and gutted %s",
|
||||
"%s sneaks carefully behind and knifed %s",
|
||||
"%s knived %s"
|
||||
}
|
||||
new g_LastMessages[4][] = {
|
||||
"Now all depend on you!",
|
||||
"I hope you still have a healthpack.",
|
||||
"All your teammates were killed. Good luck!",
|
||||
"Now you are alone. Have fun!"
|
||||
}
|
||||
new g_HeMessages[4][] = {
|
||||
"%s sends a little gift to %s",
|
||||
"%s throws a small present to %s",
|
||||
"%s made a precision throw to %s",
|
||||
"%s got a big explosion for %s"
|
||||
}
|
||||
new g_SHeMessages[4][] = {
|
||||
"%s detonated himself with a grenade",
|
||||
"%s trys the effect of a HE Grenade",
|
||||
"%s kicked a grenade into his own ass",
|
||||
"%s explodes!"
|
||||
}
|
||||
new g_HeadShots[7][] = {
|
||||
"$kn killed $vn with a well^nplaced shot to the head!",
|
||||
"$kn removed $vn's^nhead with the $wn",
|
||||
"$kn turned $vn's head^ninto pudding with the $wn",
|
||||
"$vn got pwned by $kn",
|
||||
"$vn's head has been^nturned into red jello",
|
||||
"$kn has superb aim with the $wn,^nas $vn well knows.",
|
||||
"$vn's head stayed in $kn's^ncrosshairs a bit too long..."
|
||||
}
|
||||
|
||||
new g_teamsNames[2][] = {
|
||||
"TERRORIST",
|
||||
"CT"
|
||||
}
|
||||
|
||||
public plugin_init(){
|
||||
register_plugin("Misc. Stats","0.9","default")
|
||||
register_event("DeathMsg","eDeathMsg","a")
|
||||
register_event("TextMsg","eRestart","a","2&#Game_C","2&#Game_w")
|
||||
register_event("SendAudio", "eEndRound", "a", "2&%!MRAD_terwin","2&%!MRAD_ctwin","2&%!MRAD_rounddraw")
|
||||
register_event("RoundTime", "eNewRound", "bc")
|
||||
register_event("StatusValue","setTeam","be","1=1")
|
||||
register_event("StatusValue","showStatus","be","1=2","2!0")
|
||||
register_event("StatusValue","hideStatus","be","1=1","2=0")
|
||||
new mapname[32]
|
||||
get_mapname(mapname,31)
|
||||
if (equali(mapname,"de_",3)||equali(mapname,"csde_",5)){
|
||||
register_event("StatusIcon", "eGotBomb", "be", "1=1", "1=2", "2=c4")
|
||||
register_event("SendAudio", "eBombPlanted", "a", "2&%!MRAD_BOMBPL")
|
||||
register_event("SendAudio", "eBombDef", "a", "2&%!MRAD_BOMBDEF")
|
||||
register_event("TextMsg", "eBombFail", "a", "2&#Target_B")
|
||||
register_event("BarTime", "eBombDefG", "be", "1=10", "1=5","1=3")
|
||||
register_event("BarTime", "eBombDefL", "be", "1=0")
|
||||
register_event("TextMsg", "eBombPickUp", "bc", "2&#Got_bomb")
|
||||
register_event("TextMsg", "eBombDrop", "bc", "2&#Game_bomb_d")
|
||||
}
|
||||
else if ( equali( mapname , "cs_italy" ) ) {
|
||||
register_event( "23" , "chickenKill", "a" , "1=108" , /*"12=106",*/ "15=4" )
|
||||
register_event( "23" , "radioKill", "a" , "1=108" , /*"12=294",*/ "15=2" )
|
||||
}
|
||||
}
|
||||
|
||||
public plugin_cfg(){
|
||||
new g_addStast[] = "amx_statscfg add ^"%s^" %s"
|
||||
server_cmd(g_addStast,"MultiKill","MultiKill")
|
||||
server_cmd(g_addStast,"MultiKillSound","MultiKillSound")
|
||||
server_cmd(g_addStast,"Bomb Planting","BombPlanting")
|
||||
server_cmd(g_addStast,"Bomb Defusing","BombDefusing")
|
||||
server_cmd(g_addStast,"Bomb Planted","BombPlanted")
|
||||
server_cmd(g_addStast,"Bomb Defuse Succ.","BombDefused")
|
||||
server_cmd(g_addStast,"Bomb Def. Failure","BombFailed")
|
||||
server_cmd(g_addStast,"Bomb PickUp","BombPickUp")
|
||||
server_cmd(g_addStast,"Bomb Drop","BombDrop")
|
||||
server_cmd(g_addStast,"Bomb Count Down","BombCountVoice")
|
||||
server_cmd(g_addStast,"Bomb Count Down (def)","BombCountDef")
|
||||
server_cmd(g_addStast,"Bomb Site Reached","BombReached")
|
||||
server_cmd(g_addStast,"Italy Bonus Kill","ItalyBonusKill")
|
||||
server_cmd(g_addStast,"Last Man","LastMan")
|
||||
server_cmd(g_addStast,"Knife Kill","KnifeKill")
|
||||
server_cmd(g_addStast,"Knife Kill Sound","KnifeKillSound")
|
||||
server_cmd(g_addStast,"Grenade Kill","GrenadeKill")
|
||||
server_cmd(g_addStast,"Grenade Suicide","GrenadeSuicide")
|
||||
server_cmd(g_addStast,"HeadShot Kill","HeadShotKill")
|
||||
server_cmd(g_addStast,"HeadShot Kill Sound","HeadShotKillSound")
|
||||
server_cmd(g_addStast,"Round Counter","RoundCounter")
|
||||
server_cmd(g_addStast,"Round Counter Sound","RoundCounterSound")
|
||||
server_cmd(g_addStast,"Killing Streak","KillingStreak")
|
||||
server_cmd(g_addStast,"Killing Streak Sound","KillingStreakSound")
|
||||
server_cmd(g_addStast,"Enemy Remaining","EnemyRemaining")
|
||||
server_cmd(g_addStast,"Double Kill","DoubleKill")
|
||||
server_cmd(g_addStast,"Double Kill Sound","DoubleKillSound")
|
||||
server_cmd(g_addStast,"Player Name","PlayerName")
|
||||
server_cmd(g_addStast,"First Blood Sound","FirstBloodSound")
|
||||
}
|
||||
|
||||
public client_putinserver(id)
|
||||
g_multiKills[id] = g_streakKills[ id ] = { 0 , 0 }
|
||||
|
||||
public eDeathMsg(){
|
||||
new killerId = read_data(1)
|
||||
if ( killerId == 0 ) return
|
||||
new victimId = read_data(2)
|
||||
new bool:enemykill = (get_user_team(killerId) != get_user_team(victimId))
|
||||
new headshot = read_data(3)
|
||||
if ( g_firstBlood ) {
|
||||
g_firstBlood = 0
|
||||
if ( FirstBloodSound ) client_cmd(0,"spk misc/firstblood")
|
||||
}
|
||||
if ( (KillingStreak || KillingStreakSound) && enemykill ) {
|
||||
g_streakKills[ killerId ][ 0 ]++
|
||||
g_streakKills[ killerId ][ 1 ] = 0
|
||||
g_streakKills[ victimId ][ 1 ]++
|
||||
g_streakKills[ victimId ][ 0 ] = 0
|
||||
new a = g_streakKills[ killerId ][ 0 ] - 3
|
||||
if ( (a > -1) && !( a % 2 ) ) {
|
||||
new name[32]
|
||||
get_user_name( killerId , name , 31 )
|
||||
if ( (a >>= 1) > 6 ) a = 6
|
||||
if ( KillingStreak ){
|
||||
set_hudmessage(0, 100, 255, 0.05, 0.55, 2, 0.02, 6.0, 0.01, 0.1, 3)
|
||||
show_hudmessage(0,g_KillingMsg[ a ], name )
|
||||
}
|
||||
if ( KillingStreakSound ) client_cmd( 0 , "spk misc/%s" , g_Sounds[ a ] )
|
||||
}
|
||||
}
|
||||
if ( MultiKill || MultiKillSound ) {
|
||||
if (killerId && enemykill ) {
|
||||
g_multiKills[killerId][0]++
|
||||
g_multiKills[killerId][1] += headshot
|
||||
new param[2]
|
||||
param[0] = killerId
|
||||
param[1] = g_multiKills[killerId][0]
|
||||
set_task( 4.0 + float( param[1] ) ,"checkKills",0,param,2)
|
||||
}
|
||||
}
|
||||
if ( EnemyRemaining ) {
|
||||
new ppl[32], pplnum
|
||||
new team = get_user_team( victimId ) - 1
|
||||
get_players(ppl,pplnum,"e", g_teamsNames[1 - team] )
|
||||
if (pplnum){
|
||||
new eppl[32], epplnum
|
||||
get_players(eppl,epplnum,"ae",g_teamsNames[team])
|
||||
if (epplnum) {
|
||||
new message[128]
|
||||
format(message,127,"%d %s%s Remaining...",epplnum,g_teamsNames[team],(epplnum==1)?"":"S" )
|
||||
set_hudmessage(255,255,255,0.02,0.85,2, 0.05, 0.1, 0.02, 3.0, 3)
|
||||
for(new a=0; a<pplnum; ++a) show_hudmessage(ppl[a],message)
|
||||
//client_print(ppl[a],print_chat,message)
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( LastMan ) {
|
||||
new cts[32], ts[32], ctsnum, tsnum
|
||||
get_players(cts,ctsnum,"ae", g_teamsNames[1] )
|
||||
get_players(ts,tsnum,"ae", g_teamsNames[0] )
|
||||
if ( ctsnum == 1 && tsnum == 1 ){
|
||||
new ctname[32], tname[32]
|
||||
get_user_name(cts[0],ctname,31)
|
||||
get_user_name(ts[0],tname,31)
|
||||
set_hudmessage(0, 255, 255, -1.0, 0.35, 0, 6.0, 6.0, 0.5, 0.15, 3)
|
||||
show_hudmessage(0,"%s vs. %s",ctname,tname)
|
||||
client_cmd(0,"spk misc/maytheforce")
|
||||
}
|
||||
else if ( !g_LastAnnounce ) {
|
||||
new oposite = 0, team = 0
|
||||
if ( ctsnum == 1 && tsnum > 1 ) {
|
||||
g_LastAnnounce = cts[0]
|
||||
oposite = tsnum
|
||||
team = 0
|
||||
}
|
||||
else if ( tsnum == 1 && ctsnum > 1 ) {
|
||||
g_LastAnnounce = ts[0]
|
||||
oposite = ctsnum
|
||||
team = 1
|
||||
}
|
||||
if (g_LastAnnounce){
|
||||
new name[32]
|
||||
get_user_name(g_LastAnnounce,name,31)
|
||||
set_hudmessage(0, 255, 255, -1.0, 0.35, 0, 6.0, 6.0, 0.5, 0.15, 3)
|
||||
show_hudmessage(0,"%s (%d HP) vs. %d %s%s: %s",name,
|
||||
get_user_health(g_LastAnnounce),oposite,
|
||||
g_teamsNames[team],(oposite==1)?"":"S" ,g_LastMessages[ random_num(0,3) ] )
|
||||
client_cmd(g_LastAnnounce,"spk misc/oneandonly")
|
||||
}
|
||||
}
|
||||
}
|
||||
new arg[4]
|
||||
read_data( 4 , arg , 3 )
|
||||
if ( equal( arg, "kni" ) && ( KnifeKill || KnifeKillSound ) ) {
|
||||
if ( KnifeKill ) {
|
||||
new killer[32], victim[32]
|
||||
get_user_name(killerId,killer,31)
|
||||
get_user_name(victimId,victim,31)
|
||||
set_hudmessage(255, 100, 100, -1.0, 0.25, 1, 6.0, 6.0, 0.5, 0.15, 1)
|
||||
show_hudmessage(0,g_KinfeMsg[ random_num(0,3) ],killer,victim)
|
||||
}
|
||||
if ( KnifeKillSound ) client_cmd(0,"spk misc/humiliation")
|
||||
}
|
||||
else if ( equal( arg, "gre" ) && (GrenadeKill || GrenadeSuicide) ) {
|
||||
new killer[32], victim[32]
|
||||
get_user_name(killerId,killer,32)
|
||||
get_user_name(victimId,victim,32)
|
||||
set_hudmessage(255, 100, 100, -1.0, 0.25, 1, 6.0, 6.0, 0.5, 0.15, 1)
|
||||
if ( killerId != victimId ){
|
||||
if ( GrenadeKill ) show_hudmessage(0,g_HeMessages[ random_num(0,3)],killer,victim)
|
||||
}
|
||||
else if ( GrenadeSuicide ) show_hudmessage(0,g_SHeMessages[ random_num(0,3) ],victim)
|
||||
}
|
||||
if ( headshot && (HeadShotKill || HeadShotKillSound) ) {
|
||||
if ( HeadShotKill ){
|
||||
new killer[32], victim[32], weapon[32], message[128]
|
||||
get_user_name(killerId,killer,31)
|
||||
get_user_name(victimId,victim,31)
|
||||
read_data( 4 , weapon , 31 )
|
||||
copy( message, 127, g_HeadShots[ random_num(0,6) ] )
|
||||
replace( message, 127 , "$vn", victim )
|
||||
replace( message, 127 , "$wn", weapon )
|
||||
replace( message, 127 , "$kn", killer )
|
||||
set_hudmessage(100, 100, 255, -1.0, 0.29, 0, 6.0, 6.0, 0.5, 0.15, 1)
|
||||
show_hudmessage(0,message )
|
||||
}
|
||||
if ( HeadShotKillSound ) {
|
||||
client_cmd(killerId,"spk misc/headshot")
|
||||
client_cmd(victimId,"spk misc/headshot")
|
||||
}
|
||||
}
|
||||
if ( DoubleKill || DoubleKillSound ) {
|
||||
new Float:nowtime = get_gametime()
|
||||
if ( g_doubleKill == nowtime && g_doubleKillId == killerId ) {
|
||||
if ( DoubleKill ) {
|
||||
new name[32]
|
||||
get_user_name( killerId , name , 31 )
|
||||
set_hudmessage(255, 0, 255, -1.0, 0.35, 0, 6.0, 6.0, 0.5, 0.15, 3)
|
||||
show_hudmessage(0,"Wow! %s made a double kill!!!" ,name )
|
||||
}
|
||||
if ( DoubleKillSound ) client_cmd(0,"spk misc/doublekill")
|
||||
}
|
||||
g_doubleKill = nowtime
|
||||
g_doubleKillId = killerId
|
||||
}
|
||||
}
|
||||
|
||||
public hideStatus(id)
|
||||
if ( PlayerName ){
|
||||
set_hudmessage(0,0,0,0.0,0.0,0, 0.0, 0.01, 0.0, 0.0, 4)
|
||||
show_hudmessage(id,"")
|
||||
}
|
||||
|
||||
public setTeam(id)
|
||||
g_friend[id] = read_data(2)
|
||||
|
||||
public showStatus(id)
|
||||
if ( PlayerName ){
|
||||
new name[32],pid = read_data(2)
|
||||
get_user_name(pid,name,31)
|
||||
new color1 = 0,color2 = 0
|
||||
if ( get_user_team(pid)==1 )
|
||||
color1 = 255
|
||||
else
|
||||
color2 = 255
|
||||
if (g_friend[id]==1){ // friend
|
||||
new clip, ammo, wpnid = get_user_weapon(pid,clip,ammo)
|
||||
new wpnname[32]
|
||||
get_weaponname(wpnid,wpnname,31)
|
||||
set_hudmessage(color1,50,color2,-1.0,0.60,1, 0.01, 3.0, 0.01, 0.01, 4)
|
||||
show_hudmessage(id,"%s -- %d HP / %d AP / %s",name,
|
||||
get_user_health(pid),get_user_armor(pid),wpnname[7])
|
||||
}
|
||||
else {
|
||||
set_hudmessage(color1,50,color2,-1.0,0.60,1, 0.01, 3.0, 0.01, 0.01, 4)
|
||||
show_hudmessage(id,name)
|
||||
}
|
||||
}
|
||||
|
||||
public eNewRound()
|
||||
if ( read_data(1) == floatround(get_cvar_float("mp_roundtime") * 60.0) ) {
|
||||
g_firstBlood = 1
|
||||
g_C4Timer = 0
|
||||
++g_roundCount
|
||||
if ( RoundCounter ) {
|
||||
set_hudmessage(200, 0, 0, -1.0, 0.30, 0, 6.0, 6.0, 0.5, 0.15, 1)
|
||||
show_hudmessage(0, "Prepare to FIGHT!^nRound %d" , g_roundCount )
|
||||
}
|
||||
if ( RoundCounterSound ) client_cmd( 0 , "spk misc/prepare" )
|
||||
if ( KillingStreak ) {
|
||||
new appl[32],ppl, i
|
||||
get_players(appl,ppl, "ac" )
|
||||
for(new a = 0; a < ppl; ++a) {
|
||||
i = appl[ a ]
|
||||
if ( g_streakKills[ i ][ 0 ] >= 2 )
|
||||
client_print( i , print_chat , "* You've killed %d in a row so far", g_streakKills[ i ][ 0 ] )
|
||||
else if ( g_streakKills[ i ][ 1 ] >= 2 )
|
||||
client_print( i , print_chat , "* Careful! You've died %d rounds in a row now...", g_streakKills[ i ][ 1 ] )
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public eRestart(){
|
||||
eEndRound()
|
||||
g_roundCount = 0
|
||||
g_firstBlood = 1
|
||||
}
|
||||
|
||||
public eEndRound(){
|
||||
g_C4Timer = -2
|
||||
g_LastPlan = 0.0
|
||||
g_LastOmg = 0.0
|
||||
g_LastPlan = 0.0
|
||||
remove_task(8038)
|
||||
g_LastAnnounce = 0
|
||||
}
|
||||
|
||||
public checkKills(param[]){
|
||||
new id = param[0]
|
||||
new a = param[1]
|
||||
if (a == g_multiKills[id][0]){
|
||||
a -= 3
|
||||
if ( a > -1 ){
|
||||
if ( MultiKill ) {
|
||||
new name[32]
|
||||
get_user_name(id,name,31)
|
||||
set_hudmessage(255, 0, 100, 0.05, 0.65, 2, 0.02, 6.0, 0.01, 0.1, 2)
|
||||
if ( a > 6 ) a = 6
|
||||
show_hudmessage(0,g_MultiKillMsg[a],name,g_multiKills[id][0],g_multiKills[id][1])
|
||||
}
|
||||
if ( MultiKillSound ) client_cmd(0,"spk misc/%s",g_Sounds[a])
|
||||
}
|
||||
g_multiKills[id] = { 0,0 }
|
||||
}
|
||||
}
|
||||
|
||||
public chickenKill()
|
||||
if ( ItalyBonusKill ) announceEvent( 0 , "Somebody killed a chicken!!!" )
|
||||
|
||||
public radioKill()
|
||||
if ( ItalyBonusKill ) announceEvent( 0 , "Somebody blew up the radio!!!" )
|
||||
|
||||
announceEvent( id , message[] ){
|
||||
new name[32]
|
||||
get_user_name(id, name , 31)
|
||||
set_hudmessage(255, 100, 50, -1.0, 0.30, 0, 6.0, 6.0, 0.5, 0.15, 1)
|
||||
show_hudmessage(0,message,name)
|
||||
}
|
||||
|
||||
public eGotBomb(id){
|
||||
g_Planter = id
|
||||
g_Defuser = g_Defusing = 0
|
||||
if ( BombReached && read_data(1)==2 && g_LastOmg<get_gametime()){
|
||||
g_LastOmg = get_gametime() + 15.0
|
||||
announceEvent(g_Planter , "Omg! %s reached the target!" )
|
||||
}
|
||||
}
|
||||
|
||||
public eBombDefG(id){
|
||||
if (read_data(1) == 3){
|
||||
if ( BombPlanting && g_LastPlan<get_gametime() ){
|
||||
g_LastPlan = get_gametime() + 15.0
|
||||
announceEvent(g_Planter , "%s is planting the bomb!" )
|
||||
}
|
||||
}
|
||||
else {
|
||||
g_Defuser = g_Defusing = id
|
||||
if ( BombDefusing && g_LastPlan<get_gametime()){
|
||||
g_LastPlan = get_gametime() + 15.0
|
||||
announceEvent(g_Defusing , "%s is defusing the bomb..." )
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public eBombDefL(id)
|
||||
g_Defusing = 0
|
||||
|
||||
public eBombPlanted()
|
||||
if ( g_C4Timer != -2 ){
|
||||
if (BombPlanted) announceEvent(g_Planter , "%s set us up the bomb!!!" )
|
||||
g_C4Timer = get_cvar_num("mp_c4timer") - 2
|
||||
set_task(1.0,"bombTimer",8038,"",0,"b")
|
||||
g_LastPlan = 0.0
|
||||
}
|
||||
|
||||
public bombTimer(){
|
||||
if (--g_C4Timer > 0){
|
||||
if (BombCountVoice) {
|
||||
if (g_C4Timer == 30 || g_C4Timer == 20){
|
||||
new temp[48]
|
||||
num_to_word(g_C4Timer,temp,47)
|
||||
client_cmd(0,"spk ^"vox/%s seconds until explosion^"",temp)
|
||||
}
|
||||
else if (g_C4Timer < 11){
|
||||
new temp[48]
|
||||
num_to_word(g_C4Timer,temp,47)
|
||||
client_cmd(0,"spk ^"vox/%s^"",temp)
|
||||
}
|
||||
}
|
||||
if (BombCountDef && g_Defusing) client_print(g_Defusing,print_center,"%d",g_C4Timer)
|
||||
}
|
||||
else remove_task(8038)
|
||||
}
|
||||
|
||||
public eBombDef()
|
||||
if (BombDefused) announceEvent(g_Defuser , "%s defused the bomb!" )
|
||||
|
||||
public eBombFail()
|
||||
if (BombFailed && g_Defuser ) announceEvent(g_Defuser , "%s failed to defuse the bomb..." )
|
||||
|
||||
public eBombPickUp(id)
|
||||
if (BombPickUp) announceEvent(id , "%s pick up the bomb...")
|
||||
|
||||
public eBombDrop()
|
||||
if (BombDrop) announceEvent(g_Planter , "%s dropped the bomb!!!")
|
137
plugins/nextmap.sma
Executable file
137
plugins/nextmap.sma
Executable file
@@ -0,0 +1,137 @@
|
||||
/* AMX Mod script.
|
||||
*
|
||||
* (c) 2003, OLO
|
||||
* This file is provided as is (no warranties).
|
||||
*
|
||||
* Mapcycle is immune to manual map changes and map votes.
|
||||
*
|
||||
* Cvars:
|
||||
* amx_nextmap < mapname > - sets nextmap
|
||||
* Commands:
|
||||
* say nextmap - dispalys the nextmap (available for all clients)
|
||||
*/
|
||||
|
||||
#include <amxmod>
|
||||
|
||||
// WARNING: If you comment this line make sure
|
||||
// that in your mapcycle file maps don't repeat.
|
||||
// However the same map in a row is still valid.
|
||||
#define OBEY_MAPCYCLE
|
||||
|
||||
new g_nextMap[32]
|
||||
new g_mapCycle[32]
|
||||
new g_pos
|
||||
|
||||
public plugin_init()
|
||||
{
|
||||
register_plugin("NextMap","0.9","default")
|
||||
register_event( "30" , "changeMap", "a" )
|
||||
register_clcmd("say nextmap","sayNextMap",0,"- displays nextmap")
|
||||
register_cvar("amx_nextmap","",FCVAR_SERVER|FCVAR_EXTDLL|FCVAR_SPONLY)
|
||||
|
||||
new szString[32], szString2[32], szString3[8]
|
||||
get_localinfo( "lastmapcycle", szString , 31 )
|
||||
parse( szString, szString2, 31, szString3 , 7 )
|
||||
g_pos = strtonum( szString3 )
|
||||
get_cvar_string( "mapcyclefile" , g_mapCycle , 31 )
|
||||
|
||||
if ( !equal( g_mapCycle , szString2 ) )
|
||||
g_pos = 0 // mapcyclefile has been changed - go from first
|
||||
|
||||
readMapCycle( g_mapCycle , g_nextMap , 31 )
|
||||
set_cvar_string( "amx_nextmap", g_nextMap )
|
||||
format( szString3 , 31, "%s %d", g_mapCycle , g_pos ) // save lastmapcycle settings
|
||||
set_localinfo( "lastmapcycle", szString3 )
|
||||
}
|
||||
|
||||
getNextMapName(szArg[],iMax){
|
||||
new len = get_cvar_string("amx_nextmap",szArg,iMax)
|
||||
if ( is_map_valid(szArg) ) return len
|
||||
len = copy(szArg,iMax,g_nextMap)
|
||||
set_cvar_string("amx_nextmap",g_nextMap)
|
||||
return len
|
||||
}
|
||||
|
||||
public sayNextMap(){
|
||||
new name[32]
|
||||
getNextMapName(name,31)
|
||||
client_print(0,print_chat,"Next Map: %s",name)
|
||||
}
|
||||
|
||||
public delayedChange( param[] )
|
||||
server_cmd( "changelevel %s", param )
|
||||
|
||||
public changeMap(){
|
||||
new string[32]
|
||||
set_cvar_float( "mp_chattime" , 3.0 ) // make sure mp_chattime is long
|
||||
new len = getNextMapName(string, 31) + 1
|
||||
set_task( 1.5 , "delayedChange" , 0 , string , len ) // change with 1.5 sec. delay
|
||||
}
|
||||
|
||||
new g_warning[] = "WARNING: Couldn't find a valid map or the file doesn't exist (file ^"%s^")"
|
||||
|
||||
#if defined OBEY_MAPCYCLE
|
||||
|
||||
readMapCycle(szFileName[], szNext[], iNext ){
|
||||
new b, i = 0, iMaps = 0
|
||||
new szBuffer[32], szFirst[32]
|
||||
if ( file_exists( szFileName ) ) {
|
||||
while( read_file( szFileName , i++ , szBuffer , 31 , b ) ) {
|
||||
if ( !isalpha( szBuffer[0] ) || !is_map_valid( szBuffer ) ) continue
|
||||
if ( !iMaps ) copy( szFirst, 31, szBuffer )
|
||||
if ( ++iMaps > g_pos ) {
|
||||
copy( szNext , iNext , szBuffer )
|
||||
g_pos = iMaps
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( !iMaps ) {
|
||||
log_message( g_warning , szFileName )
|
||||
get_mapname( szFirst , 31 )
|
||||
}
|
||||
copy( szNext , iNext , szFirst )
|
||||
g_pos = 1
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
readMapCycle(szFileName[], szNext[], iNext )
|
||||
{
|
||||
new b, i = 0, iMaps = 0
|
||||
new szBuffer[32], szFirst[32], szCurrent[32]
|
||||
get_mapname( szCurrent , 31 )
|
||||
new a = g_pos
|
||||
|
||||
if ( file_exists( szFileName ) ) {
|
||||
while( read_file( szFileName , i++ , szBuffer , 31 , b ) ) {
|
||||
if ( !isalpha( szBuffer[0] ) || !is_map_valid( szBuffer ) ) continue
|
||||
if ( !iMaps ) {
|
||||
iMaps = 1
|
||||
copy( szFirst, 31, szBuffer )
|
||||
}
|
||||
if ( iMaps == 1 ){
|
||||
if ( equali( szCurrent , szBuffer ) ) {
|
||||
if ( a-- == 0 )
|
||||
iMaps = 2
|
||||
}
|
||||
}
|
||||
else {
|
||||
if ( equali( szCurrent , szBuffer ) )
|
||||
++g_pos
|
||||
else
|
||||
g_pos = 0
|
||||
copy( szNext , iNext , szBuffer )
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( !iMaps ) {
|
||||
log_message( g_warning , szFileName )
|
||||
copy( szNext ,iNext , szCurrent )
|
||||
}
|
||||
else copy( szNext ,iNext , szFirst )
|
||||
g_pos = 0
|
||||
}
|
||||
|
||||
#endif
|
366
plugins/pausecfg.sma
Executable file
366
plugins/pausecfg.sma
Executable file
@@ -0,0 +1,366 @@
|
||||
/* AMX Mod script.
|
||||
*
|
||||
* (c) 2003, OLO
|
||||
* This file is provided as is (no warranties).
|
||||
*
|
||||
* Admin commads:
|
||||
* amx_pausecfgmenu - displays menu by which you can pause, unpause and stop plugins
|
||||
* amx_pausecfg - list commands for pause/unpause managment
|
||||
*
|
||||
* WARNING: Stopped plugins won't work properly after activation
|
||||
* (without mapchange) due to unactive status during players connections.
|
||||
* For proper activation clear the file with stopped plugins
|
||||
* (option #7 in menu) or unstop selected one, save configuration,
|
||||
* then change your map.
|
||||
*/
|
||||
|
||||
#include <amxmod>
|
||||
#include <amxmisc>
|
||||
|
||||
// Uncomment if you want to have two new commands
|
||||
// amx_off - pause plugins not marked as unpauseable
|
||||
// amx_on - enable plugins not marked as unpauseable
|
||||
//#define DIRECT_ONOFF
|
||||
|
||||
#define MAX_SYSTEM 32
|
||||
|
||||
new g_menuPos[33]
|
||||
new g_fileToSave[64]
|
||||
new g_cstrikeRunning
|
||||
new g_Modified
|
||||
new g_couldntFind[] = "Couldn't find a plugin matching ^"%s^""
|
||||
new g_pluginMatch[] = "Plugin matching ^"%s^" %s"
|
||||
new g_addCmd[] = "amx_pausecfg add ^"%s^""
|
||||
new g_system[MAX_SYSTEM]
|
||||
new g_systemNum
|
||||
|
||||
public plugin_init(){
|
||||
register_plugin("Pause Plugins","0.9","default")
|
||||
register_concmd("amx_pausecfg","cmdPlugin",ADMIN_CFG,"- list commands for pause/unpause managment")
|
||||
register_clcmd("amx_pausecfgmenu","cmdMenu",ADMIN_CFG,"- pause/unpause plugins with menu")
|
||||
#if defined DIRECT_ONOFF
|
||||
register_concmd("amx_off","cmdOFF",ADMIN_CFG,"- pauses some plugins")
|
||||
register_concmd("amx_on","cmdON",ADMIN_CFG,"- unpauses some plugins")
|
||||
#endif
|
||||
register_menucmd(register_menuid("Pause/Unpause Plugins"),1023,"actionMenu")
|
||||
g_cstrikeRunning = is_running("cstrike")
|
||||
return PLUGIN_CONTINUE
|
||||
}
|
||||
|
||||
#if defined DIRECT_ONOFF
|
||||
|
||||
public cmdOFF(id,level,cid){
|
||||
if (cmd_access(id,level,cid,1))
|
||||
pausePlugins(id)
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
|
||||
public cmdON(id,level,cid){
|
||||
if (cmd_access(id,level,cid,1))
|
||||
unpausePlugins(id)
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
public plugin_cfg() {
|
||||
build_path( g_fileToSave , 63 , "$basedir/pausecfg.ini" )
|
||||
loadSettings(g_fileToSave)
|
||||
// Put here titles of plugins which you don't want to pause
|
||||
server_cmd(g_addCmd , "Pause Plugins" )
|
||||
server_cmd(g_addCmd , "Admin Commands" )
|
||||
server_cmd(g_addCmd , "TimeLeft" )
|
||||
server_cmd(g_addCmd , "Slots Reservation" )
|
||||
server_cmd(g_addCmd , "Admin Chat" )
|
||||
server_cmd(g_addCmd , "NextMap" )
|
||||
server_cmd(g_addCmd , "Admin Help" )
|
||||
server_cmd(g_addCmd , "Admin Base" )
|
||||
server_cmd(g_addCmd , "Admin Votes" )
|
||||
server_cmd(g_addCmd , "Welcome Message" )
|
||||
server_cmd(g_addCmd , "Stats Configuration" )
|
||||
server_cmd(g_addCmd , "Commands Menu" )
|
||||
server_cmd(g_addCmd , "Maps Menu" )
|
||||
server_cmd(g_addCmd , "Menus Front-End" )
|
||||
server_cmd(g_addCmd , "Admin Base for MySQL" )
|
||||
server_cmd(g_addCmd , "Players Menu" )
|
||||
server_cmd(g_addCmd , "Teleport Menu" )
|
||||
}
|
||||
|
||||
public actionMenu(id,key){
|
||||
switch(key){
|
||||
case 6:{
|
||||
if (file_exists(g_fileToSave)){
|
||||
delete_file(g_fileToSave)
|
||||
client_print(id,print_chat,"* Configuration file cleared. Reload the map if needed")
|
||||
}
|
||||
else
|
||||
client_print(id,print_chat,"* Configuration was already cleared!")
|
||||
displayMenu(id,g_menuPos[id])
|
||||
}
|
||||
case 7:{
|
||||
if (saveSettings(g_fileToSave)){
|
||||
g_Modified = 0
|
||||
client_print(id,print_chat,"* Configuration saved successfully")
|
||||
}
|
||||
else
|
||||
client_print(id,print_chat,"* Configuration saving failed!!!")
|
||||
displayMenu(id,g_menuPos[id])
|
||||
}
|
||||
case 8: displayMenu(id,++g_menuPos[id])
|
||||
case 9: displayMenu(id,--g_menuPos[id])
|
||||
default:{
|
||||
new option = g_menuPos[id] * 6 + key
|
||||
new file[32],status[2]
|
||||
get_plugin(option,file,31,status,0,status,0,status,0,status,1)
|
||||
switch( status[0] ) {
|
||||
case 'r': pause("ac",file)
|
||||
case 'p': {
|
||||
g_Modified = 1
|
||||
pause("dc",file)
|
||||
}
|
||||
case 's': {
|
||||
g_Modified = 1
|
||||
unpause("ac",file)
|
||||
}
|
||||
}
|
||||
displayMenu(id,g_menuPos[id])
|
||||
}
|
||||
}
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
|
||||
getStatus( code, arg[], iarg ){
|
||||
switch(code){
|
||||
case 'r': copy( arg, iarg , "ON" )
|
||||
case 's': copy( arg, iarg , "STOPPED" )
|
||||
case 'p': copy( arg, iarg , "OFF" )
|
||||
case 'b': copy( arg, iarg , "ERROR" )
|
||||
default: copy( arg, iarg , "LOCKED" )
|
||||
}
|
||||
}
|
||||
|
||||
isSystem( id ){
|
||||
for( new a = 0; a < g_systemNum; ++a)
|
||||
if ( g_system[ a ] == id )
|
||||
return 1
|
||||
return 0
|
||||
}
|
||||
|
||||
displayMenu(id, pos){
|
||||
if (pos < 0) return
|
||||
new filename[32],title[32],status[8]
|
||||
new datanum = get_pluginsnum()
|
||||
new menu_body[512], start = pos * 6, k = 0
|
||||
if (start >= datanum) start = pos = g_menuPos[id] = 0
|
||||
new len = format(menu_body,511,
|
||||
g_cstrikeRunning ? "\yPause/Unpause Plugins\R%d/%d^n\w^n" : "Pause/Unpause Plugins %d/%d^n^n" ,
|
||||
pos + 1,((datanum/6)+((datanum%6)?1:0)))
|
||||
new end = start + 6, keys = (1<<9)|(1<<7)|(1<<6)
|
||||
if (end > datanum) end = datanum
|
||||
for(new a = start; a < end; ++a){
|
||||
get_plugin(a,filename,31,title,31,status,0,status,0,status,1)
|
||||
getStatus( status[0] , status , 7 )
|
||||
if ( isSystem( a ) || (status[0]!='O'&&status[0]!='S')) {
|
||||
if (g_cstrikeRunning){
|
||||
len += format(menu_body[len],511-len, "\d%d. %s\R%s^n\w",++k, title, status )
|
||||
}
|
||||
else{
|
||||
++k
|
||||
len += format(menu_body[len],511-len, "#. %s %s^n", title, status )
|
||||
}
|
||||
}
|
||||
else{
|
||||
keys |= (1<<k)
|
||||
len += format(menu_body[len],511-len,g_cstrikeRunning ? "%d. %s\y\R%s^n\w" : "%d. %s %s^n",++k,title, status )
|
||||
}
|
||||
}
|
||||
len += format(menu_body[len],511-len,"^n7. Clear file with stopped^n")
|
||||
len += format(menu_body[len],511-len,g_cstrikeRunning ? "8. Save stopped \y\R%s^n\w"
|
||||
: "8. Save stopped %s^n" ,g_Modified ? "*" : "")
|
||||
if (end != datanum){
|
||||
format(menu_body[len],511-len,"^n9. More...^n0. %s", pos ? "Back" : "Exit")
|
||||
keys |= (1<<8)
|
||||
}
|
||||
else format(menu_body[len],511-len,"^n0. %s", pos ? "Back" : "Exit")
|
||||
show_menu(id,keys,menu_body)
|
||||
}
|
||||
|
||||
public cmdMenu(id,level,cid){
|
||||
if (cmd_access(id,level,cid,1))
|
||||
displayMenu(id,g_menuPos[id] = 0)
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
|
||||
pausePlugins(id){
|
||||
new filename[32],title[32],status[2]
|
||||
new count = 0, imax = get_pluginsnum()
|
||||
for (new a=0;a<imax;++a){
|
||||
get_plugin(a,filename,31,title,31,status,0,status,0,status,1)
|
||||
if ( !isSystem( a ) && status[0]=='r' && pause("ac",filename) ) {
|
||||
//console_print(id,"Pausing %s (file ^"%s^")",title,filename)
|
||||
++count
|
||||
}
|
||||
}
|
||||
console_print(id,"Paused %d plugin%s",count,(count==1)?"":"s")
|
||||
}
|
||||
|
||||
unpausePlugins(id){
|
||||
new filename[32],title[32],status[2]
|
||||
new count = 0, imax = get_pluginsnum()
|
||||
for (new a=0;a<imax;++a){
|
||||
get_plugin(a,filename,31,title,31,status,0,status,0,status,1)
|
||||
if ( !isSystem( a ) && status[0]=='p' && unpause("ac",filename) ) {
|
||||
//console_print(id,"Unpausing %s (file ^"%s^")",title,filename)
|
||||
++count
|
||||
}
|
||||
}
|
||||
console_print(id,"Unpaused %d plugin%s",count,(count==1)?"":"s")
|
||||
}
|
||||
|
||||
findPluginByFile(arg[32],&len){
|
||||
new name[32],title[32],status[2]
|
||||
new inum = get_pluginsnum()
|
||||
for(new a = 0; a < inum; ++a){
|
||||
get_plugin(a,name,31,title,31,status,0,status,0,status,1)
|
||||
if ( equali(name,arg,len) && (status[0]=='r'||status[0]=='p'||status[0]=='s') ){
|
||||
len = copy(arg,31,name)
|
||||
return a
|
||||
}
|
||||
}
|
||||
return -1
|
||||
}
|
||||
|
||||
findPluginByTitle(name[],file[],len){
|
||||
new title[32],status[2]
|
||||
new inum = get_pluginsnum()
|
||||
for(new a = 0; a < inum; ++a){
|
||||
get_plugin(a,file,len,title,31,status,0,status,0,status,1)
|
||||
if ( equali( title , name ) )
|
||||
return a
|
||||
}
|
||||
return -1
|
||||
}
|
||||
|
||||
public cmdPlugin(id,level,cid){
|
||||
if (!cmd_access(id,level,cid,1))
|
||||
return PLUGIN_HANDLED
|
||||
new cmds[32]
|
||||
read_argv(1,cmds,31)
|
||||
if ( equal(cmds, "add" ) && read_argc() > 2 ) {
|
||||
read_argv(2, cmds ,31)
|
||||
new file[2]
|
||||
if ( (g_system[ g_systemNum ] = findPluginByTitle( cmds , file , 0 )) != -1 ) {
|
||||
if ( g_systemNum < MAX_SYSTEM )
|
||||
g_systemNum++
|
||||
else
|
||||
console_print( id , "Can't mark more plugins as unpauseable!" )
|
||||
}
|
||||
}
|
||||
else if ( equal(cmds, "off" ) ){
|
||||
pausePlugins(id)
|
||||
}
|
||||
else if ( equal(cmds, "on" ) ){
|
||||
unpausePlugins(id)
|
||||
}
|
||||
else if ( equal(cmds, "save" ) ){
|
||||
if (saveSettings(g_fileToSave)){
|
||||
g_Modified = 0
|
||||
console_print(id,"Configuration saved successfully")
|
||||
}
|
||||
else
|
||||
console_print(id,"Configuration saving failed!!!")
|
||||
}
|
||||
else if ( equal(cmds, "clear" ) ) {
|
||||
if (file_exists(g_fileToSave)){
|
||||
delete_file(g_fileToSave)
|
||||
console_print(id,"Configuration file cleared. Reload the map if needed")
|
||||
}
|
||||
else
|
||||
console_print(id,"Configuration was already cleared!")
|
||||
}
|
||||
else if ( equal(cmds, "pause" ) ) {
|
||||
new arg[32], a ,len = read_argv(2,arg,31)
|
||||
if ( len && ((a = findPluginByFile(arg,len)) != -1) && !isSystem( a ) && pause("ac",arg) )
|
||||
console_print(id,g_pluginMatch,arg , "paused")
|
||||
else console_print(id,g_couldntFind,arg)
|
||||
}
|
||||
else if ( equal(cmds, "enable" ) ) {
|
||||
new arg[32], a , len = read_argv(2,arg,31)
|
||||
if ( len && (a = findPluginByFile(arg,len)) != -1 && !isSystem( a ) && unpause("ac",arg) )
|
||||
console_print(id,g_pluginMatch,arg , "unpaused")
|
||||
else console_print(id,g_couldntFind,arg)
|
||||
}
|
||||
else if ( equal(cmds, "stop" ) ) {
|
||||
new arg[32], a, len = read_argv(2,arg,31)
|
||||
if ( len && (a = findPluginByFile(arg,len)) != -1 && !isSystem( a ) && pause("dc",arg)){
|
||||
g_Modified = 1
|
||||
console_print(id,g_pluginMatch,arg , "stopped")
|
||||
}
|
||||
else console_print(id,g_couldntFind,arg)
|
||||
}
|
||||
else if ( equal(cmds, "list" ) ) {
|
||||
new arg1[8], running = 0
|
||||
new start = read_argv(2,arg1,7) ? strtonum(arg1) : 1
|
||||
if (--start < 0) start = 0
|
||||
new plgnum = get_pluginsnum()
|
||||
if (start >= plgnum) start = plgnum - 1
|
||||
console_print(id,"^n----- Pause Plugins: Loaded plugins -----")
|
||||
console_print(id, " %-18.17s %-8.7s %-17.16s %-16.15s %-9.8s","name","version","author","file","status")
|
||||
new plugin[32],title[32],version[16],author[32],status[16]
|
||||
new end = start + 10
|
||||
if (end > plgnum) end = plgnum
|
||||
for (new a = start; a < end; ++a){
|
||||
get_plugin(a,plugin,31,title,31,version,15,author,31,status,15)
|
||||
if (status[0] == 'r') ++running
|
||||
console_print(id, " [%3d] %-18.17s %-8.7s %-17.16s %-16.15s %-9.8s",a+1,title,version,author,plugin, status )
|
||||
|
||||
}
|
||||
console_print(id,"----- Entries %d - %d of %d (%d running) -----",start+1,end,plgnum,running)
|
||||
if (end < plgnum)
|
||||
console_print(id,"----- Use 'amx_pausecfg list %d' for more -----",end+1)
|
||||
else
|
||||
console_print(id,"----- Use 'amx_pausecfg list 1' for begin -----")
|
||||
}
|
||||
else {
|
||||
console_print(id,"Usage: amx_pausecfg <command> [name]")
|
||||
console_print(id,"Commands:")
|
||||
console_print(id,"^toff - pauses all plugins not in the list")
|
||||
console_print(id,"^ton - unpauses all plugins")
|
||||
console_print(id,"^tstop <file> - stops a plugin")
|
||||
console_print(id,"^tpause <file> - pauses a plugin")
|
||||
console_print(id,"^tenable <file> - enables a plugin")
|
||||
console_print(id,"^tsave - saves a list of stopped plugins")
|
||||
console_print(id,"^tclear - clears a list of stopped plugins")
|
||||
console_print(id,"^tlist [id] - lists plugins")
|
||||
console_print(id,"^tadd <title> - marks a plugin as unpauseable")
|
||||
}
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
|
||||
saveSettings(filename[]){
|
||||
if (file_exists(filename))
|
||||
delete_file(filename)
|
||||
new text[256], file[32],title[32],status[2]
|
||||
new inum = get_pluginsnum()
|
||||
if (!write_file(filename,";Generated by Pause Plugins Plugin. Do not modify!^n;Title Filename"))
|
||||
return 0
|
||||
for(new a = 0; a < inum; ++a){
|
||||
get_plugin(a,file,31,title,31,status,0,status,0,status,1)
|
||||
if ( status[0] == 's' ){
|
||||
format(text,255,"^"%s^" ;%s",title,file)
|
||||
write_file(filename,text)
|
||||
}
|
||||
}
|
||||
return 1
|
||||
}
|
||||
|
||||
loadSettings(filename[]){
|
||||
if (!file_exists(filename)) return 0
|
||||
new name[256], file[32], i, pos = 0
|
||||
while (read_file(filename,pos++,name,255,i)){
|
||||
if ( name[0]!= ';' && parse(name,name,31) &&
|
||||
(i = findPluginByTitle( name , file , 31 ) != -1) )
|
||||
pause("dc", file )
|
||||
}
|
||||
return 1
|
||||
}
|
689
plugins/plmenu.sma
Executable file
689
plugins/plmenu.sma
Executable file
@@ -0,0 +1,689 @@
|
||||
/* AMX Mod script.
|
||||
*
|
||||
* (c) 2003, OLO
|
||||
* This file is provided as is (no warranties).
|
||||
*
|
||||
* Admin commands:
|
||||
* amx_kickmenu - displays kick menu
|
||||
* amx_banmenu - displays ban menu
|
||||
* amx_slapmenu - displays slap/slay menu
|
||||
* amx_teammenu - displays team menu
|
||||
* amx_clcmdmenu - displays client commands menu
|
||||
*
|
||||
*/
|
||||
|
||||
#include <amxmod>
|
||||
#include <amxmisc>
|
||||
|
||||
new g_menuPosition[33]
|
||||
new g_menuPlayers[33][32]
|
||||
new g_menuPlayersNum[33]
|
||||
new g_menuOption[33]
|
||||
new g_menuSettings[33]
|
||||
|
||||
new g_menuSelect[33][64]
|
||||
new g_menuSelectNum[33]
|
||||
|
||||
#define MAX_CLCMDS 24
|
||||
|
||||
new g_clcmdName[MAX_CLCMDS][32]
|
||||
new g_clcmdCmd[MAX_CLCMDS][64]
|
||||
new g_clcmdMisc[MAX_CLCMDS][2]
|
||||
new g_clcmdNum
|
||||
|
||||
new g_logFile[16]
|
||||
|
||||
new g_cstrikeRunning
|
||||
|
||||
public plugin_init()
|
||||
{
|
||||
register_plugin("Players Menu","0.9","default")
|
||||
register_clcmd("amx_kickmenu","cmdKickMenu",ADMIN_KICK,"- displays kick menu")
|
||||
register_clcmd("amx_banmenu","cmdBanMenu",ADMIN_BAN,"- displays ban menu")
|
||||
register_clcmd("amx_slapmenu","cmdSlapMenu",ADMIN_SLAY,"- displays slap/slay menu")
|
||||
register_clcmd("amx_teammenu","cmdTeamMenu",ADMIN_LEVEL_A,"- displays team menu")
|
||||
register_clcmd("amx_clcmdmenu","cmdClcmdMenu",ADMIN_LEVEL_A,"- displays client cmds menu")
|
||||
|
||||
register_menucmd(register_menuid("Ban Menu"),1023,"actionBanMenu")
|
||||
register_menucmd(register_menuid("Kick Menu"),1023,"actionKickMenu")
|
||||
register_menucmd(register_menuid("Slap/Slay Menu"),1023,"actionSlapMenu")
|
||||
register_menucmd(register_menuid("Team Menu"),1023,"actionTeamMenu")
|
||||
register_menucmd(register_menuid("Client Cmds Menu"),1023,"actionClcmdMenu")
|
||||
|
||||
g_cstrikeRunning = is_running("cstrike")
|
||||
|
||||
new filename[64]
|
||||
build_path( filename , 63 , "$basedir/clcmds.ini" )
|
||||
load_settings( filename )
|
||||
|
||||
get_logfile(g_logFile,15)
|
||||
}
|
||||
|
||||
/* Ban menu */
|
||||
|
||||
public actionBanMenu(id,key)
|
||||
{
|
||||
switch(key){
|
||||
case 7:{
|
||||
++g_menuOption[id]
|
||||
g_menuOption[id] %= 3
|
||||
|
||||
switch(g_menuOption[id]){
|
||||
case 0: g_menuSettings[id] = 0
|
||||
case 1: g_menuSettings[id] = 5
|
||||
case 2: g_menuSettings[id] = 60
|
||||
}
|
||||
|
||||
displayBanMenu(id,g_menuPosition[id])
|
||||
}
|
||||
case 8: displayBanMenu(id,++g_menuPosition[id])
|
||||
case 9: displayBanMenu(id,--g_menuPosition[id])
|
||||
default:{
|
||||
new player = g_menuPlayers[id][g_menuPosition[id] * 7 + key]
|
||||
|
||||
new name[32], name2[32], authid[32],authid2[32]
|
||||
get_user_name(player,name2,31)
|
||||
get_user_authid(id,authid,31)
|
||||
get_user_authid(player,authid2,31)
|
||||
get_user_name(id,name,31)
|
||||
new userid2 = get_user_userid(player)
|
||||
|
||||
log_to_file(g_logFile,"Ban: ^"%s<%d><%s><>^" ban and kick ^"%s<%d><%s><>^" (minutes ^"%d^")",
|
||||
name,get_user_userid(id),authid, name2,userid2,authid2, g_menuSettings[id] )
|
||||
|
||||
switch(get_cvar_num("amx_show_activity")) {
|
||||
case 2: client_print(0,print_chat,"ADMIN %s: ban %s",name,name2)
|
||||
case 1: client_print(0,print_chat,"ADMIN: ban %s",name2)
|
||||
}
|
||||
|
||||
if (equal("4294967295",authid2)){ /* lan */
|
||||
new ipa[32]
|
||||
get_user_ip(player,ipa,31,1)
|
||||
server_cmd("addip %d %s;writeip",g_menuSettings[id],ipa)
|
||||
}
|
||||
else
|
||||
server_cmd("banid %d #%d kick;writeid",g_menuSettings[id],userid2)
|
||||
|
||||
server_exec()
|
||||
|
||||
displayBanMenu(id,g_menuPosition[id])
|
||||
}
|
||||
}
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
|
||||
|
||||
displayBanMenu(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 * 7
|
||||
|
||||
if (start >= g_menuPlayersNum[id])
|
||||
start = pos = g_menuPosition[id] = 0
|
||||
|
||||
new len = format(menuBody,511, g_cstrikeRunning ?
|
||||
"\yBan Menu\R%d/%d^n\w^n" : "Ban Menu %d/%d^n^n",
|
||||
pos+1,( g_menuPlayersNum[id] / 7 + ((g_menuPlayersNum[id] % 7) ? 1 : 0 )) )
|
||||
|
||||
new end = start + 7
|
||||
new keys = (1<<9)|(1<<7)
|
||||
|
||||
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 ( is_user_bot(i) || (get_user_flags(i)&ADMIN_IMMUNITY) )
|
||||
{
|
||||
++b
|
||||
if ( g_cstrikeRunning )
|
||||
len += format(menuBody[len],511-len,"\d%d. %s^n\w",b,name)
|
||||
else
|
||||
len += format(menuBody[len],511-len,"#. %s^n",name)
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
keys |= (1<<b)
|
||||
len += format(menuBody[len],511-len,"%d. %s^n",++b,name)
|
||||
}
|
||||
}
|
||||
|
||||
if ( g_menuSettings[id] )
|
||||
len += format(menuBody[len],511-len,"^n8. Ban on %d minutes^n" , g_menuSettings[id] )
|
||||
else
|
||||
len += format(menuBody[len],511-len,"^n8. Ban permanently^n" )
|
||||
|
||||
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 cmdBanMenu(id,level,cid)
|
||||
{
|
||||
if (!cmd_access(id,level,cid,1)) return PLUGIN_HANDLED
|
||||
|
||||
g_menuOption[id] = 1
|
||||
g_menuSettings[id] = 5
|
||||
displayBanMenu(id,g_menuPosition[id] = 0)
|
||||
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
|
||||
/* Slap/Slay */
|
||||
|
||||
public actionSlapMenu(id,key)
|
||||
{
|
||||
switch(key){
|
||||
case 7:{
|
||||
++g_menuOption[id]
|
||||
g_menuOption[id] %= 4
|
||||
switch(g_menuOption[id]){
|
||||
case 1: g_menuSettings[id] = 0
|
||||
case 2: g_menuSettings[id] = 1
|
||||
case 3: g_menuSettings[id] = 5
|
||||
}
|
||||
displaySlapMenu(id,g_menuPosition[id])
|
||||
}
|
||||
case 8: displaySlapMenu(id,++g_menuPosition[id])
|
||||
case 9: displaySlapMenu(id,--g_menuPosition[id])
|
||||
default:{
|
||||
new player = g_menuPlayers[id][g_menuPosition[id] * 7 + key]
|
||||
|
||||
new name2[32]
|
||||
get_user_name(player,name2,31)
|
||||
|
||||
if (!is_user_alive(player))
|
||||
{
|
||||
client_print(id,print_chat,"That action can't be performed on dead client ^"%s^"",name2)
|
||||
displaySlapMenu(id,g_menuPosition[id])
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
|
||||
new authid[32],authid2[32], name[32]
|
||||
|
||||
get_user_authid(id,authid,31)
|
||||
get_user_authid(player,authid2,31)
|
||||
get_user_name(id,name,31)
|
||||
|
||||
if ( g_menuOption[id] ) {
|
||||
log_to_file(g_logFile,"Cmd: ^"%s<%d><%s><>^" slap with %d damage ^"%s<%d><%s><>^"",
|
||||
name,get_user_userid(id),authid, g_menuSettings[id], name2,get_user_userid(player),authid2 )
|
||||
switch(get_cvar_num("amx_show_activity")) {
|
||||
case 2: client_print(0,print_chat,"ADMIN %s: slap %s with %d damage",name,name2,g_menuSettings[id])
|
||||
case 1: client_print(0,print_chat,"ADMIN: slap %s with %d damage",name2,g_menuSettings[id])
|
||||
}
|
||||
}
|
||||
else {
|
||||
log_to_file(g_logFile,"Cmd: ^"%s<%d><%s><>^" slay ^"%s<%d><%s><>^"",
|
||||
name,get_user_userid(id),authid, name2,get_user_userid(player),authid2 )
|
||||
switch(get_cvar_num("amx_show_activity")) {
|
||||
case 2: client_print(0,print_chat,"ADMIN %s: slay %s",name,name2)
|
||||
case 1: client_print(0,print_chat,"ADMIN: slay %s",name2)
|
||||
}
|
||||
}
|
||||
|
||||
if ( g_menuOption[id])
|
||||
user_slap(player, ( get_user_health(player) > g_menuSettings[id] ) ? g_menuSettings[id] : 0 )
|
||||
else
|
||||
user_kill( player )
|
||||
|
||||
displaySlapMenu(id,g_menuPosition[id])
|
||||
}
|
||||
}
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
|
||||
|
||||
displaySlapMenu(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], team[4]
|
||||
new start = pos * 7
|
||||
|
||||
if (start >= g_menuPlayersNum[id])
|
||||
start = pos = g_menuPosition[id] = 0
|
||||
|
||||
new len = format(menuBody,511, g_cstrikeRunning ?
|
||||
"\ySlap/Slay Menu\R%d/%d^n\w^n" : "Slap/Slay Menu %d/%d^n^n" ,
|
||||
pos+1,( g_menuPlayersNum[id] / 7 + ((g_menuPlayersNum[id] % 7) ? 1 : 0 )) )
|
||||
|
||||
new end = start + 7
|
||||
new keys = (1<<9)|(1<<7)
|
||||
|
||||
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)
|
||||
get_user_team(i,team,3)
|
||||
|
||||
if ( !is_user_alive(i) || (get_user_flags(i)&ADMIN_IMMUNITY) )
|
||||
{
|
||||
++b
|
||||
if ( g_cstrikeRunning )
|
||||
len += format(menuBody[len],511-len,"\d%d. %s\R%s^n\w", b,name,team)
|
||||
else
|
||||
len += format(menuBody[len],511-len,"#. %s %s^n",name,team)
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
keys |= (1<<b)
|
||||
|
||||
len += format(menuBody[len],511-len, g_cstrikeRunning ?
|
||||
"%d. %s\y\R%s^n\w" : "%d. %s %s^n",++b,name,team)
|
||||
}
|
||||
}
|
||||
|
||||
if ( g_menuOption[id] )
|
||||
len += format(menuBody[len],511-len,"^n8. Slap with %d damage^n",g_menuSettings[id] )
|
||||
else
|
||||
len += format(menuBody[len],511-len,"^n8. Slay^n")
|
||||
|
||||
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 cmdSlapMenu(id,level,cid)
|
||||
{
|
||||
if (!cmd_access(id,level,cid,1)) return PLUGIN_HANDLED
|
||||
|
||||
g_menuOption[id] = 0
|
||||
g_menuSettings[id] = 0
|
||||
|
||||
displaySlapMenu(id,g_menuPosition[id] = 0)
|
||||
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
|
||||
/* Kick */
|
||||
|
||||
public actionKickMenu(id,key)
|
||||
{
|
||||
switch(key){
|
||||
case 8: displayKickMenu(id,++g_menuPosition[id])
|
||||
case 9: displayKickMenu(id,--g_menuPosition[id])
|
||||
default:{
|
||||
new player = g_menuPlayers[id][g_menuPosition[id] * 8 + key]
|
||||
|
||||
new authid[32],authid2[32], name[32], name2[32]
|
||||
get_user_authid(id,authid,31)
|
||||
get_user_authid(player,authid2,31)
|
||||
get_user_name(id,name,31)
|
||||
get_user_name(player,name2,31)
|
||||
new userid2 = get_user_userid(player)
|
||||
|
||||
log_to_file(g_logFile,"Kick: ^"%s<%d><%s><>^" kick ^"%s<%d><%s><>^"",
|
||||
name,get_user_userid(id),authid, name2,userid2,authid2 )
|
||||
|
||||
switch(get_cvar_num("amx_show_activity")) {
|
||||
case 2: client_print(0,print_chat,"ADMIN %s: kick %s",name,name2)
|
||||
case 1: client_print(0,print_chat,"ADMIN: kick %s",name2)
|
||||
}
|
||||
|
||||
server_cmd("kick #%d",userid2)
|
||||
server_exec()
|
||||
|
||||
displayKickMenu(id,g_menuPosition[id])
|
||||
}
|
||||
}
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
|
||||
|
||||
displayKickMenu(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, g_cstrikeRunning ?
|
||||
"\yKick Menu\R%d/%d^n\w^n" : "Kick Menu %d/%d^n^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 ( get_user_flags(i) & ADMIN_IMMUNITY )
|
||||
{
|
||||
++b
|
||||
if ( g_cstrikeRunning )
|
||||
len += format(menuBody[len],511-len,"\d%d. %s^n\w",b,name)
|
||||
else
|
||||
len += format(menuBody[len],511-len,"#. %s^n",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 cmdKickMenu(id,level,cid)
|
||||
{
|
||||
if (cmd_access(id,level,cid,1))
|
||||
displayKickMenu(id,g_menuPosition[id] = 0)
|
||||
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
|
||||
/* Team menu */
|
||||
|
||||
public actionTeamMenu(id,key)
|
||||
{
|
||||
switch(key){
|
||||
case 7:{
|
||||
g_menuOption[id] = 1 - g_menuOption[id]
|
||||
displayTeamMenu(id,g_menuPosition[id])
|
||||
}
|
||||
case 8: displayTeamMenu(id,++g_menuPosition[id])
|
||||
case 9: displayTeamMenu(id,--g_menuPosition[id])
|
||||
default:{
|
||||
new player = g_menuPlayers[id][g_menuPosition[id] * 7 + key]
|
||||
new authid[32],authid2[32], name[32], name2[32]
|
||||
get_user_name(player,name2,31)
|
||||
get_user_authid(id,authid,31)
|
||||
get_user_authid(player,authid2,31)
|
||||
get_user_name(id,name,31)
|
||||
|
||||
log_to_file(g_logFile,"Cmd: ^"%s<%d><%s><>^" transfer ^"%s<%d><%s><>^" (team ^"%s^")",
|
||||
name,get_user_userid(id),authid, name2,get_user_userid(player),authid2, g_menuOption[id] ? "TERRORIST" : "CT" )
|
||||
|
||||
switch(get_cvar_num("amx_show_activity")) {
|
||||
case 2: client_print(0,print_chat,"ADMIN %s: transfer %s to %s",name,name2,g_menuOption[id] ? "TERRORIST" : "CT" )
|
||||
case 1: client_print(0,print_chat,"ADMIN: transfer %s to %s",name2,g_menuOption[id] ? "TERRORIST" : "CT" )
|
||||
}
|
||||
|
||||
new limitt = get_cvar_num("mp_limitteams")
|
||||
set_cvar_num("mp_limitteams",0)
|
||||
user_kill(player,1)
|
||||
engclient_cmd(player, "chooseteam")
|
||||
engclient_cmd(player, "menuselect", g_menuOption[id] ? "1" : "2" )
|
||||
engclient_cmd(player, "menuselect", "5")
|
||||
client_cmd(player,"slot1")
|
||||
set_cvar_num("mp_limitteams",limitt)
|
||||
|
||||
displayTeamMenu(id,g_menuPosition[id])
|
||||
}
|
||||
}
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
|
||||
|
||||
displayTeamMenu(id,pos){
|
||||
|
||||
if (pos < 0) return
|
||||
|
||||
get_players(g_menuPlayers[id],g_menuPlayersNum[id])
|
||||
|
||||
new menuBody[512]
|
||||
new b = 0
|
||||
new i, iteam
|
||||
new name[32], team[4]
|
||||
new start = pos * 7
|
||||
|
||||
if (start >= g_menuPlayersNum[id])
|
||||
start = pos = g_menuPosition[id] = 0
|
||||
|
||||
new len = format(menuBody,511, g_cstrikeRunning ?
|
||||
"\yTeam Menu\R%d/%d^n\w^n" : "Team Menu %d/%d^n^n",
|
||||
pos+1,( g_menuPlayersNum[id] / 7 + ((g_menuPlayersNum[id] % 7) ? 1 : 0 )) )
|
||||
|
||||
new end = start + 7
|
||||
new keys = (1<<9)|(1<<7)
|
||||
|
||||
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)
|
||||
iteam = get_user_team(i,team,3)
|
||||
|
||||
if ( (iteam == (g_menuOption[id] ? 1 : 2)) || (get_user_flags(i)&ADMIN_IMMUNITY) )
|
||||
{
|
||||
++b
|
||||
if ( g_cstrikeRunning )
|
||||
len += format(menuBody[len],511-len,"\d%d. %s\R%s^n\w",b,name,team)
|
||||
else
|
||||
len += format(menuBody[len],511-len,"#. %s %s^n",name,team)
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
keys |= (1<<b)
|
||||
len += format(menuBody[len],511-len, g_cstrikeRunning ?
|
||||
"%d. %s\y\R%s^n\w" : "%d. %s %s^n",++b,name,team)
|
||||
}
|
||||
}
|
||||
|
||||
len += format(menuBody[len],511-len,"^n8. Transfer to %s^n",g_menuOption[id] ? "TERRORIST" : "CT" )
|
||||
|
||||
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 cmdTeamMenu(id,level,cid)
|
||||
{
|
||||
if (!cmd_access(id,level,cid,1)) return PLUGIN_HANDLED
|
||||
|
||||
g_menuOption[id] = 0
|
||||
|
||||
displayTeamMenu(id,g_menuPosition[id] = 0)
|
||||
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
|
||||
/* Client cmds menu */
|
||||
|
||||
public actionClcmdMenu(id,key)
|
||||
{
|
||||
switch(key){
|
||||
case 7:{
|
||||
++g_menuOption[id]
|
||||
g_menuOption[id] %= g_menuSelectNum[id]
|
||||
displayClcmdMenu(id,g_menuPosition[id])
|
||||
}
|
||||
case 8: displayClcmdMenu(id,++g_menuPosition[id])
|
||||
case 9: displayClcmdMenu(id,--g_menuPosition[id])
|
||||
default:{
|
||||
new player = g_menuPlayers[id][g_menuPosition[id] * 7 + key]
|
||||
new flags = g_clcmdMisc[g_menuSelect[id][g_menuOption[id]]][1]
|
||||
if (is_user_connected(player)) {
|
||||
new command[64], authid[32], name[32], userid[32]
|
||||
copy(command,63,g_clcmdCmd[g_menuSelect[id][g_menuOption[id]]])
|
||||
get_user_authid(player,authid,31)
|
||||
get_user_name(player,name,31)
|
||||
numtostr(get_user_userid(player),userid,31)
|
||||
replace(command,63,"%userid%",userid)
|
||||
replace(command,63,"%authid%",authid)
|
||||
replace(command,63,"%name%",name)
|
||||
if (flags & 1){
|
||||
server_cmd(command)
|
||||
server_exec()
|
||||
}
|
||||
else if (flags & 2)
|
||||
client_cmd(id,command)
|
||||
else if (flags & 4)
|
||||
client_cmd(player,command)
|
||||
}
|
||||
if (flags & 8) displayClcmdMenu(id,g_menuPosition[id])
|
||||
}
|
||||
}
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
|
||||
|
||||
displayClcmdMenu(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 * 7
|
||||
|
||||
if (start >= g_menuPlayersNum[id])
|
||||
start = pos = g_menuPosition[id] = 0
|
||||
|
||||
new len = format(menuBody,511, g_cstrikeRunning ?
|
||||
"\yClient Cmds Menu\R%d/%d^n\w^n" : "Client Cmds Menu %d/%d^n^n",
|
||||
pos+1,( g_menuPlayersNum[id] / 7 + ((g_menuPlayersNum[id] % 7) ? 1 : 0 )) )
|
||||
|
||||
new end = start + 7
|
||||
new keys = (1<<9)|(1<<7)
|
||||
|
||||
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 ( !g_menuSelectNum[id] || get_user_flags(i)&ADMIN_IMMUNITY )
|
||||
{
|
||||
++b
|
||||
if ( g_cstrikeRunning )
|
||||
len += format(menuBody[len],511-len,"\d%d. %s^n\w",b,name)
|
||||
else
|
||||
len += format(menuBody[len],511-len,"#. %s^n",name)
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
keys |= (1<<b)
|
||||
len += format(menuBody[len],511-len,"%d. %s^n",++b,name)
|
||||
}
|
||||
}
|
||||
|
||||
if ( g_menuSelectNum[id] )
|
||||
len += format(menuBody[len],511-len,"^n8. %s^n", g_clcmdName[g_menuSelect[id][g_menuOption[id]]] )
|
||||
else
|
||||
len += format(menuBody[len],511-len,"^n8. No cmds available^n")
|
||||
|
||||
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 cmdClcmdMenu(id,level,cid)
|
||||
{
|
||||
if (!cmd_access(id,level,cid,1)) return PLUGIN_HANDLED
|
||||
|
||||
new flags = get_user_flags(id)
|
||||
|
||||
g_menuSelectNum[id] = 0
|
||||
|
||||
for(new a = 0; a < g_clcmdNum; ++a)
|
||||
if (g_clcmdMisc[a][0] & flags)
|
||||
g_menuSelect[id][g_menuSelectNum[id]++] = a
|
||||
|
||||
g_menuOption[id] = 0
|
||||
|
||||
displayClcmdMenu(id,g_menuPosition[id] = 0)
|
||||
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
|
||||
load_settings( szFilename[] )
|
||||
{
|
||||
|
||||
if ( !file_exists ( szFilename ) )
|
||||
return 0
|
||||
|
||||
new text[256], szFlags[32], szAccess[32]
|
||||
new a, pos = 0
|
||||
|
||||
while ( g_clcmdNum < MAX_CLCMDS && read_file (szFilename,pos++,text,255,a) )
|
||||
{
|
||||
if ( text[0] == ';' ) continue
|
||||
|
||||
if ( parse( text , g_clcmdName[g_clcmdNum] , 31 ,
|
||||
g_clcmdCmd[g_clcmdNum] ,63,szFlags,31,szAccess,31 ) > 3 )
|
||||
{
|
||||
while ( replace( g_clcmdCmd[ g_clcmdNum ] ,63,"\'","^"") ) {
|
||||
// do nothing
|
||||
}
|
||||
|
||||
g_clcmdMisc[ g_clcmdNum ][1] = read_flags ( szFlags )
|
||||
g_clcmdMisc[ g_clcmdNum ][0] = read_flags ( szAccess )
|
||||
g_clcmdNum++
|
||||
}
|
||||
}
|
||||
|
||||
return 1
|
||||
}
|
396
plugins/ppause.sma
Executable file
396
plugins/ppause.sma
Executable file
@@ -0,0 +1,396 @@
|
||||
/* AMX Mod script.
|
||||
*
|
||||
* (c) 2003, OLO
|
||||
* This file is provided as is (no warranties).
|
||||
*
|
||||
* Admin commads:
|
||||
* amx_pausemenu - displays menu by which you can pause, unpause and stop plugins
|
||||
* amx_plugin - displays help for all commands for that plugin
|
||||
*
|
||||
* WARNING: Stopped plugins won't work properly after activation
|
||||
* (without mapchange) due to unactive status during plugins initialization
|
||||
* and at players connections. For proper activation clear the file with
|
||||
* stopped plugins (option #7 in menu) or unstop selected one then change the map.
|
||||
*/
|
||||
|
||||
#include <amxmod>
|
||||
#include <amxmisc>
|
||||
|
||||
|
||||
// Uncomment if you want to have two new commands
|
||||
// amx_off - pause plugins not registered in the unpauseable list
|
||||
// amx_on - enable all plugins not registered in the unpauseable list
|
||||
//#define DIRECT_ONOFF
|
||||
|
||||
#define MAX_PLGDATA 64
|
||||
#define MAX_PLUGINS 192
|
||||
|
||||
enum {
|
||||
PLG_ERROR,
|
||||
PLG_ON,
|
||||
PLG_OFF,
|
||||
PLG_STOPPED
|
||||
}
|
||||
|
||||
new g_pluginList[MAX_PLGDATA][32]
|
||||
new g_pluginListNum
|
||||
new g_menuPos[33]
|
||||
new g_dontPause[MAX_PLGDATA]
|
||||
new g_dontPauseNum
|
||||
new g_pluginStatus[MAX_PLUGINS]
|
||||
new bool:g_Modified
|
||||
|
||||
new g_fileToSave[64]
|
||||
new g_cstrikeRunning
|
||||
|
||||
public plugin_init(){
|
||||
register_plugin("Pause Plugins","0.9","default")
|
||||
|
||||
#if defined DIRECT_ONOFF
|
||||
register_concmd("amx_off","cmdOFF",ADMIN_CFG,"- pause some plugins")
|
||||
register_concmd("amx_on","cmdON",ADMIN_CFG,"- unpause some plugins")
|
||||
#endif
|
||||
|
||||
register_concmd("amx_plugin","cmdPause",ADMIN_CFG,"- list cmds. for pause/unpause managment")
|
||||
register_clcmd("amx_pausemenu","cmdMenu",ADMIN_CFG,"- pause or unpause plugins via menu")
|
||||
register_menucmd(register_menuid("Pause/Unpause Plugins"),1023,"actionMenu")
|
||||
|
||||
get_localinfo( "amx_basedir", g_fileToSave , 31 )
|
||||
format( g_fileToSave , 63, "%s/ppause.ini" , g_fileToSave )
|
||||
|
||||
loadSettings(g_fileToSave)
|
||||
|
||||
new mod_name[32]
|
||||
get_modname(mod_name,31)
|
||||
g_cstrikeRunning = equal(mod_name,"cstrike")
|
||||
}
|
||||
|
||||
new g_addCmd[] = "amx_plugin add ^"%s^""
|
||||
|
||||
public plugin_cfg() {
|
||||
/* Put here titles of plugins which you don't want to pause. */
|
||||
server_cmd(g_addCmd , "Pause Plugins" )
|
||||
server_cmd(g_addCmd , "Admin Commands" )
|
||||
server_cmd(g_addCmd , "TimeLeft" )
|
||||
server_cmd(g_addCmd , "Slots Reservation" )
|
||||
server_cmd(g_addCmd , "Admin Chat" )
|
||||
server_cmd(g_addCmd , "NextMap" )
|
||||
server_cmd(g_addCmd , "Admin Menu" )
|
||||
server_cmd(g_addCmd , "Admin Help" )
|
||||
server_cmd(g_addCmd , "Admin Base" )
|
||||
server_cmd(g_addCmd , "Welcome Message" )
|
||||
server_cmd(g_addCmd , "Stats Settings" )
|
||||
}
|
||||
|
||||
public actionMenu(id,key){
|
||||
switch(key){
|
||||
case 6:{
|
||||
if (file_exists(g_fileToSave)){
|
||||
delete_file(g_fileToSave)
|
||||
client_print(id,print_chat,"* Configuration file cleared")
|
||||
}
|
||||
else
|
||||
client_print(id,print_chat,"* Configuration was already cleared!")
|
||||
displayMenu(id,g_menuPos[id])
|
||||
}
|
||||
case 7:{
|
||||
if (saveSettings(g_fileToSave)){
|
||||
g_Modified = false
|
||||
client_print(id,print_chat,"* Configuration saved successfully")
|
||||
}
|
||||
else
|
||||
client_print(id,print_chat,"* Configuration saving failed!!!")
|
||||
displayMenu(id,g_menuPos[id])
|
||||
}
|
||||
case 8: displayMenu(id,++g_menuPos[id])
|
||||
case 9: displayMenu(id,--g_menuPos[id])
|
||||
default:{
|
||||
new option = g_menuPos[id] * 6 + key
|
||||
new filename[32],title[32],version[2],author[2],status[2]
|
||||
get_plugin(option,filename,31,title,31,version,0,author,0,status,1)
|
||||
if (status[0]=='r'){
|
||||
pause("ac",filename)
|
||||
g_pluginStatus[option]=PLG_OFF
|
||||
}
|
||||
else if ( g_pluginStatus[option]!=PLG_STOPPED && status[0]=='p' ){
|
||||
g_pluginStatus[option]=PLG_STOPPED
|
||||
g_Modified = true
|
||||
}
|
||||
else {
|
||||
unpause("ac",filename)
|
||||
g_pluginStatus[option]=PLG_ON
|
||||
}
|
||||
displayMenu(id,g_menuPos[id])
|
||||
}
|
||||
}
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
|
||||
displayMenu(id, pos){
|
||||
if (pos < 0) return
|
||||
new filename[32],title[32],version[2],author[2],status[2]
|
||||
new datanum = get_pluginsnum()
|
||||
new menu_body[512], start = pos * 6, k = 0
|
||||
if (start >= datanum) start = pos = g_menuPos[id] = 0
|
||||
new len = format(menu_body,511,
|
||||
g_cstrikeRunning ? "\yPause/Unpause Plugins\R%d/%d^n\w^n" : "Pause/Unpause Plugins %d/%d^n^n" ,
|
||||
pos + 1,((datanum/6)+((datanum%6)?1:0)))
|
||||
new end = start + 6, keys = (1<<9)|(1<<7)|(1<<6)
|
||||
if (end > datanum) end = datanum
|
||||
for(new a = start; a < end; ++a){
|
||||
get_plugin(a,filename,31,title,31,version,0,author,0,status,1)
|
||||
if (dontPause(a)||(status[0]!='r'&&status[0]!='p')) {
|
||||
if (g_cstrikeRunning){
|
||||
len += format(menu_body[len],511-len, "\d%d. %s\R%s^n\w",++k,
|
||||
title, ( status[0]=='r' ) ? "ON" : ( ( status[0]=='p' ) ? "OFF" : "ERROR" ) )
|
||||
}
|
||||
else{
|
||||
++k
|
||||
len += format(menu_body[len],511-len, "#. %s %s^n",
|
||||
title, ( status[0]=='r' ) ? "ON" : ( ( status[0]=='p' ) ? "OFF" : "ERROR" ) )
|
||||
}
|
||||
}
|
||||
else{
|
||||
keys |= (1<<k)
|
||||
len += format(menu_body[len],511-len,g_cstrikeRunning ? "%d. %s\y\R%s^n\w" : "%d. %s %s^n",++k,
|
||||
title, ( status[0]=='r' ) ? "ON" : ((g_pluginStatus[a]==PLG_STOPPED)?"STOPPED":"OFF"))
|
||||
}
|
||||
}
|
||||
len += format(menu_body[len],511-len,"^n7. Clear file with stopped^n")
|
||||
len += format(menu_body[len],511-len,g_cstrikeRunning ? "8. Save stopped \y\R%s^n\w"
|
||||
: "8. Save stopped %s^n" ,g_Modified ? "*" : "")
|
||||
if (end != datanum){
|
||||
format(menu_body[len],511-len,"^n9. More...^n0. %s", pos ? "Back" : "Exit")
|
||||
keys |= (1<<8)
|
||||
}
|
||||
else format(menu_body[len],511-len,"^n0. %s", pos ? "Back" : "Exit")
|
||||
show_menu(id,keys,menu_body)
|
||||
}
|
||||
|
||||
public cmdMenu(id,level,cid){
|
||||
if (!cmd_access(id,level,cid,1))
|
||||
return PLUGIN_HANDLED
|
||||
if (g_dontPauseNum != g_pluginListNum) chkStatus()
|
||||
displayMenu(id,g_menuPos[id] = 0)
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
|
||||
pasueALL(id){
|
||||
if (g_dontPauseNum != g_pluginListNum) chkStatus()
|
||||
new filename[32],title[32],version[2],author[2],status[2]
|
||||
new count = 0, imax = get_pluginsnum()
|
||||
for (new a=0;a<imax;++a){
|
||||
get_plugin(a,filename,31,title,31,version,0,author,0,status,1)
|
||||
if (dontPause(a)||status[0]!='r') continue
|
||||
pause("ac",filename)
|
||||
++count
|
||||
console_print(id,"Pausing %s (file ^"%s^")",title,filename)
|
||||
}
|
||||
console_print(id,"Paused %d plugins",count)
|
||||
}
|
||||
|
||||
unpauseALL(id){
|
||||
if (g_dontPauseNum != g_pluginListNum) chkStatus()
|
||||
new filename[32],title[32],version[2],author[2],status[2]
|
||||
new count = 0, imax = get_pluginsnum()
|
||||
for (new a=0;a<imax;++a){
|
||||
get_plugin(a,filename,31,title,31,version,0,author,0,status,1)
|
||||
if (dontPause(a)||status[0]!='p') continue
|
||||
unpause("ac",filename)
|
||||
++count
|
||||
console_print(id,"Unpausing %s (file ^"%s^")",title,filename)
|
||||
}
|
||||
console_print(id,"Unpaused %d plugins",count)
|
||||
}
|
||||
|
||||
#if defined DIRECT_ONOFF
|
||||
|
||||
public cmdOFF(id,level,cid){
|
||||
if (cmd_access(id,level,cid,1))
|
||||
pasueALL(id)
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
|
||||
public cmdON(id,level,cid){
|
||||
if (cmd_access(id,level,cid,1))
|
||||
unpauseALL(id)
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
findPlugin(argument[32],&len){
|
||||
new plugin[32],title[32],version[2],author[2],status[2]
|
||||
new inum = get_pluginsnum()
|
||||
for(new a = 0; a < inum; ++a){
|
||||
get_plugin(a,plugin,31,title,31,version,0,author,0,status,1)
|
||||
if ( equali(plugin,argument,len) && (status[0]=='r'||status[0]=='p') ){
|
||||
len = copy(argument,31,plugin)
|
||||
return a
|
||||
}
|
||||
}
|
||||
return -1
|
||||
}
|
||||
|
||||
public cmdPause(id,level,cid){
|
||||
if (!cmd_access(id,level,cid,1))
|
||||
return PLUGIN_HANDLED
|
||||
new cmds[32]
|
||||
read_argv(1,cmds,31)
|
||||
if ( equal(cmds, "off" ) ){
|
||||
pasueALL(id)
|
||||
}
|
||||
else if ( equal(cmds, "on" ) ){
|
||||
unpauseALL(id)
|
||||
}
|
||||
else if ( equal(cmds, "save" ) ){
|
||||
if (saveSettings(g_fileToSave)){
|
||||
g_Modified = false
|
||||
console_print(id,"Configuration saved successfully")
|
||||
}
|
||||
else
|
||||
console_print(id,"Configuration saving failed!!!")
|
||||
}
|
||||
else if ( equal(cmds, "clear" ) ) {
|
||||
if (file_exists(g_fileToSave)){
|
||||
delete_file(g_fileToSave)
|
||||
console_print(id,"Configuration file cleared")
|
||||
}
|
||||
else
|
||||
console_print(id,"Configuration was already cleared!")
|
||||
}
|
||||
else if ( equal(cmds, "pause" ) ) {
|
||||
new arg[32], len, a
|
||||
if ( (len = read_argv(2,arg,31)) != 0 ){
|
||||
if ( (a = findPlugin(arg,len)) != -1){
|
||||
if (pause("ac",arg)) g_pluginStatus[a] = PLG_OFF
|
||||
console_print(id,"Plugin matching ^"%s^" paused",arg)
|
||||
}
|
||||
}
|
||||
if (!len || a==-1) console_print(id,"Couldn't find plugin matching ^"%s^"",arg)
|
||||
}
|
||||
else if ( equal(cmds, "unpause" ) ) {
|
||||
new arg[32], len, a
|
||||
if ( (len = read_argv(2,arg,31)) != 0 ){
|
||||
if ( (a = findPlugin(arg,len)) != -1){
|
||||
if (unpause("ac",arg)) g_pluginStatus[a] = PLG_ON
|
||||
console_print(id,"Plugin matching ^"%s^" unpaused",arg)
|
||||
}
|
||||
}
|
||||
if (!len || a==-1) console_print(id,"Couldn't find plugin matching ^"%s^"",arg)
|
||||
}
|
||||
else if ( equal(cmds, "stop" ) ) {
|
||||
new arg[32], len, a
|
||||
if ( (len = read_argv(2,arg,31)) != 0 ){
|
||||
if ( (a = findPlugin(arg,len)) != -1){
|
||||
pause("ac",arg)
|
||||
g_pluginStatus[a] = PLG_STOPPED
|
||||
g_Modified = true
|
||||
console_print(id,"Plugin matching ^"%s^" stopped",arg)
|
||||
}
|
||||
}
|
||||
if (!len || a==-1) console_print(id,"Couldn't find plugin matching ^"%s^"",arg)
|
||||
}
|
||||
else if ( equal(cmds, "list" ) ) {
|
||||
new plugin[32],title[32],version[16],author[32],status[16]
|
||||
new inum = get_pluginsnum()
|
||||
console_print(id, "Currently loaded plugins:")
|
||||
console_print(id, " name version author file status")
|
||||
new running = 0, plugins = 0
|
||||
for(new a = 0; a < inum; ++a){
|
||||
plugins++
|
||||
get_plugin(a,plugin,31,title,31,version,15,author,31,status,15)
|
||||
if (status[0] == 'r') running++
|
||||
console_print(id, " [%3d] %-18.17s %-8.7s %-17.16s %-16.15s %-9.8s",plugins,
|
||||
title,version,author,plugin, (g_pluginStatus[a] == PLG_STOPPED) ? "stopped" : status )
|
||||
}
|
||||
console_print(id, "%d plugins, %d running",plugins,running)
|
||||
}
|
||||
else if ( equal(cmds, "add" ) && read_argc() > 2 ) {
|
||||
if ( g_pluginListNum < MAX_PLGDATA )
|
||||
read_argv(2,g_pluginList[g_pluginListNum++],31)
|
||||
else
|
||||
console_print(id, "Can't add more plugins to the unpauseable list, limit reached!")
|
||||
}
|
||||
else {
|
||||
console_print(id,"Usage: amx_plugin <command> [name]")
|
||||
console_print(id,"Commands:")
|
||||
console_print(id,"^toff - pause all plugins not in the list")
|
||||
console_print(id,"^ton - unpause all plugins")
|
||||
console_print(id,"^tstop <file> - stop plugin")
|
||||
console_print(id,"^tpause <file> - pause plugin")
|
||||
console_print(id,"^tunpause <file> - unpause plugin")
|
||||
console_print(id,"^tsave - save list of stopped plugins")
|
||||
console_print(id,"^tclear - clear list of stopped plugins")
|
||||
console_print(id,"^tlist - list plugins")
|
||||
console_print(id,"^tadd <title> - add plugin to the unpauseable plugins list")
|
||||
}
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
|
||||
chkStatus(){
|
||||
new filename[32],title[32],version[2],author[2],status[2]
|
||||
new imax = get_pluginsnum()
|
||||
for (new a=0;a<imax;++a){
|
||||
get_plugin(a,filename,31,title,31,version,0,author,0,status,1)
|
||||
if (status[0]=='p'){
|
||||
if (g_pluginStatus[a]!=PLG_STOPPED)g_pluginStatus[a] = PLG_OFF
|
||||
}
|
||||
else if (status[0]=='r')
|
||||
g_pluginStatus[a] = PLG_ON
|
||||
else
|
||||
g_pluginStatus[a] = PLG_ERROR
|
||||
if (dontPausePre(title))
|
||||
g_dontPause[g_dontPauseNum++] = a
|
||||
}
|
||||
}
|
||||
|
||||
bool:dontPause(myid) {
|
||||
for(new a=0;a<g_dontPauseNum;++a)
|
||||
if (g_dontPause[a]==myid)
|
||||
return true
|
||||
return false
|
||||
}
|
||||
|
||||
bool:dontPausePre(name[]) {
|
||||
for(new a=0;a<g_pluginListNum;++a)
|
||||
if (equali(g_pluginList[a],name))
|
||||
return true
|
||||
return false
|
||||
}
|
||||
|
||||
saveSettings(filename[]){
|
||||
if (file_exists(filename))
|
||||
delete_file(filename)
|
||||
new text[256], plugin[32],title[32],version[2],author[2],status[2]
|
||||
new inum = get_pluginsnum()
|
||||
if (!write_file(filename,";Generated by Pause Plugins Plugin. Do not modify!^n;Filename Description"))
|
||||
return 0
|
||||
for(new a = 0; a < inum; ++a){
|
||||
if (g_pluginStatus[a]==PLG_STOPPED){
|
||||
get_plugin(a,plugin,31,title,31,version,0,author,0,status,1)
|
||||
format(text,255,"%s ;%s",plugin,title)
|
||||
write_file(filename,text)
|
||||
}
|
||||
}
|
||||
return 1
|
||||
}
|
||||
|
||||
loadSettings(filename[]){
|
||||
if (!file_exists(filename)) return 0
|
||||
new text[256], len, pos = 0
|
||||
while (read_file(filename,pos++,text,255,len)){
|
||||
if ( text[0] == ';' ) continue // line is a comment
|
||||
parse(text,g_pluginList[g_pluginListNum++],31)
|
||||
}
|
||||
new plugin[32],title[32],version[2],author[2],status[2]
|
||||
new inum = get_pluginsnum()
|
||||
for(new a = 0; a < inum; ++a){
|
||||
get_plugin(a,plugin,31,title,31,version,0,author,0,status,1)
|
||||
if (!dontPausePre(plugin)) continue
|
||||
pause("ac",plugin)
|
||||
g_pluginStatus[a] = PLG_STOPPED
|
||||
}
|
||||
g_pluginListNum = 0
|
||||
return 1
|
||||
}
|
613
plugins/restmenu.sma
Executable file
613
plugins/restmenu.sma
Executable file
@@ -0,0 +1,613 @@
|
||||
/* AMX Mod script.
|
||||
*
|
||||
* (c) 2003, OLO
|
||||
* This file is provided as is (no warranties).
|
||||
*
|
||||
* Commands:
|
||||
* amx_restmenu - displays restriction menu
|
||||
* amx_restrict - displays help for restrict weapons command
|
||||
*/
|
||||
|
||||
// Uncomment if you want to have seperate settings for each map
|
||||
//#define MAPSETTINGS
|
||||
|
||||
#include <amxmod>
|
||||
#include <amxmisc>
|
||||
|
||||
#if !defined NO_STEAM
|
||||
#define MAXMENUPOS 34
|
||||
#else
|
||||
#define MAXMENUPOS 31
|
||||
#endif
|
||||
|
||||
new g_Position[33]
|
||||
new g_allowCheck[33]
|
||||
new g_Modified
|
||||
new g_blockPos[112]
|
||||
new g_saveFile[64]
|
||||
new g_Restricted[] = "* This item is restricted *"
|
||||
new g_menusNames[7][] = {
|
||||
"pistol",
|
||||
"shotgun",
|
||||
"sub",
|
||||
"rifle",
|
||||
"machine",
|
||||
"equip",
|
||||
"ammo"
|
||||
}
|
||||
new g_MenuTitle[7][] = {
|
||||
"Handguns",
|
||||
"Shotguns",
|
||||
"Sub-Machine Guns",
|
||||
"Assault & Sniper Rifles",
|
||||
"Machine Guns",
|
||||
"Equipment",
|
||||
"Ammunition"
|
||||
}
|
||||
new g_menusSets[7][2] = {
|
||||
#if !defined NO_STEAM
|
||||
{0,6},{6,8},{8,13},{13,23},{23,24},{24,32},{32,34}
|
||||
#else
|
||||
{0,6},{6,8},{8,13},{13,21},{21,22},{22,29},{29,31}
|
||||
#endif
|
||||
}
|
||||
#if !defined NO_STEAM
|
||||
new g_AliasBlockNum
|
||||
new g_AliasBlock[MAXMENUPOS]
|
||||
#endif
|
||||
|
||||
// First position is a position of menu (0 for ammo, 1 for pistols, 6 for equipment etc.)
|
||||
// Second is a key for TERRORIST (all is key are minus one, 1 is 0, 2 is 1 etc.)
|
||||
// Third is a key for CT
|
||||
// Position with -1 doesn't exist
|
||||
new g_Keys[MAXMENUPOS][3] = {
|
||||
#if !defined NO_STEAM
|
||||
{1,1,1}, // H&K USP .45 Tactical
|
||||
{1,0,0}, // Glock18 Select Fire
|
||||
{1,3,3}, // Desert Eagle .50AE
|
||||
{1,2,2}, // SIG P228
|
||||
{1,4,-1}, // Dual Beretta 96G Elite
|
||||
{1,-1,4}, // FN Five-Seven
|
||||
{2,0,0}, // Benelli M3 Super90
|
||||
{2,1,1}, // Benelli XM1014
|
||||
{3,1,1}, // H&K MP5-Navy
|
||||
{3,-1,0}, // Steyr Tactical Machine Pistol
|
||||
{3,3,3}, // FN P90
|
||||
{3,0,-1}, // Ingram MAC-10
|
||||
{3,2,2}, // H&K UMP45
|
||||
{4,1,-1}, // AK-47
|
||||
{4,0,-1}, // Gali
|
||||
{4,-1,0}, // Famas
|
||||
{4,3,-1}, // Sig SG-552 Commando
|
||||
{4,-1,2}, // Colt M4A1 Carbine
|
||||
{4,-1,3}, // Steyr Aug
|
||||
{4,2,1}, // Steyr Scout
|
||||
{4,4,5}, // AI Arctic Warfare/Magnum
|
||||
{4,5,-1}, // H&K G3/SG-1 Sniper Rifle
|
||||
{4,-1,4}, // Sig SG-550 Sniper
|
||||
{5,0,0}, // FN M249 Para
|
||||
{6,0,0}, // Kevlar Vest
|
||||
{6,1,1}, // Kevlar Vest & Helmet
|
||||
{6,2,2}, // Flashbang
|
||||
{6,3,3}, // HE Grenade
|
||||
{6,4,4}, // Smoke Grenade
|
||||
{6,-1,6}, // Defuse Kit
|
||||
{6,5,5}, // NightVision Goggles
|
||||
{6,-1,7}, // Tactical Shield
|
||||
{0,5,5}, // Primary weapon ammo
|
||||
{0,6,6} // Secondary weapon ammo
|
||||
#else
|
||||
{1,0,0}, // H&K USP .45 Tactical
|
||||
{1,1,1}, // Glock18 Select Fire
|
||||
{1,2,2}, // Desert Eagle .50AE
|
||||
{1,3,3}, // SIG P228
|
||||
{1,4,-1}, // Dual Beretta 96G Elite
|
||||
{1,-1,5}, // FN Five-Seven
|
||||
{2,0,0}, // Benelli M3 Super90
|
||||
{2,1,1}, // Benelli XM1014
|
||||
{3,0,0}, // H&K MP5-Navy
|
||||
{3,-1,1}, // Steyr Tactical Machine Pistol
|
||||
{3,2,2}, // FN P90
|
||||
{3,3,-1}, // Ingram MAC-10
|
||||
{3,4,4}, // H&K UMP45
|
||||
{4,0,-1}, // AK-47
|
||||
{4,1,-1}, // Sig SG-552 Commando
|
||||
{4,-1,2}, // Colt M4A1 Carbine
|
||||
{4,-1,3}, // Steyr Aug
|
||||
{4,4,4}, // Steyr Scout
|
||||
{4,5,5}, // AI Arctic Warfare/Magnum
|
||||
{4,6,-1}, // H&K G3/SG-1 Sniper Rifle
|
||||
{4,-1,7}, // Sig SG-550 Sniper
|
||||
{5,0,0}, // FN M249 Para
|
||||
{6,0,0}, // Kevlar Vest
|
||||
{6,1,1}, // Kevlar Vest & Helmet
|
||||
{6,2,2}, // Flashbang
|
||||
{6,3,3}, // HE Grenade
|
||||
{6,4,4}, // Smoke Grenade
|
||||
{6,-1,5}, // Defuse Kit
|
||||
{6,6,6}, // NightVision Goggles
|
||||
{0,5,5}, // Primary weapon ammo
|
||||
{0,6,6} // Secondary weapon ammo
|
||||
#endif
|
||||
}
|
||||
|
||||
new g_WeaponNames[MAXMENUPOS][] = {
|
||||
"H&K USP .45 Tactical",
|
||||
"Glock18 Select Fire",
|
||||
"Desert Eagle .50AE",
|
||||
"SIG P228",
|
||||
"Dual Beretta 96G Elite",
|
||||
"FN Five-Seven",
|
||||
"Benelli M3 Super90",
|
||||
"Benelli XM1014",
|
||||
"H&K MP5-Navy",
|
||||
"Steyr Tactical Machine Pistol",
|
||||
"FN P90",
|
||||
"Ingram MAC-10",
|
||||
"H&K UMP45",
|
||||
"AK-47",
|
||||
#if !defined NO_STEAM
|
||||
"Gali",
|
||||
"Famas",
|
||||
#endif
|
||||
"Sig SG-552 Commando",
|
||||
"Colt M4A1 Carbine",
|
||||
"Steyr Aug",
|
||||
"Steyr Scout",
|
||||
"AI Arctic Warfare/Magnum",
|
||||
"H&K G3/SG-1 Sniper Rifle",
|
||||
"Sig SG-550 Sniper",
|
||||
"FN M249 Para",
|
||||
"Kevlar Vest",
|
||||
"Kevlar Vest & Helmet",
|
||||
"Flashbang",
|
||||
"HE Grenade",
|
||||
"Smoke Grenade",
|
||||
"Defuse Kit",
|
||||
"NightVision Goggles",
|
||||
#if !defined NO_STEAM
|
||||
"Tactical Shield",
|
||||
#endif
|
||||
"Primary weapon ammo",
|
||||
"Secondary weapon ammo"
|
||||
}
|
||||
|
||||
new g_MenuItem[MAXMENUPOS][] = {
|
||||
"\yHandguns^n\w^n%d. %s\y\R%s^n\w",
|
||||
"%d. %s\y\R%s^n\w",
|
||||
"%d. %s\y\R%s^n\w",
|
||||
"%d. %s\y\R%s^n\w",
|
||||
"%d. %s\y\R%s^n\w",
|
||||
"%d. %s\y\R%s^n\w^n",
|
||||
|
||||
"\yShotguns^n\w^n%d. %s\y\R%s^n\w",
|
||||
"%d. %s\y\R%s^n\w^n",
|
||||
|
||||
"\ySub-Machine Guns^n\w^n%d. %s\y\R%s^n\w",
|
||||
"%d. %s\y\R%s^n\w",
|
||||
"%d. %s\y\R%s^n\w",
|
||||
"%d. %s\y\R%s^n\w",
|
||||
"%d. %s\y\R%s^n\w^n",
|
||||
|
||||
"\yAssault Rifles^n\w^n%d. %s\y\R%s^n\w",
|
||||
#if !defined NO_STEAM
|
||||
"%d. %s\y\R%s^n\w",
|
||||
"%d. %s\y\R%s^n\w",
|
||||
#endif
|
||||
"%d. %s\y\R%s^n\w",
|
||||
"%d. %s\y\R%s^n\w",
|
||||
"%d. %s\y\R%s^n\w^n",
|
||||
|
||||
"\ySniper Rifles^n\w^n%d. %s\y\R%s^n\w",
|
||||
"%d. %s\y\R%s^n\w",
|
||||
"%d. %s\y\R%s^n\w",
|
||||
"%d. %s\y\R%s^n\w^n",
|
||||
|
||||
"\yMachine Guns^n\w^n%d. %s\y\R%s^n\w^n",
|
||||
|
||||
"\yEquipment^n\w^n%d. %s\y\R%s^n\w",
|
||||
"%d. %s\y\R%s^n\w",
|
||||
"%d. %s\y\R%s^n\w",
|
||||
"%d. %s\y\R%s^n\w",
|
||||
"%d. %s\y\R%s^n\w",
|
||||
"%d. %s\y\R%s^n\w",
|
||||
#if !defined NO_STEAM
|
||||
"%d. %s\y\R%s^n\w",
|
||||
"%d. %s\y\R%s^n\w^n",
|
||||
#else
|
||||
"%d. %s\y\R%s^n\w^n",
|
||||
#endif
|
||||
|
||||
"\yAmmunition^n\w^n%d. %s\y\R%s^n\w",
|
||||
"%d. %s\y\R%s^n\w"
|
||||
}
|
||||
|
||||
new g_Aliases[MAXMENUPOS][] = {
|
||||
"usp",//Pistols
|
||||
"glock",
|
||||
"deagle",
|
||||
"p228",
|
||||
"elites",
|
||||
"fn57",
|
||||
|
||||
"m3",//Shotguns
|
||||
"xm1014",
|
||||
|
||||
"mp5",//SMG
|
||||
"tmp",
|
||||
"p90",
|
||||
"mac10",
|
||||
"ump45",
|
||||
|
||||
"ak47",//Rifles
|
||||
#if !defined NO_STEAM
|
||||
"galil",
|
||||
"famas",
|
||||
#endif
|
||||
"sg552",
|
||||
"m4a1",
|
||||
"aug",
|
||||
"scout",
|
||||
"awp",
|
||||
"g3sg1",
|
||||
"sg550",
|
||||
|
||||
"m249", //Machine Gun
|
||||
|
||||
"vest",//Equipment
|
||||
"vesthelm",
|
||||
"flash",
|
||||
"hegren",
|
||||
"sgren",
|
||||
"defuser",
|
||||
"nvgs",
|
||||
#if !defined NO_STEAM
|
||||
"shield",
|
||||
#endif
|
||||
"primammo",//Ammo
|
||||
"secammo"
|
||||
}
|
||||
#if !defined NO_STEAM
|
||||
new g_moreAliases[MAXMENUPOS][] = {
|
||||
"km45",//Pistols
|
||||
"9x19mm",
|
||||
"nighthawk",
|
||||
"228compact",
|
||||
"elites",
|
||||
"fiveseven",
|
||||
|
||||
"12gauge",//Shotguns
|
||||
"autoshotgun",
|
||||
|
||||
"smg",//SMG
|
||||
"mp",
|
||||
"c90",
|
||||
"mac10",
|
||||
"ump45",
|
||||
|
||||
"cv47",//Rifles
|
||||
//#if !defined NO_STEAM
|
||||
"defender",
|
||||
"clarion",
|
||||
//#endif
|
||||
"krieg552",
|
||||
"m4a1",
|
||||
"bullup",
|
||||
"scout",
|
||||
"magnum",
|
||||
"d3au1",
|
||||
"krieg550",
|
||||
|
||||
"m249", //Machine Gun
|
||||
|
||||
"vest",//Equipment
|
||||
"vesthelm",
|
||||
"flash",
|
||||
"hegren",
|
||||
"sgren",
|
||||
"defuser",
|
||||
"nvgs",
|
||||
//#if !defined NO_STEAM
|
||||
"shield",
|
||||
//#endif
|
||||
"primammo",//Ammo
|
||||
"secammo"
|
||||
}
|
||||
#endif
|
||||
public plugin_init(){
|
||||
register_plugin("Restrict Weapons","0.9.6","default")
|
||||
register_clcmd("buyammo1","ammoRest1")
|
||||
register_clcmd("buyammo2","ammoRest2")
|
||||
register_clcmd("amx_restmenu","cmdMenu",ADMIN_CFG,"- displays weapons restriction menu")
|
||||
register_menucmd(register_menuid("#Buy", 1 ),511,"menuBuy")
|
||||
register_menucmd(register_menuid("\yRestrict Weapons"),1023,"actionMenu")
|
||||
register_menucmd(register_menuid("BuyPistol", 1 ),511,"menuPistol")
|
||||
register_menucmd(register_menuid("BuyShotgun", 1 ),511,"menuShotgun")
|
||||
register_menucmd(register_menuid("BuySub", 1 ),511,"menuSub")
|
||||
register_menucmd(register_menuid("BuyRifle", 1 ),511,"menuRifle")
|
||||
register_menucmd(register_menuid("BuyMachine", 1 ),511,"menuMachine")
|
||||
register_menucmd(register_menuid("BuyItem", 1 ),511,"menuItem")
|
||||
register_menucmd(-28,511,"menuBuy" )
|
||||
register_menucmd(-29,511,"menuPistol" )
|
||||
register_menucmd(-30,511,"menuShotgun")
|
||||
register_menucmd(-32,511,"menuSub")
|
||||
register_menucmd(-31,511,"menuRifle")
|
||||
register_menucmd(-33,511,"menuMachine")
|
||||
register_menucmd(-34,511,"menuItem")
|
||||
register_concmd("amx_restrict","cmdRest",ADMIN_CFG,"- displays help for weapons restriction")
|
||||
|
||||
register_event("StatusIcon","buyZone","b","2&buy")
|
||||
|
||||
#if defined MAPSETTINGS
|
||||
new mapname[32]
|
||||
get_mapname(mapname,31)
|
||||
build_path( g_saveFile , 63 , "$basedir/weaprest_%s.ini" ,mapname )
|
||||
#else
|
||||
build_path( g_saveFile , 63 , "$basedir/weaprest.ini" )
|
||||
#endif
|
||||
loadSettings(g_saveFile)
|
||||
}
|
||||
|
||||
public buyZone(id)
|
||||
g_allowCheck[ id ] = read_data(1)
|
||||
|
||||
setWeapon( a , action ){
|
||||
new b, m = g_Keys[a][0] * 8
|
||||
if (g_Keys[a][1] != -1) {
|
||||
b = m + g_Keys[a][1]
|
||||
if ( action == 2 )
|
||||
g_blockPos[ b ] = 1 - g_blockPos[ b ]
|
||||
else
|
||||
g_blockPos[ b ] = action
|
||||
}
|
||||
if (g_Keys[a][2] != -1) {
|
||||
b = m + g_Keys[a][2] + 56
|
||||
if ( action == 2 )
|
||||
g_blockPos[ b ] = 1 - g_blockPos[ b ]
|
||||
else
|
||||
g_blockPos[ b ] = action
|
||||
}
|
||||
#if !defined NO_STEAM
|
||||
for(new i = 0; i < g_AliasBlockNum; ++i)
|
||||
if ( g_AliasBlock[ i ] == a ){
|
||||
if ( !action || action == 2 ) {
|
||||
--g_AliasBlockNum
|
||||
for(new j = i; j < g_AliasBlockNum; ++j )
|
||||
g_AliasBlock[ j ] = g_AliasBlock[ j + 1 ]
|
||||
}
|
||||
return
|
||||
}
|
||||
if ( action && g_AliasBlockNum < MAXMENUPOS )
|
||||
g_AliasBlock[ g_AliasBlockNum++ ] = a
|
||||
#endif
|
||||
}
|
||||
|
||||
findMenuId( name[] ){
|
||||
for(new i = 0; i < 7 ; ++i)
|
||||
if( equal( name , g_menusNames[i] ) )
|
||||
return i
|
||||
return -1
|
||||
}
|
||||
|
||||
findAliasId( name[] ){
|
||||
for(new i = 0; i < MAXMENUPOS ; ++i)
|
||||
if( equal( name , g_Aliases[i] ) )
|
||||
return i
|
||||
return -1
|
||||
}
|
||||
|
||||
switchCommand( id, action ){
|
||||
new c = read_argc()
|
||||
if ( c < 3 ){
|
||||
for(new a = 0; a < MAXMENUPOS; ++a)
|
||||
setWeapon( a , action )
|
||||
console_print( id , "Equipment and weapons have been %srestricted" , action ? "" : "un" )
|
||||
g_Modified = true
|
||||
}
|
||||
else {
|
||||
new arg[32], a
|
||||
new bool:found = false
|
||||
for(new b = 2; b < c; ++b){
|
||||
read_argv(b,arg,31)
|
||||
if ( (a = findMenuId( arg )) != -1 ){
|
||||
c = g_menusSets[a][1]
|
||||
for(new i = g_menusSets[a][0]; i < c; ++i)
|
||||
setWeapon( i , action )
|
||||
console_print( id , "%s %s been %srestricted" , g_MenuTitle[a], (a<5) ? "have" : "has" , action ? "" : "un" )
|
||||
g_Modified = found = true
|
||||
}
|
||||
else if ( (a = findAliasId( arg )) != -1 ){
|
||||
g_Modified = found = true
|
||||
setWeapon( a , action )
|
||||
console_print( id , "%s has been %srestricted" , g_WeaponNames[a], action ? "" : "un" )
|
||||
}
|
||||
}
|
||||
if ( !found )
|
||||
console_print( id , "Couldn't find such equipment or weapon" )
|
||||
}
|
||||
}
|
||||
|
||||
positionBlocked( a ) {
|
||||
new m = g_Keys[a][0] * 8
|
||||
new d = ( g_Keys[a][1]==-1) ? 0 : g_blockPos[ m + g_Keys[a][1] ]
|
||||
d += ( g_Keys[a][2]==-1) ? 0 : g_blockPos[ m + g_Keys[a][2] + 56 ]
|
||||
return d
|
||||
}
|
||||
|
||||
public cmdRest(id,level,cid){
|
||||
if (!cmd_access(id,level,cid,1))
|
||||
return PLUGIN_HANDLED
|
||||
new cmd[8]
|
||||
read_argv(1,cmd,7)
|
||||
if ( equali( "on" , cmd ) )
|
||||
switchCommand( id, 1 )
|
||||
else if ( equali( "off" , cmd ) )
|
||||
switchCommand( id, 0 )
|
||||
else if ( equali( "list" , cmd ) ) {
|
||||
new arg1[8]
|
||||
new start = read_argv(2,arg1,7) ? strtonum(arg1) : 1
|
||||
if (--start < 0) start = 0
|
||||
if (start >= MAXMENUPOS) start = MAXMENUPOS - 1
|
||||
new end = start + 10
|
||||
if (end > MAXMENUPOS) end = MAXMENUPOS
|
||||
console_print(id, "^n----- Weapons Restriction: -----")
|
||||
console_print(id, " %-32.31s %-10.9s %-9.8s","name","value","status")
|
||||
if ( start != -1 ) {
|
||||
for(new a = start; a < end; ++a){
|
||||
console_print(id, "%3d: %-32.31s %-10.9s %-9.8s",a + 1,
|
||||
g_WeaponNames[a], g_Aliases[a], positionBlocked(a) ? "ON" : "OFF")
|
||||
}
|
||||
}
|
||||
console_print(id,"----- Entries %i - %i of %i -----",start+1,end,MAXMENUPOS)
|
||||
if (end < MAXMENUPOS)
|
||||
console_print(id,"----- Use 'amx_restrict list %i' for more -----",end+1)
|
||||
else
|
||||
console_print(id,"----- Use 'amx_restrict list 1' for begin -----")
|
||||
}
|
||||
else if ( equali( "save" , cmd ) ) {
|
||||
if ( saveSettings( g_saveFile ) ){
|
||||
console_print( id , "Configuration has been saved (file ^"%s^")" , g_saveFile )
|
||||
g_Modified = false
|
||||
}
|
||||
else console_print( id , "Couldn't save configuration (file ^"%s^")" , g_saveFile )
|
||||
}
|
||||
else if ( equali( "load" , cmd ) ) {
|
||||
for(new a = 0; a < MAXMENUPOS; ++a)
|
||||
setWeapon( a , 0 ) // Clear current settings
|
||||
new arg1[64]
|
||||
if ( read_argv(2, arg1 , 63 ) ) build_path( arg1 , 63, "$basedir/%s", arg1 )
|
||||
else copy( arg1, 63, g_saveFile )
|
||||
if ( loadSettings( arg1 ) ){
|
||||
console_print( id , "Configuration has been loaded (file ^"%s^")" , arg1 )
|
||||
g_Modified = true
|
||||
}
|
||||
else console_print( id , "Couldn't load configuration (file ^"%s^")" , arg1 )
|
||||
}
|
||||
else {
|
||||
console_print(id,"Usage: amx_restrict <command> [value]")
|
||||
console_print(id,"Commands:")
|
||||
console_print(id,"^ton - set restriction on whole equipment")
|
||||
console_print(id,"^toff - remove restriction from whole equipment")
|
||||
console_print(id,"^ton <value> [...] - set specified restriction")
|
||||
console_print(id,"^toff <value> [...] - remove specified restriction")
|
||||
console_print(id,"^tlist - display list of available equipment and weapons")
|
||||
console_print(id,"^tsave - save restriction")
|
||||
console_print(id,"^tload [file] - load restriction [from a file]")
|
||||
console_print(id,"Available values to restrict are:^nammo, equip, pistol, shotgun, sub, rifle, machine")
|
||||
console_print(id,"Type 'amx_restrict list' for more specified values")
|
||||
}
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
|
||||
displayMenu(id,pos){
|
||||
if (pos < 0) return
|
||||
new menubody[512], start = pos * 7
|
||||
if (start >= MAXMENUPOS) start = pos = g_Position[id] = 0
|
||||
new len = format(menubody,511,"\yRestrict Weapons\R%d/5^n\w^n",pos+1)
|
||||
new end = start + 7, keys = (1<<9)|(1<<7), k = 0
|
||||
if (end > MAXMENUPOS) end = MAXMENUPOS
|
||||
for(new a = start; a < end; ++a){
|
||||
keys |= (1<<k)
|
||||
len += format(menubody[len],511-len,g_MenuItem[a],++k,g_WeaponNames[a],
|
||||
positionBlocked(a) ? "ON" : "OFF" )
|
||||
}
|
||||
len += format(menubody[len],511-len,"^n8. Save settings \y\R%s^n\w",g_Modified?"*":"")
|
||||
if (end != MAXMENUPOS){
|
||||
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 actionMenu(id,key){
|
||||
switch(key){
|
||||
case 7: {
|
||||
if (saveSettings(g_saveFile)){
|
||||
g_Modified = false
|
||||
client_print(id,print_chat,"* Configuration saved successfully")
|
||||
}
|
||||
else client_print(id,print_chat,"* Configuration saving failed!!!")
|
||||
displayMenu(id,g_Position[id])
|
||||
}
|
||||
case 8: displayMenu(id,++g_Position[id])
|
||||
case 9: displayMenu(id,--g_Position[id])
|
||||
default: {
|
||||
setWeapon( g_Position[id] * 7 + key , 2 )
|
||||
g_Modified = true
|
||||
displayMenu(id,g_Position[id])
|
||||
}
|
||||
}
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
|
||||
#if !defined NO_STEAM
|
||||
public client_command( id ){
|
||||
if ( g_AliasBlockNum && g_allowCheck[ id ] ) {
|
||||
new arg[16]
|
||||
read_argv( 0, arg , 15 )
|
||||
new a = 0
|
||||
do {
|
||||
if ( equal( g_Aliases[g_AliasBlock[ a ]] , arg ) || equal( g_moreAliases[g_AliasBlock[ a ]] , arg ) ) {
|
||||
client_print(id,print_center,g_Restricted )
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
} while( ++a < g_AliasBlockNum )
|
||||
}
|
||||
return PLUGIN_CONTINUE
|
||||
}
|
||||
#endif
|
||||
|
||||
public cmdMenu(id,level,cid){
|
||||
if (cmd_access(id,level,cid,1))
|
||||
displayMenu(id, g_Position[id] = 0 )
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
|
||||
checkRest(id,menu,key){
|
||||
if ( g_blockPos[ (menu * 8 + key) + (get_user_team(id) - 1) * 56 ] ){
|
||||
engclient_cmd(id,"menuselect","10")
|
||||
//client_cmd(id,"slot10")
|
||||
client_print(id,print_center, g_Restricted )
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
return PLUGIN_CONTINUE
|
||||
}
|
||||
|
||||
public ammoRest1(id) return checkRest(id,0,5)
|
||||
public ammoRest2(id) return checkRest(id,0,6)
|
||||
public menuBuy(id,key) return checkRest(id,0,key)
|
||||
public menuPistol(id,key) return checkRest(id,1,key)
|
||||
public menuShotgun(id,key) return checkRest(id,2,key)
|
||||
public menuSub(id,key) return checkRest(id,3,key)
|
||||
public menuRifle(id,key) return checkRest(id,4,key)
|
||||
public menuMachine(id,key) return checkRest(id,5,key)
|
||||
public menuItem(id,key) return checkRest(id,6,key)
|
||||
|
||||
saveSettings(filename[]){
|
||||
if (file_exists(filename))
|
||||
delete_file(filename)
|
||||
if (!write_file(filename,"; Generated by Restrict Weapons Plugin. Do not modify!^n; value name"))
|
||||
return 0
|
||||
new text[64]
|
||||
for(new a = 0; a < MAXMENUPOS; ++a){
|
||||
if ( positionBlocked( a ) ) {
|
||||
format(text,63,"%-16.15s ; %s", g_Aliases[a] , g_WeaponNames[a])
|
||||
write_file(filename,text)
|
||||
}
|
||||
}
|
||||
return 1
|
||||
}
|
||||
|
||||
loadSettings(filename[]){
|
||||
if (!file_exists(filename)) return 0
|
||||
new text[16]
|
||||
new a, pos = 0
|
||||
while (read_file(filename,pos++,text,15, a )){
|
||||
if ( text[0] == ';' || !a ) continue // line is a comment
|
||||
parse( text, text , 15 )
|
||||
if ( (a = findAliasId( text )) != -1 )
|
||||
setWeapon( a , 1 )
|
||||
}
|
||||
return 1
|
||||
}
|
BIN
plugins/sc
Executable file
BIN
plugins/sc
Executable file
Binary file not shown.
BIN
plugins/sc.exe
Executable file
BIN
plugins/sc.exe
Executable file
Binary file not shown.
84
plugins/scrollmsg.sma
Executable file
84
plugins/scrollmsg.sma
Executable file
@@ -0,0 +1,84 @@
|
||||
/* AMX Mod script.
|
||||
*
|
||||
* (c) 2003, OLO
|
||||
* This file is provided as is (no warranties).
|
||||
*
|
||||
* Server command:
|
||||
* amx_scrollmsg <msg> <freq. in sec.>
|
||||
*/
|
||||
|
||||
#include <amxmod>
|
||||
#include <amxmisc>
|
||||
|
||||
#define SPEED 0.3
|
||||
|
||||
new g_startPos
|
||||
new g_endPos
|
||||
new g_scrollMsg[384]
|
||||
new g_displayMsg[384]
|
||||
new Float:g_xPos
|
||||
new g_Length
|
||||
new g_Frequency
|
||||
|
||||
public plugin_init(){
|
||||
register_plugin("Scrolling Message","0.9","default")
|
||||
register_srvcmd("amx_scrollmsg","setMessage")
|
||||
}
|
||||
|
||||
public showMsg(){
|
||||
new a = g_startPos, i = 0
|
||||
|
||||
while( a < g_endPos )
|
||||
g_displayMsg[i++] = g_scrollMsg[a++]
|
||||
|
||||
g_displayMsg[i] = 0
|
||||
|
||||
if (g_endPos < g_Length)
|
||||
g_endPos++
|
||||
|
||||
if (g_xPos > 0.35)
|
||||
g_xPos -= 0.0063
|
||||
else
|
||||
{
|
||||
g_startPos++
|
||||
g_xPos = 0.35
|
||||
}
|
||||
|
||||
set_hudmessage(200, 100, 0, g_xPos, 0.90, 0, SPEED, SPEED, 0.05, 0.05, 2)
|
||||
show_hudmessage(0,g_displayMsg)
|
||||
}
|
||||
|
||||
public msgInit(){
|
||||
g_endPos = 1
|
||||
g_startPos = 0
|
||||
g_xPos = 0.65
|
||||
set_task( SPEED , "showMsg",123,"",0,"a", g_Length + 48)
|
||||
client_print(0,print_console,g_scrollMsg)
|
||||
}
|
||||
|
||||
public setMessage(id,level,cid) {
|
||||
if (!cmd_access(id,level,cid,3))
|
||||
return PLUGIN_HANDLED
|
||||
remove_task(123) /* remove current messaging */
|
||||
read_argv(1,g_scrollMsg,380)
|
||||
new hostname[64]
|
||||
get_cvar_string("hostname",hostname,63)
|
||||
replace(g_scrollMsg,380,"%hostname%",hostname)
|
||||
g_Length = strlen(g_scrollMsg)
|
||||
new mytime[32]
|
||||
read_argv(2,mytime,31)
|
||||
g_Frequency = strtonum(mytime)
|
||||
if (g_Frequency > 0) {
|
||||
new minimal = floatround((g_Length + 48) * (SPEED + 0.1))
|
||||
if (g_Frequency < minimal) {
|
||||
console_print(id,"Minimal frequency for this message is %d seconds",minimal)
|
||||
g_Frequency = minimal
|
||||
}
|
||||
console_print(id,"Scrolling message displaying frequency: %d:%02d minutes",
|
||||
g_Frequency/60,g_Frequency%60)
|
||||
set_task(float(g_Frequency),"msgInit",123,"",0,"b")
|
||||
}
|
||||
else
|
||||
console_print(id,"Scrolling message disabled")
|
||||
return PLUGIN_HANDLED
|
||||
}
|
474
plugins/stats.sma
Executable file
474
plugins/stats.sma
Executable file
@@ -0,0 +1,474 @@
|
||||
/* AMX Mod script.
|
||||
*
|
||||
* (c) 2003, OLO
|
||||
* This file is provided as is (no warranties).
|
||||
*
|
||||
* Plugin works with Stats Settings Plugin. Just run both of them.
|
||||
* By amx_statscfg command (from Stats Settings Plugin)
|
||||
* you will be able to set all settings and save them to a file.
|
||||
*
|
||||
* Example of usage for some options:
|
||||
* amx_ststacfg on ShowAttackers
|
||||
* amx_ststacfg on SayHP
|
||||
*
|
||||
* Accept able are also parts of name:
|
||||
* amx_statscfg off say
|
||||
* amx_statscfg on show
|
||||
*/
|
||||
|
||||
#include <amxmod>
|
||||
#include <amxmisc>
|
||||
#include <csstats>
|
||||
|
||||
// You can also manualy enable these options by setting them to 1
|
||||
// For example:
|
||||
// public ShowAttackers = 1
|
||||
// However amx_statscfg command is recommended
|
||||
|
||||
public ShowAttackers // shows attackers
|
||||
public ShowVictims // shows victims
|
||||
public ShowKiller // shows killer
|
||||
public EndPlayer // displays player stats at the end of map
|
||||
public EndTop15 // displays top15 at the end of map
|
||||
public KillerHpAp // displays killer hp&ap to victim console and screen
|
||||
public SpecRankInfo // displays rank info when spectating
|
||||
|
||||
public SayHP // displays information about user killer
|
||||
public SayStatsAll // displays players stats and rank
|
||||
public SayTop15 // displays first 15. players
|
||||
public SayRank // displays user position in rank
|
||||
public SayStatsMe // displays user stats
|
||||
|
||||
public EndTeamScore // displays at the end of round team score
|
||||
public EndMostKills // displays at the end of who made most kills
|
||||
public EndMostDamage // displays at the end of who made most damage
|
||||
|
||||
new g_Killers[33][4]
|
||||
new g_Buffer[2048]
|
||||
new g_userPosition[33]
|
||||
new g_userState[33]
|
||||
new g_userPlayers[33][32]
|
||||
new g_bodyParts[8][] = {"whole body","head","chest","stomach","left arm","right arm","left leg","right leg"}
|
||||
new bool:g_specMode[33]
|
||||
new g_teamScore[2]
|
||||
|
||||
new g_disabledMsg[] = "Server has disabled that option"
|
||||
|
||||
public plugin_init() {
|
||||
register_plugin("Stats","0.9","default")
|
||||
register_event("CS_DeathMsg","eCSDeathMsg","a")
|
||||
register_event("ResetHUD","eResetHud","b")
|
||||
register_event("SendAudio","eRoundEnd","a","2=%!MRAD_terwin","2=%!MRAD_ctwin","2=%!MRAD_rounddraw")
|
||||
register_event("30","eInterMission","a")
|
||||
register_clcmd("say /hp","cmdKiller",0,"- displays info. about your killer")
|
||||
register_clcmd("say /statsme","cmdStatsMe",0,"- displays your stats")
|
||||
register_clcmd("say /stats","cmdStats",0,"- displays others stats")
|
||||
register_clcmd("say /top15","cmdTop15",0,"- displays top 15 players")
|
||||
register_clcmd("say /rank","cmdRank",0,"- displays your server stats")
|
||||
register_menucmd(register_menuid("Server Stats"),1023,"actionStatsMenu")
|
||||
register_event("TextMsg","setSpecMode","bd","2&ec_Mod")
|
||||
register_event("StatusValue","showRank","bd","1=2")
|
||||
register_event( "TeamScore", "eTeamScore", "a" )
|
||||
}
|
||||
|
||||
public plugin_cfg(){
|
||||
new g_addStast[] = "amx_statscfg add ^"%s^" %s"
|
||||
server_cmd(g_addStast,"Show Attackers","ShowAttackers")
|
||||
server_cmd(g_addStast,"Show Victims","ShowVictims")
|
||||
server_cmd(g_addStast,"Show killer","ShowKiller")
|
||||
server_cmd(g_addStast,"Stats at the end of map","EndPlayer")
|
||||
server_cmd(g_addStast,"Top15 at the end of map","EndTop15")
|
||||
server_cmd(g_addStast,"Show killer hp&ap","KillerHpAp")
|
||||
server_cmd(g_addStast,"Say /hp","SayHP")
|
||||
server_cmd(g_addStast,"Say /stats","SayStatsAll")
|
||||
server_cmd(g_addStast,"Say /top15","SayTop15")
|
||||
server_cmd(g_addStast,"Say /rank","SayRank")
|
||||
server_cmd(g_addStast,"Say /statsme","SayStatsMe")
|
||||
server_cmd(g_addStast,"Spec. Rank Info","SpecRankInfo")
|
||||
server_cmd(g_addStast,"Team Score","EndTeamScore")
|
||||
server_cmd(g_addStast,"Most Kills","EndMostKills")
|
||||
server_cmd(g_addStast,"Most Damage","EndMostDamage")
|
||||
}
|
||||
|
||||
public eTeamScore(){
|
||||
new team[2]
|
||||
read_data( 1, team, 1 )
|
||||
g_teamScore[ (team[0]=='C') ? 1 : 0 ] = read_data(2)
|
||||
}
|
||||
|
||||
public setSpecMode(id) {
|
||||
new arg[12]
|
||||
read_data( 2 , arg , 11 )
|
||||
g_specMode[ id ] = ( arg[10] == '2' )
|
||||
}
|
||||
|
||||
public showRank(id)
|
||||
if ( SpecRankInfo && g_specMode[id] ){
|
||||
new a = read_data(2)
|
||||
if ( is_user_connected( a ) ){
|
||||
new name[32], data[8]
|
||||
get_user_name( a ,name,31)
|
||||
new pos = get_user_stats( a ,data,data)
|
||||
set_hudmessage(255,255,255,0.02,0.85,2, 0.05, 0.1, 0.01, 3.0, 1)
|
||||
show_hudmessage(id,"%s's rank is %d of %d",name,pos,get_statsnum())
|
||||
}
|
||||
}
|
||||
|
||||
/* build list of attackers */
|
||||
getAttackers(id) {
|
||||
new name[32],wpn[32], stats[8],body[8],found=0
|
||||
new pos = copy(g_Buffer,2047,"Attackers:^n")
|
||||
new amax = get_maxplayers()
|
||||
for(new a = 1; a <= amax; ++a){
|
||||
if(get_user_astats(id,a,stats,body,wpn,31)){
|
||||
found = 1
|
||||
if (stats[0])
|
||||
format(wpn,31," -- %s",wpn)
|
||||
else
|
||||
wpn[0] = 0
|
||||
get_user_name(a,name,31)
|
||||
pos += format(g_Buffer[pos],2047-pos,"%s -- %d hit%s / %d dmg %s^n",name,stats[5],(stats[5]==1)?"":"s",stats[6],wpn)
|
||||
}
|
||||
}
|
||||
return found
|
||||
}
|
||||
|
||||
/* build list of victims */
|
||||
getVictims(id) {
|
||||
new name[32],wpn[32], stats[8],body[8],found=0
|
||||
new pos = copy(g_Buffer,2047,"Victims:^n")
|
||||
new amax = get_maxplayers()
|
||||
for(new a = 1; a <= amax; ++a){
|
||||
if(get_user_vstats(id,a,stats,body,wpn,31)){
|
||||
found = 1
|
||||
if (stats[1])
|
||||
format(wpn,31," -- %s",wpn)
|
||||
else
|
||||
wpn[0] = 0
|
||||
get_user_name(a,name,31)
|
||||
pos += format(g_Buffer[pos],2047-pos,"%s -- %d hit%s / %d dmg %s^n",name,stats[5],(stats[5]==1)?"":"s",stats[6],wpn)
|
||||
}
|
||||
}
|
||||
return found
|
||||
}
|
||||
|
||||
/* build list of hita for AV List */
|
||||
getHits(id,killer) {
|
||||
new stats[8], body[8], pos = 0
|
||||
g_Buffer[0] = 0
|
||||
get_user_astats(id,killer,stats,body)
|
||||
for(new a = 1; a < 8; ++a)
|
||||
if(body[a])
|
||||
pos += format(g_Buffer[pos],2047-pos,"%s: %d^n",g_bodyParts[a],body[a])
|
||||
}
|
||||
|
||||
/* get top 15 */
|
||||
getTop15(){
|
||||
new pos=0, stats[8], body[8], name[32]
|
||||
#if !defined NO_STEAM
|
||||
pos = format(g_Buffer,2047,"<html><head><style type=^"text/css^">pre{color:#FFB000;}body{background:#000000;margin-left:8px;margin-top:0px;}</style></head><pre><body>")
|
||||
#endif
|
||||
pos += format(g_Buffer[pos],2047-pos," # %-28.27s %6s %6s %6s %6s %6s^n",
|
||||
"nick", "kills" , "deaths" , "hits","shots","hs" )
|
||||
new imax = get_statsnum()
|
||||
if (imax > 15) imax = 15
|
||||
for(new a = 0; a < imax; ++a){
|
||||
get_stats(a,stats,body,name,31)
|
||||
pos += format(g_Buffer[pos],2047-pos,"%2d. %-28.27s %6d %6d %6d %6d %6d^n",a+1,name,stats[0],stats[1],stats[5],stats[4],stats[2])
|
||||
}
|
||||
#if !defined NO_STEAM
|
||||
format(g_Buffer[pos],2047-pos,"</pre></body></html>")
|
||||
#endif
|
||||
}
|
||||
|
||||
/* build list of hits for say hp */
|
||||
getMyHits(id,killed) {
|
||||
new name[32], stats[8], body[8]
|
||||
get_user_name(killed,name,31)
|
||||
new pos = format(g_Buffer,2047,"You hit %s in:",name)
|
||||
get_user_vstats(id,killed,stats,body)
|
||||
for(new a = 1; a < 8; ++a){
|
||||
if(body[a])
|
||||
pos += format(g_Buffer[pos],2047-pos," %s: %d ",g_bodyParts[a],body[a])
|
||||
}
|
||||
}
|
||||
|
||||
/* save hits and damage */
|
||||
public eCSDeathMsg() {
|
||||
new killer = read_data(1)
|
||||
new victim = read_data(2)
|
||||
if ( killer == victim ) return
|
||||
new vorigin[3], korigin[3]
|
||||
get_user_origin(victim,vorigin)
|
||||
get_user_origin(killer,korigin)
|
||||
g_Killers[victim][0] = killer
|
||||
g_Killers[victim][1] = get_user_health(killer)
|
||||
g_Killers[victim][2] = get_user_armor(killer)
|
||||
g_Killers[victim][3] = get_distance(vorigin,korigin)
|
||||
if ( ShowKiller ){
|
||||
new name[32], stats[8], body[8], wpn[33], mstats[8], mbody[8]
|
||||
get_user_name(killer,name,31)
|
||||
get_user_astats(victim,killer,stats,body,wpn,31)
|
||||
if ( !get_user_vstats(victim,killer,mstats,mbody) )
|
||||
mstats[5] = mstats[6] = 0
|
||||
set_hudmessage(220,80,0,0.05,0.15,0, 6.0, 12.0, 1.0, 2.0, 1)
|
||||
getHits(victim,killer)
|
||||
show_hudmessage(victim,"%s killed you with %s^nfrom distance of %.2f meters.^nHe did %d damage to you with %d hit%s^nand still has %dhp and %dap.^nYou did %d damage to him with %d hit%s.^nHe hits you in:^n%s",
|
||||
name,wpn,float(g_Killers[victim][3]) * 0.0254, stats[6],stats[5], (stats[5]==1) ? "":"s", g_Killers[victim][1],g_Killers[victim][2],
|
||||
mstats[6],mstats[5],(mstats[5]==1) ? "" : "s",g_Buffer )
|
||||
}
|
||||
if ( ShowVictims && getVictims(victim) ){
|
||||
set_hudmessage(0,80,220,0.55,0.60,0, 6.0, 12.0, 1.0, 2.0, 4)
|
||||
show_hudmessage(victim,g_Buffer)
|
||||
}
|
||||
if ( ShowAttackers && getAttackers(victim)){
|
||||
set_hudmessage(220,80,0,0.55,0.35,0, 6.0, 12.0, 1.0, 2.0, 3)
|
||||
show_hudmessage(victim,g_Buffer)
|
||||
}
|
||||
if ( KillerHpAp ){
|
||||
new name[32], kmsg[128]
|
||||
get_user_name(killer,name,31)
|
||||
format(kmsg,127,"%s still has %dhp and %dap",name,g_Killers[victim][1],g_Killers[victim][2])
|
||||
client_print(victim,print_console,kmsg)
|
||||
set_hudmessage(255,255,255,0.02,0.85,2, 1.5, 3.0, 0.02, 5.0, 1)
|
||||
show_hudmessage(victim,kmsg)
|
||||
}
|
||||
}
|
||||
|
||||
public eResetHud( id )
|
||||
g_Killers[ id ][0] = 0
|
||||
|
||||
public eRoundEnd()
|
||||
set_task( 0.3 , "eRoundEndTask" )
|
||||
|
||||
public eRoundEndTask() {
|
||||
if ( ShowVictims || ShowAttackers ) {
|
||||
new players[32], pnum
|
||||
get_players( players , pnum, "a" )
|
||||
for(new i = 0; i < pnum; ++i ) {
|
||||
if ( ShowVictims &&getVictims( players[ i ] )){
|
||||
set_hudmessage(0,80,220,0.55,0.60,0, 6.0, 12.0, 1.0, 2.0, 4)
|
||||
show_hudmessage( players[ i ] ,g_Buffer)
|
||||
}
|
||||
if ( ShowAttackers && getAttackers( players[ i ] ) ){
|
||||
set_hudmessage(220,80,0,0.55,0.35,0, 6.0, 12.0, 1.0, 2.0, 3)
|
||||
show_hudmessage( players[ i ] ,g_Buffer)
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( EndMostKills || EndTeamScore || EndMostDamage ){
|
||||
new players[32], pnum, stats[8],bodyhits[8], len = 0
|
||||
get_players( players , pnum )
|
||||
g_Buffer[0] = 0
|
||||
if ( EndMostKills ){
|
||||
new kills = 0, who = 0, hs = 0
|
||||
for(new i = 0; i < pnum; ++i){
|
||||
get_user_rstats( players[i],stats, bodyhits )
|
||||
if ( stats[0] > kills ){
|
||||
who = players[i]
|
||||
kills = stats[0]
|
||||
hs = stats[2]
|
||||
}
|
||||
}
|
||||
if ( is_user_connected(who) ) {
|
||||
new name[32]
|
||||
get_user_name( who, name, 31 )
|
||||
len += format(g_Buffer[len] , 512 - len ,
|
||||
"Most kills: %s^n%d kill%s / %d headshot%s^n", name , kills , (kills == 1) ? "": "s" ,
|
||||
hs , (hs == 1) ? "": "s" )
|
||||
}
|
||||
}
|
||||
if ( EndMostDamage ){
|
||||
new damage = 0, who = 0, hits = 0
|
||||
for(new i = 0; i < pnum; ++i){
|
||||
get_user_rstats( players[i],stats, bodyhits )
|
||||
if ( stats[6] > damage ){
|
||||
who = players[i]
|
||||
hits = stats[5]
|
||||
damage = stats[6]
|
||||
}
|
||||
}
|
||||
if ( is_user_connected(who) ) {
|
||||
new name[32]
|
||||
get_user_name( who, name, 31 )
|
||||
len += format(g_Buffer[len] , 512 - len ,
|
||||
"Most damage: %s^n%d damage / %d hit%s^n", name , damage , hits, (hits == 1) ? "": "s" )
|
||||
}
|
||||
}
|
||||
if ( EndTeamScore )
|
||||
format(g_Buffer[len] , 512 - len , "TERRORISTs %d -- %d CTs^n", g_teamScore[0] , g_teamScore[1] )
|
||||
set_hudmessage(100,200,0,0.02,0.65,2, 0.01, 5.0, 0.01, 0.01, 2 )
|
||||
show_hudmessage( 0 , g_Buffer )
|
||||
}
|
||||
}
|
||||
|
||||
public cmdKiller(id) {
|
||||
if ( !SayHP ){
|
||||
client_print(id,print_chat, g_disabledMsg )
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
if (g_Killers[id][0]) {
|
||||
new name[32], stats[8], body[8], wpn[33], mstats[8], mbody[8]
|
||||
get_user_name(g_Killers[id][0],name,31)
|
||||
get_user_astats(id,g_Killers[id][0],stats,body,wpn,31)
|
||||
client_print(id,print_chat,"%s killed you with %s from distance of %.2f meters", name,wpn,float(g_Killers[id][3]) * 0.0254 )
|
||||
client_print(id,print_chat,"He did %d damage to you with %d hit%s and still had %dhp and %dap",
|
||||
stats[6],stats[5],(stats[5]==1)?"":"s" , g_Killers[id][1],g_Killers[id][2] )
|
||||
if ( get_user_vstats(id,g_Killers[id][0],mstats,mbody) ) {
|
||||
client_print(id,print_chat,"You did %d damage to him with %d hit%s",mstats[6], mstats[5],(mstats[5]==1)?"":"s" )
|
||||
getMyHits(id,g_Killers[id][0])
|
||||
client_print(id,print_chat,g_Buffer)
|
||||
}
|
||||
else client_print(id,print_chat,"You did no damage to him")
|
||||
}
|
||||
else {
|
||||
client_print(id,print_chat,"You have no killer...")
|
||||
}
|
||||
return PLUGIN_CONTINUE
|
||||
}
|
||||
|
||||
public cmdStatsMe(id){
|
||||
if ( !SayStatsMe ){
|
||||
client_print(id,print_chat, g_disabledMsg )
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
displayStats(id,id)
|
||||
return PLUGIN_CONTINUE
|
||||
}
|
||||
|
||||
public displayStats(id,dest) {
|
||||
new pos=0, name[32], stats[8], body[8]
|
||||
get_user_wstats(id,0,stats,body)
|
||||
#if !defined NO_STEAM
|
||||
pos = format(g_Buffer,2047,"<html><head><style type=^"text/css^">pre{color:#FFB000;}body{background:#000000;margin-left:8px;margin-top:0px;}</style></head><pre><body>")
|
||||
#endif
|
||||
pos += format(g_Buffer[pos],2047-pos,"%6s: %d^n%6s: %d^n%6s: %d^n%6s: %d^n%6s: %d^n^n",
|
||||
"Kills",stats[0],"Deaths",stats[1],"Damage",stats[6],"Hits",stats[5],"Shots",stats[4])
|
||||
pos += format(g_Buffer[pos],2047-pos, "%-12.11s %6s %6s %6s %6s %6s^n",
|
||||
"weapon","shots","hits","damage","kills","deaths")
|
||||
for(new a = 1; a < 31; ++a) {
|
||||
if (get_user_wstats(id,a,stats,body)){
|
||||
get_weaponname(a,name,31)
|
||||
pos += format(g_Buffer[pos],2047-pos,"%-12.11s %6d %6d %6d %6d %6d^n",
|
||||
name[7],stats[4],stats[5],stats[6],stats[0],stats[1])
|
||||
}
|
||||
}
|
||||
get_user_name(id,name,31)
|
||||
#if !defined NO_STEAM
|
||||
format(g_Buffer[pos],2047-pos,"</pre></body></html>")
|
||||
#endif
|
||||
show_motd(dest,g_Buffer,name)
|
||||
return PLUGIN_CONTINUE
|
||||
}
|
||||
|
||||
public cmdRank(id){
|
||||
if ( !SayRank ){
|
||||
client_print(id,print_chat, g_disabledMsg )
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
displayRank(id,id)
|
||||
return PLUGIN_CONTINUE
|
||||
}
|
||||
|
||||
displayRank(id,dest) {
|
||||
new pos=0, name[32], stats[8], body[8]
|
||||
new rank_pos = get_user_stats(id,stats,body)
|
||||
#if !defined NO_STEAM
|
||||
pos = format(g_Buffer,2047,"<html><head><style type=^"text/css^">pre{color:#FFB000;}body{background:#000000;margin-left:8px;margin-top:0px;}</style></head><pre><body>")
|
||||
#endif
|
||||
pos += format(g_Buffer[pos],2047-pos,"%s rank is %d of %d^n^n",(id==dest)?"Your":"His", rank_pos,get_statsnum())
|
||||
pos += format(g_Buffer[pos],2047-pos,"%10s: %d^n%10s: %d^n%10s: %d^n%10s: %d^n%10s: %d^n^n",
|
||||
"Kills",stats[0],"Deaths",stats[1],"Damage",stats[6],"Hits",stats[5],"Shots",stats[4])
|
||||
pos += format(g_Buffer[pos],2047-pos,"%10s:^n%10s: %d^n%10s: %d^n%10s: %d^n%10s: %d^n%10s: %d^n%10s: %d^n%10s: %d",
|
||||
"Hits",g_bodyParts[1],body[1],g_bodyParts[2],body[2],g_bodyParts[3],body[3], g_bodyParts[4],body[4],
|
||||
g_bodyParts[5],body[5],g_bodyParts[6],body[6],g_bodyParts[7],body[7])
|
||||
#if !defined NO_STEAM
|
||||
format(g_Buffer[pos],2047-pos,"</pre></body></html>")
|
||||
#endif
|
||||
get_user_name(id,name,31)
|
||||
show_motd(dest,g_Buffer,name)
|
||||
}
|
||||
|
||||
public cmdTop15(id) {
|
||||
if ( !SayTop15 ){
|
||||
client_print(id,print_chat, g_disabledMsg )
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
getTop15()
|
||||
show_motd(id,g_Buffer,"Top 15")
|
||||
return PLUGIN_CONTINUE
|
||||
}
|
||||
|
||||
public endGameStats(){
|
||||
if ( EndPlayer ){
|
||||
new players[32], inum
|
||||
get_players(players,inum)
|
||||
for(new i = 0; i < inum; ++i)
|
||||
displayStats(players[i],players[i])
|
||||
}
|
||||
else if ( EndTop15 ) {
|
||||
new players[32], inum
|
||||
get_players(players,inum)
|
||||
getTop15()
|
||||
for(new i = 0; i < inum; ++i)
|
||||
show_motd(players[i],g_Buffer,"Top 15")
|
||||
}
|
||||
}
|
||||
|
||||
public eInterMission()
|
||||
set_task(1.0,"endGameStats")
|
||||
|
||||
public cmdStats(id){
|
||||
if ( !SayStatsAll ){
|
||||
client_print(id,print_chat, g_disabledMsg )
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
showStatsMenu(id,g_userPosition[id]=0)
|
||||
return PLUGIN_CONTINUE
|
||||
}
|
||||
|
||||
public actionStatsMenu(id,key){
|
||||
switch(key){
|
||||
case 7: {
|
||||
g_userState[id] = 1 - g_userState[id]
|
||||
showStatsMenu(id,g_userPosition[id])
|
||||
}
|
||||
case 8: showStatsMenu(id,++g_userPosition[id])
|
||||
case 9: showStatsMenu(id,--g_userPosition[id])
|
||||
default:{
|
||||
new option = g_userPosition[id] * 7 + key
|
||||
new index = g_userPlayers[id][option]
|
||||
if (is_user_connected(index)){
|
||||
if (g_userState[id])
|
||||
displayRank(index,id)
|
||||
else
|
||||
displayStats(index,id)
|
||||
}
|
||||
showStatsMenu(id,g_userPosition[id])
|
||||
}
|
||||
}
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
|
||||
showStatsMenu(id,pos){
|
||||
if (pos < 0) return PLUGIN_HANDLED
|
||||
new menu_body[512], inum, k = 0, start = pos * 7
|
||||
get_players(g_userPlayers[id],inum)
|
||||
if (start >= inum) start = pos = g_userPosition[id] = 0
|
||||
new len = format(menu_body,511,"\yServer Stats\R%d/%d^n\w^n",pos + 1,((inum/7)+((inum%7)?1:0)))
|
||||
new name[32], end = start + 7, keys = (1<<9)|(1<<7)
|
||||
if (end > inum) end = inum
|
||||
for(new a = start; a < end; ++a){
|
||||
get_user_name(g_userPlayers[id][a],name,31)
|
||||
keys |= (1<<k)
|
||||
len += format(menu_body[len],511-len,"%d. %s^n\w",++k,name)
|
||||
}
|
||||
len += format(menu_body[len],511-len,"^n8. %s^n\w",g_userState[id] ? "Show rank" : "Show stats" )
|
||||
if (end != inum){
|
||||
format(menu_body[len],511-len,"^n9. More...^n0. %s" , pos ? "Back" : "Exit" )
|
||||
keys |= (1<<8)
|
||||
}
|
||||
else format(menu_body[len],511-len,"^n0. %s" , pos ? "Back" : "Exit" )
|
||||
show_menu(id,keys,menu_body)
|
||||
return PLUGIN_HANDLED
|
||||
}
|
59
plugins/stats_logging.sma
Executable file
59
plugins/stats_logging.sma
Executable file
@@ -0,0 +1,59 @@
|
||||
/* AMX Mod script. (Feb 4th, 2003)
|
||||
*
|
||||
* Stats Logging
|
||||
* by JustinHoMi
|
||||
*
|
||||
*/
|
||||
|
||||
#include <amxmod>
|
||||
#include <csstats>
|
||||
|
||||
new g_pingSum[33]
|
||||
new g_pingCount[33]
|
||||
|
||||
public plugin_init()
|
||||
register_plugin("Stats Logging","0.9","JustinHoMi")
|
||||
|
||||
public client_disconnect(id) {
|
||||
if ( is_user_bot( id ) ) return PLUGIN_CONTINUE
|
||||
remove_task( id )
|
||||
new szTeam[16],szName[32],szAuthid[32], iStats[8], iHits[8], szWeapon[24]
|
||||
new iUserid = get_user_userid( id )
|
||||
get_user_team(id, szTeam, 15 )
|
||||
get_user_name(id, szName ,31 )
|
||||
get_user_authid(id, szAuthid , 31 )
|
||||
for(new i = 1 ; i < 31 ; ++i ) {
|
||||
if( get_user_wstats( id , i ,iStats , iHits ) ) {
|
||||
|
||||
if ( i == CSW_HEGRENADE)
|
||||
copy(szWeapon[7],16,"grenade")
|
||||
else
|
||||
get_weaponname( i , szWeapon , 23 )
|
||||
|
||||
log_message("^"%s<%d><%s><%s>^" triggered ^"weaponstats^" (weapon ^"%s^") (shots ^"%d^") (hits ^"%d^") (kills ^"%d^") (headshots ^"%d^") (tks ^"%d^") (damage ^"%d^") (deaths ^"%d^")",
|
||||
szName,iUserid,szAuthid,szTeam,szWeapon[7],iStats[4],iStats[5],iStats[0], iStats[2],iStats[3],iStats[6],iStats[1])
|
||||
log_message("^"%s<%d><%s><%s>^" triggered ^"weaponstats2^" (weapon ^"%s^") (head ^"%d^") (chest ^"%d^") (stomach ^"%d^") (leftarm ^"%d^") (rightarm ^"%d^") (leftleg ^"%d^") (rightleg ^"%d^")",
|
||||
szName,iUserid,szAuthid,szTeam,szWeapon[7],iHits[1],iHits[2],iHits[3], iHits[4],iHits[5],iHits[6],iHits[7])
|
||||
}
|
||||
}
|
||||
new iTime = get_user_time( id , 1 )
|
||||
log_message("^"%s<%d><%s><%s>^" triggered ^"time^" (time ^"%d:%02d^")",
|
||||
szName,iUserid,szAuthid,szTeam, (iTime / 60), (iTime % 60) )
|
||||
log_message("^"%s<%d><%s><%s>^" triggered ^"latency^" (ping ^"%d^")",
|
||||
szName,iUserid,szAuthid,szTeam, (g_pingSum[id] / ( g_pingCount[id] ? g_pingCount[id] : 1 ) ) )
|
||||
return PLUGIN_CONTINUE
|
||||
}
|
||||
|
||||
public client_putinserver(id) {
|
||||
if ( !is_user_bot( id ) ){
|
||||
g_pingSum[ id ] = g_pingCount[ id ] = 0
|
||||
set_task( 19.5 , "getPing" , id , "" , 0 , "b" )
|
||||
}
|
||||
}
|
||||
|
||||
public getPing( id ) {
|
||||
new iPing, iLoss
|
||||
get_user_ping( id , iPing, iLoss)
|
||||
g_pingSum[ id ] += iPing
|
||||
++g_pingCount[ id ]
|
||||
}
|
206
plugins/statscfg.sma
Executable file
206
plugins/statscfg.sma
Executable file
@@ -0,0 +1,206 @@
|
||||
/* AMX Mod script.
|
||||
*
|
||||
* (c) 2003, OLO
|
||||
* This file is provided as is (no warranties).
|
||||
*
|
||||
* Admin command:
|
||||
* amx_statscfgmenu - displays stats configuration menu
|
||||
* amx_statscfg - displays help for stats configuration commands
|
||||
*/
|
||||
|
||||
#include <amxmod>
|
||||
#include <amxmisc>
|
||||
|
||||
#define MAX_MENU_DATA 64
|
||||
|
||||
new g_menuData[MAX_MENU_DATA][32]
|
||||
new g_menuDataVar[MAX_MENU_DATA][32]
|
||||
new g_menuDataId[MAX_MENU_DATA]
|
||||
new g_menuDataNum
|
||||
new g_menuPosition[33]
|
||||
new g_fileToSave[64]
|
||||
new bool:g_modified
|
||||
|
||||
public plugin_precache(){
|
||||
register_clcmd("amx_statscfgmenu","cmdCfgMenu",ADMIN_CFG,"- displays stats configuration menu")
|
||||
register_concmd("amx_statscfg","cmdCfg",ADMIN_CFG,"- displays help for stats configuration")
|
||||
}
|
||||
|
||||
public plugin_init() {
|
||||
register_plugin("Stats Configuration","0.9","default")
|
||||
register_menucmd(register_menuid("\yStats Configuration"),1023,"actionCfgMenu")
|
||||
build_path( g_fileToSave , 63 , "$basedir/stats.ini" )
|
||||
loadSettings(g_fileToSave)
|
||||
}
|
||||
|
||||
public cmdCfg( id,level,cid ){
|
||||
if (!cmd_access(id,level,cid,1))
|
||||
return PLUGIN_HANDLED
|
||||
|
||||
new cmds[32]
|
||||
read_argv(1,cmds,31)
|
||||
new option = equali(cmds, "on" ) ? 1 : 0
|
||||
if ( !option ) option = equali(cmds, "off" ) ? 2 : 0
|
||||
if ( read_argc() > 2 && option ) {
|
||||
new var[32], enabled = 0
|
||||
read_argv( 2 , var , 31 )
|
||||
for( new a = 0; a < g_menuDataNum; ++a ) {
|
||||
if ( containi( g_menuDataVar[ a ] , var ) != -1 ) {
|
||||
g_modified = true
|
||||
++enabled
|
||||
if ( option == 1 ) {
|
||||
set_xvar_num( g_menuDataId[a] , 1 )
|
||||
console_print(id,"Enabled %s" , g_menuData[a] )
|
||||
}
|
||||
else {
|
||||
set_xvar_num( g_menuDataId[a] , 0 )
|
||||
console_print(id,"Disabled %s" , g_menuData[a] )
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( enabled )
|
||||
console_print(id,"Total %d", enabled )
|
||||
else
|
||||
console_print(id,"Couldn't find option(s) with such variable (name ^"%s^")", var )
|
||||
}
|
||||
else if ( equali(cmds, "save" ) ) {
|
||||
if ( saveSettings( g_fileToSave ) ){
|
||||
g_modified = false
|
||||
console_print(id,"Stats configuration saved successfully")
|
||||
}
|
||||
else
|
||||
console_print(id,"Failed to save stats configuration!!!")
|
||||
}
|
||||
else if ( equali(cmds, "load" ) ) {
|
||||
if ( loadSettings( g_fileToSave ) ){
|
||||
g_modified = false
|
||||
console_print(id,"Stats configuration loaded successfully")
|
||||
}
|
||||
else
|
||||
console_print(id,"Failed to load stats configuration!!!")
|
||||
}
|
||||
else if ( equali(cmds, "list" ) ) {
|
||||
new arg1[8]
|
||||
new start = read_argv(2,arg1,7) ? strtonum(arg1) : 1
|
||||
if (--start < 0) start = 0
|
||||
if (start >= g_menuDataNum) start = g_menuDataNum - 1
|
||||
new end = start + 10
|
||||
if (end > g_menuDataNum) end = g_menuDataNum
|
||||
console_print(id, "^n----- Stats Configuration: -----")
|
||||
console_print(id, " %-29.28s %-24.23s %-9.8s","name","variable","status")
|
||||
if ( start != -1 ) {
|
||||
for(new a = start; a < end; ++a){
|
||||
console_print(id, "%3d: %-29.28s %-24.23s %-9.8s",a + 1,
|
||||
g_menuData[a], g_menuDataVar[a], get_xvar_num( g_menuDataId[ a ] ) ? "ON" : "OFF")
|
||||
}
|
||||
}
|
||||
console_print(id,"----- Entries %i - %i of %i -----",start+1,end,g_menuDataNum)
|
||||
if (end < g_menuDataNum)
|
||||
console_print(id,"----- Use 'amx_statscfg list %i' for more -----",end+1)
|
||||
else
|
||||
console_print(id,"----- Use 'amx_statscfg list 1' for begin -----")
|
||||
}
|
||||
else if ( equali(cmds, "add" ) && read_argc() > 3 ) {
|
||||
if ( g_menuDataNum < MAX_MENU_DATA ) {
|
||||
read_argv(2, g_menuData[g_menuDataNum] , 31 )
|
||||
read_argv(3, g_menuDataVar[g_menuDataNum] , 31 )
|
||||
g_menuDataId[g_menuDataNum] = get_xvar_id( g_menuDataVar[g_menuDataNum] )
|
||||
++g_menuDataNum
|
||||
}
|
||||
else console_print(id, "Can't add stats to the list, limit reached!")
|
||||
}
|
||||
else {
|
||||
console_print(id,"Usage: amx_statscfg <command> [parameters] ...")
|
||||
console_print(id,"Commands:")
|
||||
console_print(id,"^ton <variable> - enable specified option")
|
||||
console_print(id,"^toff <variable> - disable specified option")
|
||||
console_print(id,"^tsave - save stats configuration")
|
||||
console_print(id,"^tload - load stats configuration")
|
||||
console_print(id,"^tlist [id] - list stats status")
|
||||
console_print(id,"^tadd <name> <variable> - add stats to the list")
|
||||
}
|
||||
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
|
||||
public cmdCfgMenu(id,level,cid){
|
||||
if (cmd_access(id,level,cid,1))
|
||||
displayCfgMenu(id,g_menuPosition[id] = 0)
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
|
||||
displayCfgMenu(id,pos){
|
||||
if (pos < 0) return
|
||||
new menu_body[512], start = pos * 7
|
||||
if (start >= g_menuDataNum) start = pos = g_menuPosition[id] = 0
|
||||
new len = format(menu_body,511,"\yStats Configuration\R%d/%d^n\w^n",
|
||||
pos + 1,((g_menuDataNum/7)+((g_menuDataNum%7)?1:0)))
|
||||
new end = start + 7, keys = (1<<9)|(1<<7), k = 0
|
||||
if (end > g_menuDataNum) end = g_menuDataNum
|
||||
for(new a = start; a < end; ++a){
|
||||
keys |= (1<<k)
|
||||
len += format(menu_body[len],511-len,"%d. %s\y\R%s^n\w",++k,
|
||||
g_menuData[a], get_xvar_num( g_menuDataId[ a ] ) ? "ON" : "OFF" )
|
||||
}
|
||||
if ( g_menuDataNum == 0 )
|
||||
len += format(menu_body[len],511-len,"\dStats plugins are not^ninstalled on this server^n\w")
|
||||
len += format(menu_body[len],511-len,"^n8. Save configuration\y\R%s^n\w",g_modified ? "*" : "")
|
||||
if (end != g_menuDataNum){
|
||||
format(menu_body[len],511-len,"^n9. More...^n0. %s", pos ? "Back" : "Exit")
|
||||
keys |= (1<<8)
|
||||
}
|
||||
else format(menu_body[len],511-len,"^n0. %s", pos ? "Back" : "Exit")
|
||||
show_menu(id,keys,menu_body)
|
||||
}
|
||||
|
||||
public actionCfgMenu(id,key){
|
||||
switch(key){
|
||||
case 7:{
|
||||
if (saveSettings(g_fileToSave)){
|
||||
g_modified = false
|
||||
client_print(id,print_chat,"* Configuration saved successfully")
|
||||
}
|
||||
else
|
||||
client_print(id,print_chat,"* Failed to save configuration!!!")
|
||||
displayCfgMenu(id,g_menuPosition[id])
|
||||
}
|
||||
case 8: displayCfgMenu(id,++g_menuPosition[id])
|
||||
case 9: displayCfgMenu(id,--g_menuPosition[id])
|
||||
default:{
|
||||
g_modified = true
|
||||
new a = g_menuPosition[id] * 7 + key
|
||||
set_xvar_num( g_menuDataId[ a ] , 1 - get_xvar_num( g_menuDataId[ a ] ) )
|
||||
displayCfgMenu( id , g_menuPosition[ id ] )
|
||||
}
|
||||
}
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
|
||||
saveSettings(filename[]){
|
||||
if (file_exists(filename))
|
||||
delete_file(filename)
|
||||
if (!write_file(filename,";Generated by Stats Configuration Plugin. Do not modify!^n;Variable Description"))
|
||||
return 0
|
||||
new text[256]
|
||||
for(new a = 0; a < g_menuDataNum; ++a){
|
||||
if ( get_xvar_num( g_menuDataId[ a ] ) ) {
|
||||
format(text,255,"%-24.23s ;%s",g_menuDataVar[a],g_menuData[a])
|
||||
write_file(filename,text)
|
||||
}
|
||||
}
|
||||
return 1
|
||||
}
|
||||
|
||||
loadSettings(filename[]){
|
||||
if (!file_exists(filename))
|
||||
return 0
|
||||
new text[256], name[32]
|
||||
new len, pos = 0, xid
|
||||
while (read_file(filename,pos++,text,255,len)) {
|
||||
if ( text[0] == ';' ) continue // line is a comment
|
||||
parse( text , name , 31 )
|
||||
if ( ( xid = get_xvar_id( name ) ) != -1 )
|
||||
set_xvar_num( xid , 1 )
|
||||
}
|
||||
return 1
|
||||
}
|
179
plugins/telemenu.sma
Executable file
179
plugins/telemenu.sma
Executable file
@@ -0,0 +1,179 @@
|
||||
/* AMX Mod script.
|
||||
*
|
||||
* (c) 2003, OLO
|
||||
* This file is provided as is (no warranties).
|
||||
*
|
||||
* Fun Module is required!
|
||||
*
|
||||
* Admin command:
|
||||
* amx_teleportmenu - displays teleport menu
|
||||
*/
|
||||
|
||||
#include <amxmod>
|
||||
#include <amxmisc>
|
||||
|
||||
new g_menuPosition[33]
|
||||
new g_menuPlayers[33][32]
|
||||
new g_menuPlayersNum[33]
|
||||
new g_menuOption[33] = { -1 , ... }
|
||||
new g_menuOrgin[33][3]
|
||||
new g_logFile[16]
|
||||
new g_cstrikeRunning
|
||||
|
||||
public plugin_init()
|
||||
{
|
||||
register_plugin("Teleport Menu","0.9","default")
|
||||
register_clcmd("amx_teleportmenu","cmdTelMenu",ADMIN_CFG,"- displays teleport menu")
|
||||
register_menucmd(register_menuid("Teleport Menu"),1023,"actionTelMenu")
|
||||
get_logfile(g_logFile,15)
|
||||
|
||||
g_cstrikeRunning = is_running("cstrike")
|
||||
}
|
||||
|
||||
public actionTelMenu(id,key)
|
||||
{
|
||||
switch(key){
|
||||
case 6:{
|
||||
g_menuOption[id] = 1 - g_menuOption[id]
|
||||
displayTelMenu(id,g_menuPosition[id])
|
||||
}
|
||||
case 7:{
|
||||
if (g_menuOption[id] < 0) /* unlocking position for the first time */
|
||||
g_menuOption[id] = 0
|
||||
get_user_origin(id,g_menuOrgin[id])
|
||||
displayTelMenu(id,g_menuPosition[id])
|
||||
}
|
||||
case 8: displayTelMenu(id,++g_menuPosition[id])
|
||||
case 9: displayTelMenu(id,--g_menuPosition[id])
|
||||
default:{
|
||||
new player = g_menuPlayers[id][g_menuPosition[id] * 6 + key]
|
||||
|
||||
new name2[32]
|
||||
get_user_name(player,name2,31)
|
||||
|
||||
if (!is_user_alive(player))
|
||||
{
|
||||
client_print(id,print_chat,"That action can't be performed on dead client ^"%s^"",name2)
|
||||
displayTelMenu(id,g_menuPosition[id])
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
|
||||
if (g_menuOption[id] > 0)
|
||||
{
|
||||
set_user_origin(player,g_menuOrgin[id])
|
||||
}
|
||||
else
|
||||
{
|
||||
new origin[3]
|
||||
get_user_origin(id,origin)
|
||||
set_user_origin(player,origin)
|
||||
}
|
||||
|
||||
new authid[32],authid2[32], name[32]
|
||||
|
||||
get_user_authid(id,authid,31)
|
||||
get_user_authid(player,authid2,31)
|
||||
get_user_name(id,name,31)
|
||||
|
||||
log_to_file(g_logFile,"Cmd: ^"%s<%d><%s><>^" teleport ^"%s<%d><%s><>^"",
|
||||
name,get_user_userid(id),authid, name2,get_user_userid(player),authid2 )
|
||||
|
||||
switch(get_cvar_num("amx_show_activity")) {
|
||||
case 2: client_print(0,print_chat,"ADMIN %s: teleport %s",name,name2)
|
||||
case 1: client_print(0,print_chat,"ADMIN: teleport %s",name2)
|
||||
}
|
||||
|
||||
displayTelMenu(id,g_menuPosition[id])
|
||||
}
|
||||
}
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
|
||||
|
||||
displayTelMenu(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 * 6
|
||||
new bool:blockMenu = (is_user_alive(id)&&g_menuOption[id]<1) ? true : false
|
||||
|
||||
if (start >= g_menuPlayersNum[id])
|
||||
start = pos = g_menuPosition[id] = 0
|
||||
|
||||
new len = format(menuBody,511, g_cstrikeRunning ?
|
||||
"\yTeleport Menu\R%d/%d^n\w^n" : "Teleport Menu %d/%d^n^n" ,
|
||||
pos+1,( g_menuPlayersNum[id] / 6 + ((g_menuPlayersNum[id] % 6) ? 1 : 0 )) )
|
||||
|
||||
new end = start + 6
|
||||
new keys = (1<<9)|(1<<7)
|
||||
|
||||
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 ( blockMenu || !is_user_alive(i) || (get_user_flags(i)&ADMIN_IMMUNITY) )
|
||||
{
|
||||
++b
|
||||
if ( g_cstrikeRunning )
|
||||
len += format(menuBody[len],511-len,"\d%d. %s^n\w",b,name)
|
||||
else
|
||||
len += format(menuBody[len],511-len,"#. %s^n",name)
|
||||
}
|
||||
else
|
||||
{
|
||||
keys |= (1<<b)
|
||||
len += format(menuBody[len],511-len,"%d. %s^n",++b,name)
|
||||
}
|
||||
}
|
||||
|
||||
if ( g_menuOption[id] > 0 ) // 1
|
||||
{
|
||||
keys |= (1<<6)
|
||||
len += format(menuBody[len],511-len,"^n7. To location: %d %d %d^n",
|
||||
g_menuOrgin[id][0],g_menuOrgin[id][1] ,g_menuOrgin[id][2])
|
||||
}
|
||||
else if ( g_menuOption[id] ) // -1
|
||||
{
|
||||
if ( g_cstrikeRunning )
|
||||
len += format(menuBody[len],511-len,"^n\d7. Current Location^n\w")
|
||||
else
|
||||
len += format(menuBody[len],511-len,"^n#. Current Location^n")
|
||||
}
|
||||
else // 0
|
||||
{
|
||||
keys |= (1<<6)
|
||||
len += format(menuBody[len],511-len,"^n7. Current Location^n")
|
||||
}
|
||||
|
||||
len += format(menuBody[len],511-len,"8. Save Location^n")
|
||||
|
||||
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 cmdTelMenu(id,level,cid)
|
||||
{
|
||||
if (cmd_access(id,level,cid,1))
|
||||
displayTelMenu(id,g_menuPosition[id] = 0)
|
||||
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
|
185
plugins/timeleft.sma
Executable file
185
plugins/timeleft.sma
Executable file
@@ -0,0 +1,185 @@
|
||||
/* AMX Mod script.
|
||||
*
|
||||
* (c) 2003, OLO
|
||||
* This file is provided as is (no warranties).
|
||||
*
|
||||
* Commands:
|
||||
* say timeleft - displays timeleft (available for all clients)
|
||||
* amx_time_display < flags time > ... - sets time displaying
|
||||
* Flags:
|
||||
* "a" - display text
|
||||
* "b" - use voice
|
||||
* "c" - don't add "remaining" (only in voice)
|
||||
* "d" - don't add "hours/minutes/seconds" (only in voice)
|
||||
* "e" - show/speak if current time is less than this set
|
||||
* Example:
|
||||
* amx_time_display "ab 600" "ab 300" "ab 180" "ab 60" "bcde 11"
|
||||
*
|
||||
* Cvars:
|
||||
* amx_time_voice < 1|0 > - announces "say thetime"
|
||||
* and "say timeleft" with voice when set to 1
|
||||
*/
|
||||
|
||||
#include <amxmod>
|
||||
|
||||
new g_TimeSet[32][2]
|
||||
new g_LastTime
|
||||
new g_CountDown
|
||||
new g_Switch
|
||||
|
||||
public plugin_init() {
|
||||
register_plugin("TimeLeft","0.9","default")
|
||||
register_cvar("amx_time_voice","1")
|
||||
register_srvcmd("amx_time_display","setDisplaying")
|
||||
register_cvar("amx_timeleft","00:00",FCVAR_SERVER|FCVAR_EXTDLL|FCVAR_UNLOGGED|FCVAR_SPONLY)
|
||||
register_clcmd("say timeleft","sayTimeLeft",0,"- displays timeleft")
|
||||
register_clcmd("say thetime","sayTheTime",0,"- displays current time")
|
||||
set_task(0.8,"timeRemain",8648458,"",0,"b")
|
||||
}
|
||||
|
||||
public sayTheTime(id){
|
||||
if ( get_cvar_num("amx_time_voice") ){
|
||||
new mhours[6], mmins[6], whours[32], wmins[32], wpm[6]
|
||||
get_time("%H",mhours,5)
|
||||
get_time("%M",mmins,5)
|
||||
new mins = strtonum(mmins)
|
||||
new hrs = strtonum(mhours)
|
||||
if (mins)
|
||||
num_to_word(mins,wmins,31)
|
||||
else
|
||||
wmins[0] = 0
|
||||
if (hrs < 12)
|
||||
wpm = "am "
|
||||
else {
|
||||
if (hrs > 12) hrs -= 12
|
||||
wpm = "pm "
|
||||
}
|
||||
if (hrs)
|
||||
num_to_word(hrs,whours,31)
|
||||
else
|
||||
whours = "twelve "
|
||||
client_cmd(id, "spk ^"fvox/time_is_now %s_period %s%s^"",whours,wmins,wpm )
|
||||
}
|
||||
new ctime[64]
|
||||
get_time("%m/%d/%Y - %H:%M:%S",ctime,63)
|
||||
client_print(0,print_chat, "The time: %s",ctime )
|
||||
return PLUGIN_CONTINUE
|
||||
}
|
||||
|
||||
public sayTimeLeft(id){
|
||||
if (get_cvar_float("mp_timelimit")) {
|
||||
new a = get_timeleft()
|
||||
if ( get_cvar_num("amx_time_voice") ) {
|
||||
new svoice[128]
|
||||
setTimeVoice( svoice , 127 , 0 , a )
|
||||
client_cmd( id , svoice )
|
||||
}
|
||||
client_print(0,print_chat, "Time Left: %d:%02d", (a / 60) , (a % 60) )
|
||||
}
|
||||
else
|
||||
client_print(0,print_chat, "No Time Limit" )
|
||||
return PLUGIN_CONTINUE
|
||||
}
|
||||
|
||||
setTimeText(text[],len,tmlf){
|
||||
new secs = tmlf % 60
|
||||
new mins = tmlf / 60
|
||||
if (secs == 0)
|
||||
format(text,len,"%d minute%s", mins , (mins > 1) ? "s" : "" )
|
||||
else if (mins == 0)
|
||||
format(text,len,"%d second%s", secs,(secs > 1) ? "s" : "" )
|
||||
else
|
||||
format(text,len,"%d minute%s %d second%s", mins , (mins > 1) ? "s" : "" ,secs ,(secs > 1) ? "s" : "" )
|
||||
}
|
||||
|
||||
setTimeVoice(text[],len,flags,tmlf){
|
||||
new temp[7][32]
|
||||
new secs = tmlf % 60
|
||||
new mins = tmlf / 60
|
||||
for(new a = 0;a < 7;++a)
|
||||
temp[a][0] = 0
|
||||
if (secs > 0){
|
||||
num_to_word(secs,temp[4],31)
|
||||
if (!(flags & 8)) temp[5] = "seconds " /* there is no "second" in default hl */
|
||||
}
|
||||
if (mins > 59){
|
||||
new hours = mins / 60
|
||||
num_to_word(hours,temp[0],31)
|
||||
if (!(flags & 8)) temp[1] = "hours "
|
||||
mins = mins % 60
|
||||
}
|
||||
if (mins > 0) {
|
||||
num_to_word(mins ,temp[2],31)
|
||||
if (!(flags & 8)) temp[3] = "minutes "
|
||||
}
|
||||
if (!(flags & 4)) temp[6] = "remaining "
|
||||
return format(text,len,"spk ^"vox/%s%s%s%s%s%s%s^"", temp[0],temp[1],temp[2],temp[3],temp[4],temp[5],temp[6] )
|
||||
}
|
||||
|
||||
findDispFormat(time){
|
||||
for(new i = 0;g_TimeSet[i][0];++i){
|
||||
if (g_TimeSet[i][1] & 16){
|
||||
if (g_TimeSet[i][0] > time){
|
||||
if (!g_Switch) {
|
||||
g_CountDown = g_Switch = time
|
||||
remove_task(8648458)
|
||||
set_task(1.0,"timeRemain",34543,"",0,"b")
|
||||
}
|
||||
return i
|
||||
}
|
||||
}
|
||||
else if (g_TimeSet[i][0] == time){
|
||||
return i
|
||||
}
|
||||
}
|
||||
return -1
|
||||
}
|
||||
|
||||
public setDisplaying(){
|
||||
new arg[32], flags[32], num[32]
|
||||
new argc = read_argc() - 1
|
||||
new i = 0
|
||||
while (i < argc && i < 32){
|
||||
read_argv(i+1,arg,31)
|
||||
parse(arg,flags,31,num,31)
|
||||
g_TimeSet[i][0] = str_to_num(num)
|
||||
g_TimeSet[i][1] = read_flags(flags)
|
||||
i++
|
||||
}
|
||||
g_TimeSet[i][0] = 0
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
|
||||
public timeRemain(param[]){
|
||||
new gmtm = get_timeleft()
|
||||
new tmlf = g_Switch ? --g_CountDown : gmtm
|
||||
new stimel[12]
|
||||
format(stimel,11,"%02d:%02d",gmtm / 60, gmtm % 60)
|
||||
set_cvar_string("amx_timeleft",stimel)
|
||||
if ( g_Switch && gmtm > g_Switch ) {
|
||||
remove_task(34543)
|
||||
g_Switch = 0
|
||||
set_task(0.8,"timeRemain",8648458,"",0,"b")
|
||||
return
|
||||
}
|
||||
if (tmlf > 0 && g_LastTime != tmlf){
|
||||
g_LastTime = tmlf
|
||||
new tm_set = findDispFormat(tmlf)
|
||||
if ( tm_set != -1){
|
||||
new flags = g_TimeSet[tm_set][1]
|
||||
new arg[128]
|
||||
if (flags & 1){
|
||||
setTimeText(arg,127,tmlf)
|
||||
if (flags & 16)
|
||||
set_hudmessage(255, 255, 255, -1.0, 0.85, 0, 0.0, 1.1, 0.1, 0.5, 1)
|
||||
else
|
||||
set_hudmessage(255, 255, 255, -1.0, 0.85, 0, 0.0, 3.0, 0.0, 0.5, 1)
|
||||
show_hudmessage(0,arg)
|
||||
}
|
||||
if (flags & 2){
|
||||
setTimeVoice(arg,127,flags,tmlf)
|
||||
client_cmd(0,arg)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
120
plugins/welcomemsg.sma
Executable file
120
plugins/welcomemsg.sma
Executable file
@@ -0,0 +1,120 @@
|
||||
/* AMX Mod script.
|
||||
*
|
||||
* (c) 2003, OLO
|
||||
* This file is provided as is (no warranties).
|
||||
*/
|
||||
|
||||
#include <amxmod>
|
||||
#include <amxmisc>
|
||||
|
||||
// Settings (comment unwanted options)
|
||||
#define SHOW_MODS
|
||||
#define READ_FROM_FILE
|
||||
//#define SHOW_TIME_AND_IP
|
||||
|
||||
new g_cstrikeRunning
|
||||
|
||||
#if defined READ_FROM_FILE
|
||||
new g_motdFile[64]
|
||||
#endif
|
||||
|
||||
public plugin_init()
|
||||
{
|
||||
register_plugin("Welcome Message","0.9","default")
|
||||
g_cstrikeRunning = is_running("cstrike")
|
||||
#if defined READ_FROM_FILE
|
||||
build_path( g_motdFile , 63 , "$basedir/conmotd.txt" )
|
||||
#endif
|
||||
}
|
||||
|
||||
new g_Bar[] = "=============="
|
||||
|
||||
public client_connect(id) {
|
||||
new name[32], hostname[64], nextmap[32], mapname[32]
|
||||
|
||||
get_cvar_string("hostname",hostname,63)
|
||||
get_user_name(id,name,31)
|
||||
|
||||
get_mapname(mapname,31)
|
||||
get_cvar_string("amx_nextmap",nextmap,31)
|
||||
|
||||
client_cmd(id, "echo ;echo %s%s%s%s",g_Bar,g_Bar,g_Bar,g_Bar)
|
||||
client_cmd(id, "echo ^" Hello %s, welcome to %s^"",name,hostname)
|
||||
|
||||
#if defined SHOW_TIME_AND_IP
|
||||
new stime[64],ip[32]
|
||||
get_time("%A %B %d, %Y - %H:%M:%S",stime,63)
|
||||
get_user_ip(id,ip,31)
|
||||
client_cmd(id, "echo ^" Today is %s^"",stime)
|
||||
client_cmd(id, "echo ^" You are playing from: %s^"",ip)
|
||||
#endif
|
||||
|
||||
new maxplayers = get_cvar_num("sv_visiblemaxplayers")
|
||||
if ( maxplayers < 0 ) maxplayers = get_maxplayers()
|
||||
client_cmd(id, "echo ^" Players on server: %d/%d^"",get_playersnum(),maxplayers)
|
||||
client_cmd(id, "echo ^" Current map: %s, Next map: %s^"",mapname,nextmap)
|
||||
|
||||
// Time limit and time remaining
|
||||
new Float:mp_timelimit = get_cvar_float("mp_timelimit")
|
||||
if (mp_timelimit){
|
||||
new timeleft = get_timeleft()
|
||||
if (timeleft > 0)
|
||||
client_cmd(id, "echo ^" Time Left: %d:%02d of %.0f minutes^"", timeleft / 60, timeleft % 60, mp_timelimit )
|
||||
}
|
||||
else{
|
||||
client_cmd(id, "echo ^" No time limit^"")
|
||||
}
|
||||
|
||||
// C4 and FF
|
||||
if ( g_cstrikeRunning ){
|
||||
client_cmd(id, "echo ^" Friendly fire is %s^"", get_cvar_float("mp_friendlyfire") ? "ON" : "OFF")
|
||||
client_cmd(id, "echo ^" C4 timer is set to %.0f sec.^"",get_cvar_float("mp_c4timer"))
|
||||
}
|
||||
|
||||
// Server Mods
|
||||
#if defined SHOW_MODS
|
||||
new mod_ver[32]
|
||||
client_cmd(id, "echo ;echo ^" Server mods:^"")
|
||||
get_cvar_string("amx_version",mod_ver,31)
|
||||
if (mod_ver[0]) client_cmd(id, "echo ^" o AMX Mod %s^"",mod_ver)
|
||||
get_cvar_string("statsme_version",mod_ver,31)
|
||||
if (mod_ver[0]) client_cmd(id, "echo ^" o StatsMe %s^"",mod_ver)
|
||||
get_cvar_string("clanmod_version",mod_ver,31)
|
||||
if (mod_ver[0]) client_cmd(id, "echo ^" o ClanMod %s^"",mod_ver)
|
||||
get_cvar_string("admin_mod_version",mod_ver,31)
|
||||
if (mod_ver[0]) client_cmd(id, "echo ^" o AdminMod %s^"",mod_ver)
|
||||
get_cvar_string("chicken_version",mod_ver,31)
|
||||
if (mod_ver[0]) client_cmd(id, "echo ^" o Chicken %s^"",mod_ver)
|
||||
get_cvar_string("csguard_version",mod_ver,31)
|
||||
if (mod_ver[0]) client_cmd(id, "echo ^" o CSGuard %s^"",mod_ver)
|
||||
get_cvar_string("hlguard_version",mod_ver,31)
|
||||
if (mod_ver[0]) client_cmd(id, "echo ^" o HLGuard %s^"",mod_ver)
|
||||
get_cvar_string("plbot_version",mod_ver,31)
|
||||
if (mod_ver[0]) client_cmd(id, "echo ^" o PLBot %s^"",mod_ver)
|
||||
get_cvar_string("booster_version",mod_ver,31)
|
||||
if (mod_ver[0]) client_cmd(id, "echo ^" o HL-Booster %s^"",mod_ver)
|
||||
get_cvar_string("axn_version",mod_ver,31)
|
||||
if (mod_ver[0]) client_cmd(id, "echo ^" o AXN %s^"",mod_ver)
|
||||
get_cvar_string("bmx_version",mod_ver,31)
|
||||
if (mod_ver[0]) client_cmd(id, "echo ^" o BMX %s^"",mod_ver)
|
||||
get_cvar_string("cdversion",mod_ver,31)
|
||||
if (mod_ver[0]) client_cmd(id, "echo ^" o Cheating-Death %s in %s Mode^"",
|
||||
mod_ver, get_cvar_num("cdrequired") ? "Required" : "Optional" )
|
||||
get_cvar_string("atac_version",mod_ver,31)
|
||||
if (mod_ver[0]) client_cmd(id, "echo ^" o ATAC %s%s^"" , mod_ver , get_cvar_num("atac_status")
|
||||
? " (setinfo atac_status_off 1 disables Live Status)" : "" )
|
||||
|
||||
#endif
|
||||
|
||||
// Info. from custom file
|
||||
#if defined READ_FROM_FILE
|
||||
if (file_exists(g_motdFile)) {
|
||||
new message[192], len, line = 0
|
||||
client_cmd(id, "echo %s%s%s%s",g_Bar,g_Bar,g_Bar,g_Bar)
|
||||
while(read_file(g_motdFile,line++,message,191,len))
|
||||
client_cmd(id,"echo ^"%s^"",message)
|
||||
}
|
||||
#endif
|
||||
|
||||
client_cmd(id, "echo %s%s%s%s",g_Bar,g_Bar,g_Bar,g_Bar)
|
||||
}
|
Reference in New Issue
Block a user