some optimizations

This commit is contained in:
Felix Geyer 2004-08-05 11:09:42 +00:00
parent 89b4ef92b5
commit f88ce70892
5 changed files with 33 additions and 48 deletions

View File

@ -337,9 +337,7 @@ public client_infochanged(id)
} }
public ackSignal(id) { public ackSignal(id) {
new no_entry[64] server_cmd("kick #%d ^"%L^"", get_user_userid(id), id, "NO_ENTRY" )
format(no_entry,63,"%L",id,"NO_ENTRY")
server_cmd("kick #%d ^"%L^"", get_user_userid(id), no_entry )
} }
public client_authorized(id) public client_authorized(id)

View File

@ -77,14 +77,13 @@ public cmdSayChat(id) {
case 'c': a = 6 case 'c': a = 6
case 'o': a = 7 case 'o': a = 7
} }
new name[32], authid[32], userid, color[16] new name[32], authid[32], userid
get_user_authid(id,authid,31) get_user_authid(id,authid,31)
get_user_name(id,name,31) get_user_name(id,name,31)
userid = get_user_userid(id) userid = get_user_userid(id)
format(color,15,"%L","en",g_Colors[a])
log_amx("Chat: ^"%s<%d><%s><>^" tsay ^"%s^"",name,userid,authid,message[i+1]) log_amx("Chat: ^"%s<%d><%s><>^" tsay ^"%s^"",name,userid,authid,message[i+1])
log_message("^"%s<%d><%s><>^" triggered ^"amx_tsay^" (text ^"%s^") (color ^"%s^")", log_message("^"%s<%d><%s><>^" triggered ^"amx_tsay^" (text ^"%s^") (color ^"%L^")",
name,userid,authid,message[ i+1 ],color) name,userid,authid,message[ i+1 ],"en",g_Colors[a])
if (++g_msgChannel>6||g_msgChannel<3) if (++g_msgChannel>6||g_msgChannel<3)
g_msgChannel = 3 g_msgChannel = 3
new Float:verpos = g_Pos[i][1] + float(g_msgChannel) / 35.0 new Float:verpos = g_Pos[i][1] + float(g_msgChannel) / 35.0

View File

@ -220,7 +220,6 @@ public cmdBan(id,level,cid) {
get_players(players,pnum,"c") get_players(players,pnum,"c")
for (new i=0;i<pnum;i++) { for (new i=0;i<pnum;i++) {
len = format(msg,255,"%L",players[i],"ADMIN") len = format(msg,255,"%L",players[i],"ADMIN")
strtoupper(msg)
if (activity==1) if (activity==1)
len += copy(msg[len],255-len,":") len += copy(msg[len],255-len,":")
else else
@ -235,6 +234,7 @@ public cmdBan(id,level,cid) {
} }
} }
console_print(id,"[AMXX] %L",id,"CLIENT_BANNED",name2) console_print(id,"[AMXX] %L",id,"CLIENT_BANNED",name2)
return PLUGIN_HANDLED return PLUGIN_HANDLED
} }
@ -370,7 +370,6 @@ public cmdCvar(id,level,cid) {
get_players(players,pnum,"c") get_players(players,pnum,"c")
for (new i=0;i<pnum;i++) { for (new i=0;i<pnum;i++) {
len = format(admin,255,"%L",players[i],"ADMIN") len = format(admin,255,"%L",players[i],"ADMIN")
strtoupper(admin)
if (activity == 1) if (activity == 1)
len += copy(admin[len],255-len,":") len += copy(admin[len],255-len,":")
else else
@ -393,13 +392,13 @@ public cmdPlugins(id,level,cid) {
return PLUGIN_HANDLED return PLUGIN_HANDLED
new name[32],version[32],author[32],filename[32],status[32] new name[32],version[32],author[32],filename[32],status[32]
new Lname[32],Lversion[32],Lauthor[32],Lfile[32],Lstatus[32] new lName[32],lVersion[32],lAuthor[32],lFile[32],lStatus[32]
format(Lname,31,"%L",id,"NAME") format(lName,31,"%L",id,"NAME")
format(Lversion,31,"%L",id,"VERSION") format(lVersion,31,"%L",id,"VERSION")
format(Lauthor,31,"%L",id,"AUTHOR") format(lAuthor,31,"%L",id,"AUTHOR")
format(Lfile,31,"%L",id,"FILE") format(lFile,31,"%L",id,"FILE")
format(Lstatus,31,"%L",id,"STATUS") format(lStatus,31,"%L",id,"STATUS")
/* /*
new motd_body[MOTD_LEN],state[4] new motd_body[MOTD_LEN],state[4]
@ -425,7 +424,7 @@ public cmdPlugins(id,level,cid) {
new running = 0 new running = 0
console_print(id,"%L:",id,"LOADED_PLUGINS") console_print(id,"%L:",id,"LOADED_PLUGINS")
console_print(id,"%-18.17s %-8.7s %-17.16s %-16.15s %-9.8s",Lname,Lversion,Lauthor,Lfile,Lstatus) console_print(id,"%-18.17s %-8.7s %-17.16s %-16.15s %-9.8s",lName,lVersion,lAuthor,lFile,lStatus)
for (new i=0;i<num;i++) { for (new i=0;i<num;i++) {
get_plugin(i,filename,31,name,31,version,31,author,31,status,31) get_plugin(i,filename,31,name,31,version,31,author,31,status,31)
console_print(id,"%-18.17s %-8.7s %-17.16s %-16.15s %-9.8s",name,version,author,filename,status) console_print(id,"%-18.17s %-8.7s %-17.16s %-16.15s %-9.8s",name,version,author,filename,status)
@ -442,11 +441,11 @@ public cmdModules(id,level,cid) {
return PLUGIN_HANDLED return PLUGIN_HANDLED
new name[32],version[32],author[32],status,sStatus[16] new name[32],version[32],author[32],status,sStatus[16]
new Lname[32],Lversion[32],Lauthor[32] new lName[32],lVersion[32],lAuthor[32]
format(Lname,31,"%L",id,"NAME") format(lName,31,"%L",id,"NAME")
format(Lversion,31,"%L",id,"VERSION") format(lVersion,31,"%L",id,"VERSION")
format(Lauthor,31,"%L",id,"AUTHOR") format(lAuthor,31,"%L",id,"AUTHOR")
/* /*
new motd_body[MOTD_LEN],state[4] new motd_body[MOTD_LEN],state[4]
@ -467,7 +466,7 @@ public cmdModules(id,level,cid) {
*/ */
new num = get_modulesnum() new num = get_modulesnum()
console_print(id,"%L:",id,"LOADED_MODULES") console_print(id,"%L:",id,"LOADED_MODULES")
console_print(id,"%-23.22s %-8.7s %-20.19s",Lname,Lversion,Lauthor) console_print(id,"%-23.22s %-8.7s %-20.19s",lName,lVersion,lAuthor)
for (new i=0;i<num;i++) { for (new i=0;i<num;i++) {
get_module(i,name,31,author,31,version,31,status) get_module(i,name,31,author,31,version,31,status)
switch (status) { switch (status) {
@ -486,7 +485,7 @@ public cmdCfg(id,level,cid) {
return PLUGIN_HANDLED return PLUGIN_HANDLED
new arg[128] new arg[128]
read_argv(1,arg,127) read_argv(1,arg,127)
if (!file_exists(arg)){ if (!file_exists(arg)) {
console_print(id,"[AMXX] %L",id,"FILE_NOT_FOUND",arg) console_print(id,"[AMXX] %L",id,"FILE_NOT_FOUND",arg)
return PLUGIN_HANDLED return PLUGIN_HANDLED
} }
@ -524,7 +523,7 @@ public cmdPause(id,level,cid) {
get_user_name(id,name,31) get_user_name(id,name,31)
g_pausAble = get_cvar_float("pausable") g_pausAble = get_cvar_float("pausable")
if (!slayer) slayer = find_player("h") if (!slayer) slayer = find_player("h")
if (!slayer){ if (!slayer) {
console_print(id,"[AMXX] %L",id,"UNABLE_PAUSE") console_print(id,"[AMXX] %L",id,"UNABLE_PAUSE")
return PLUGIN_HANDLED return PLUGIN_HANDLED
} }
@ -533,7 +532,7 @@ public cmdPause(id,level,cid) {
log_amx("Cmd: ^"%s<%d><%s><>^" %s server", log_amx("Cmd: ^"%s<%d><%s><>^" %s server",
name,get_user_userid(id),authid, g_Paused ? "unpause" : "pause" ) name,get_user_userid(id),authid, g_Paused ? "unpause" : "pause" )
new pausing[16] new pausing[16]
format(pausing,15,"%L",id,g_Paused ? "unpausing" : "pausing") format(pausing,15,"%L",id,g_Paused ? "UNPAUSING" : "PAUSING")
console_print(id,"[AMXX] %L", id, pausing) console_print(id,"[AMXX] %L", id, pausing)
new activity = get_cvar_num("amx_show_activity") new activity = get_cvar_num("amx_show_activity")
@ -542,7 +541,6 @@ public cmdPause(id,level,cid) {
get_players(players,pnum,"c") get_players(players,pnum,"c")
for (new i=0;i<pnum;i++) { for (new i=0;i<pnum;i++) {
len = format(msg,127,"%L",players[i],"ADMIN") len = format(msg,127,"%L",players[i],"ADMIN")
strtoupper(msg)
if (activity==1) if (activity==1)
len += copy(msg[len],127-len,":") len += copy(msg[len],127-len,":")
else else

View File

@ -78,7 +78,6 @@ public cmdCancelVote(id,level,cid) {
get_players(players,pnum,"c") get_players(players,pnum,"c")
for (new i=0;i<pnum;i++) { for (new i=0;i<pnum;i++) {
format(lTag,15,"%L",players[i],is_user_admin(id) ? "ADMIN" : "PLAYER") format(lTag,15,"%L",players[i],is_user_admin(id) ? "ADMIN" : "PLAYER")
strtoupper(lTag)
switch (activity) { switch (activity) {
case 2: client_print(players[i],print_chat,"%L", LANG_PLAYER, "ADMIN_CANC_VOTE_2", lTag, name) case 2: client_print(players[i],print_chat,"%L", LANG_PLAYER, "ADMIN_CANC_VOTE_2", lTag, name)
case 1: client_print(players[i],print_chat,"%L", LANG_PLAYER, "ADMIN_CANC_VOTE_1", lTag) case 1: client_print(players[i],print_chat,"%L", LANG_PLAYER, "ADMIN_CANC_VOTE_1", lTag)
@ -150,8 +149,6 @@ public checkVotes() {
format(lTheResult,31,"%L",g_voteCaller,"THE_RESULT") format(lTheResult,31,"%L",g_voteCaller,"THE_RESULT")
format(lYes,15,"%L",g_voteCaller,"YES") format(lYes,15,"%L",g_voteCaller,"YES")
format(lNo,15,"%L",g_voteCaller,"NO") format(lNo,15,"%L",g_voteCaller,"NO")
ucfirst(lYes)
ucfirst(lNo)
new len = format(menuBody,511,g_coloredMenus ? "\y%s: \w%s^n^n" : "%s: %s^n^n", lTheResult, g_Execute ) new len = format(menuBody,511,g_coloredMenus ? "\y%s: \w%s^n^n" : "%s: %s^n^n", lTheResult, g_Execute )
len += format( menuBody[len] ,511 - len, g_coloredMenus ? "\y%L^n\w" : "%L^n", g_voteCaller, "WANT_CONTINUE" ) len += format( menuBody[len] ,511 - len, g_coloredMenus ? "\y%L^n\w" : "%L^n", g_voteCaller, "WANT_CONTINUE" )
format( menuBody[len] ,511 - len, "^n1. %s^n2. %s",lYes,lNo) format( menuBody[len] ,511 - len, "^n1. %s^n2. %s",lYes,lNo)
@ -233,8 +230,6 @@ public cmdVoteMap(id,level,cid) {
format(lChangeMap,31,"%L",LANG_SERVER,"CHANGE_MAP_TO") format(lChangeMap,31,"%L",LANG_SERVER,"CHANGE_MAP_TO")
format(lYes,15,"%L",LANG_SERVER,"YES") format(lYes,15,"%L",LANG_SERVER,"YES")
format(lNo,15,"%L",LANG_SERVER,"NO") format(lNo,15,"%L",LANG_SERVER,"NO")
ucfirst(lYes)
ucfirst(lNo)
format(menu_msg,255,g_coloredMenus ? "\y%s %s?\w^n^n1. %s^n2. %s" format(menu_msg,255,g_coloredMenus ? "\y%s %s?\w^n^n1. %s^n2. %s"
: "%s %s?^n^n1. %s^n2. %s",lChangeMap,g_optionName[0],lYes,lNo) : "%s %s?^n^n1. %s^n2. %s",lChangeMap,g_optionName[0],lYes,lNo)
keys = MENU_KEY_1|MENU_KEY_2 keys = MENU_KEY_1|MENU_KEY_2
@ -256,7 +251,6 @@ public cmdVoteMap(id,level,cid) {
get_players(players,pnum,"c") get_players(players,pnum,"c")
for (new i=0;i<pnum;i++) { for (new i=0;i<pnum;i++) {
format(lTag,15,"%L",players[i],is_user_admin(id)?"ADMIN":"PLAYER") format(lTag,15,"%L",players[i],is_user_admin(id)?"ADMIN":"PLAYER")
strtoupper(lTag)
switch (activity) { switch (activity) {
case 2: client_print(players[i],print_chat,"%L", case 2: client_print(players[i],print_chat,"%L",
players[i],"ADMIN_VOTE_MAP_2",lTag,name) players[i],"ADMIN_VOTE_MAP_2",lTag,name)
@ -314,7 +308,6 @@ public cmdVote(id,level,cid) {
get_players(players,pnum,"c") get_players(players,pnum,"c")
for (new i=0;i<pnum;i++) { for (new i=0;i<pnum;i++) {
format(lTag,15,"%L",players[i],is_user_admin(id)?"ADMIN":"PLAYER") format(lTag,15,"%L",players[i],is_user_admin(id)?"ADMIN":"PLAYER")
strtoupper(lTag)
switch (activity) { switch (activity) {
case 2: client_print(players[i],print_chat,"%L","ADMIN_VOTE_CUS_2",lTag,name) case 2: client_print(players[i],print_chat,"%L","ADMIN_VOTE_CUS_2",lTag,name)
case 1: client_print(players[i],print_chat,"%L","ADMIN_VOTE_CUS_1",lTag) case 1: client_print(players[i],print_chat,"%L","ADMIN_VOTE_CUS_1",lTag)
@ -372,8 +365,6 @@ public cmdVoteKickBan(id,level,cid) {
format(lYes,15,"%L",LANG_SERVER,"YES") format(lYes,15,"%L",LANG_SERVER,"YES")
format(lNo,15,"%L",LANG_SERVER,"NO") format(lNo,15,"%L",LANG_SERVER,"NO")
format(lKickBan,15,"%L",LANG_SERVER,voteban?"BAN":"KICK") format(lKickBan,15,"%L",LANG_SERVER,voteban?"BAN":"KICK")
ucfirst(lYes)
ucfirst(lNo)
ucfirst(lKickBan) ucfirst(lKickBan)
get_user_name(player,arg,31) get_user_name(player,arg,31)
format(menu_msg,255,g_coloredMenus ? format(menu_msg,255,g_coloredMenus ?

View File

@ -2,12 +2,11 @@
BACK = Back BACK = Back
EXIT = Exit EXIT = Exit
MORE = More MORE = More
ADMIN = admin NONE = None
ADMINS = admins ADMIN = ADMIN
PLAYER = player PLAYER = PLAYER
PLAYERS = players
ERROR = error ERROR = error
YES = yes YES = Yes
NO = no NO = No
BAN = ban BAN = ban
KICK = kick KICK = kick