changed to str_to_num/num_to_str | fixed get_modules

This commit is contained in:
Felix Geyer 2004-03-08 16:06:11 +00:00
parent 5cb9cb1c05
commit 57747fff55

View File

@ -103,9 +103,15 @@ public cmdKick(id,level,cid){
else else
{ {
#if !defined NO_STEAM #if !defined NO_STEAM
server_cmd("kick #%d ^"%s^"",userid2,reason) if (reason[0])
server_cmd("kick #%d ^"%s^"",userid2,reason)
else
server_cmd("kick #%d",userid2)
#else #else
client_cmd(player,"echo ^"%s^";disconnect",reason) if (reason[0])
client_cmd(player,"echo ^"Kicked: Reason: %s^";disconnect",reason)
else
client_cmd(player,"echo ^"Kicked^";disconnect",reason)
#endif #endif
} }
console_print(id,"Client ^"%s^" kicked",name2) console_print(id,"Client ^"%s^" kicked",name2)
@ -183,7 +189,7 @@ public cmdBan(id,level,cid){
name,get_user_userid(id),authid, name2,userid2,authid2,minutes,reason) name,get_user_userid(id),authid, name2,userid2,authid2,minutes,reason)
new temp[64] new temp[64]
if (str_to_int(minutes)) if (str_to_num(minutes))
format(temp,63,"for %s min.",minutes) format(temp,63,"for %s min.",minutes)
else else
temp = "permanently" temp = "permanently"
@ -192,18 +198,30 @@ public cmdBan(id,level,cid){
new address[32] new address[32]
get_user_ip(player,address,31,1) get_user_ip(player,address,31,1)
#if !defined NO_STEAM #if !defined NO_STEAM
server_cmd("kick #%d ^"%s (banned %s)^";wait;addip ^"%s^" ^"%s^";wait;writeip",userid2,reason,temp,minutes,address) if (reason[0])
server_cmd("kick #%d ^"%s (banned %s)^";wait;addip ^"%s^" ^"%s^";wait;writeip",userid2,reason,temp,minutes,address)
else
server_cmd("kick #%d ^"banned %s^";wait;addip ^"%s^" ^"%s^";wait;writeip",userid2,temp,minutes,address)
#else #else
client_cmd(player,"echo ^"%s (banned %s)^";disconnect",reason,temp) if (reason[0])
client_cmd(player,"echo ^"%s (banned %s)^";disconnect",reason,temp)
else
client_cmd(player,"echo ^"banned %s^";disconnect",temp)
server_cmd("addip ^"%s^" ^"%s^";wait;writeip",minutes,address) server_cmd("addip ^"%s^" ^"%s^";wait;writeip",minutes,address)
#endif #endif
} }
else else
{ {
#if !defined NO_STEAM #if !defined NO_STEAM
server_cmd("kick #%d ^"%s (banned %s)^";wait;banid ^"%s^" ^"%s^";wait;writeid",userid2,reason,temp,minutes,authid2) if (reason[0])
server_cmd("kick #%d ^"%s (banned %s)^";wait;banid ^"%s^" ^"%s^";wait;writeid",userid2,reason,temp,minutes,authid2)
else
server_cmd("kick #%d ^"banned %s^";wait;banid ^"%s^" ^"%s^";wait;writeid",userid2,temp,minutes,authid2)
#else #else
client_cmd(player,"echo ^"%s (banned %s)^";disconnect",reason,temp) if (reason[0])
client_cmd(player,"echo ^"%s (banned %s)^";disconnect",reason,temp)
else
client_cmd(player,"echo ^"banned %s^";disconnect",temp)
server_cmd("banid ^"%s^" ^"%s^";wait;writeip",minutes,authid2) server_cmd("banid ^"%s^" ^"%s^";wait;writeip",minutes,authid2)
#endif #endif
} }
@ -256,7 +274,7 @@ public cmdSlap(id,level,cid){
if (!player) return PLUGIN_HANDLED if (!player) return PLUGIN_HANDLED
new spower[32],authid[32],name2[32],authid2[32],name[32] new spower[32],authid[32],name2[32],authid2[32],name[32]
read_argv(2,spower,31) read_argv(2,spower,31)
new damage = str_to_int(spower) new damage = str_to_num(spower)
user_slap(player,damage) user_slap(player,damage)
get_user_authid(id,authid,31) get_user_authid(id,authid,31)
get_user_name(id,name,31) get_user_name(id,name,31)
@ -368,8 +386,9 @@ public cmdPlugins(id,level,cid)
return PLUGIN_HANDLED return PLUGIN_HANDLED
#if !defined NO_STEAM #if !defined NO_STEAM
#define MOTD_LEN 1024 #define MOTD_LEN 2048
new motd_body[MOTD_LEN],state[4] new motd_body[MOTD_LEN],state[4]
new name[32],version[32],author[32],filename[32],status[32]
new num = get_pluginsnum() new num = get_pluginsnum()
new running = 0 new running = 0
new pos = copy(motd_body,MOTD_LEN,"<html><head><body><style type=^"text/css^">") new pos = copy(motd_body,MOTD_LEN,"<html><head><body><style type=^"text/css^">")
@ -380,7 +399,6 @@ public cmdPlugins(id,level,cid)
{ {
if (equal(state,"one")) copy(state,3,"two") if (equal(state,"one")) copy(state,3,"two")
else copy(state,3,"one") else copy(state,3,"one")
new name[32],version[32],author[32],filename[32],status[32]
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)
pos += format(motd_body[pos],MOTD_LEN-pos,"<tr class=^"%s^"><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td></tr>",state,name,version,author,filename,status) pos += format(motd_body[pos],MOTD_LEN-pos,"<tr class=^"%s^"><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td></tr>",state,name,version,author,filename,status)
if (equal(status,"running")) if (equal(status,"running"))
@ -395,7 +413,6 @@ public cmdPlugins(id,level,cid)
console_print(id,"%-18.17s %-8.7s %-17.16s %-16.15s %-9.8s","name","version","author","file","status") console_print(id,"%-18.17s %-8.7s %-17.16s %-16.15s %-9.8s","name","version","author","file","status")
for (new i=0;i<num;i++) for (new i=0;i<num;i++)
{ {
new name[32],version[32],author[32],filename[32],status[32]
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("%-18.17s %-8.7s %-17.16s %-16.15s %-9.8s",name,version,author,filename,status) console_print("%-18.17s %-8.7s %-17.16s %-16.15s %-9.8s",name,version,author,filename,status)
if (equal(status,"running")) if (equal(status,"running"))
@ -414,11 +431,12 @@ public cmdModules(id,level,cid)
#if !defined NO_STEAM #if !defined NO_STEAM
#if !defined MOTD_LEN #if !defined MOTD_LEN
#define MOTD_LEN 1024 #define MOTD_LEN 2048
#endif #endif
new motd_body[MOTD_LEN],state[4] new motd_body[MOTD_LEN],state[4]
new num = get_modulesnum() new num = get_modulesnum()
new pos = copy(motd_body,MOTD_LEN,"<html><head><body><style type=^"text/css^">") new pos = copy(motd_body,MOTD_LEN,"<html><head><body><style type=^"text/css^">")
new name[32],version[32],author[32]
pos += copy(motd_body[pos],MOTD_LEN-pos,"body{font-family:Arial,sans-serif;font-size:12px;color:#FFCC99;background-color:#000000;margin-left:8px;margin-top:3px}.header{background-color:#9C0000;}.one{background-color:#310000;}.two{background-color:#630000;}") pos += copy(motd_body[pos],MOTD_LEN-pos,"body{font-family:Arial,sans-serif;font-size:12px;color:#FFCC99;background-color:#000000;margin-left:8px;margin-top:3px}.header{background-color:#9C0000;}.one{background-color:#310000;}.two{background-color:#630000;}")
pos += copy(motd_body[pos],MOTD_LEN-pos,"</style></head><body><table><tr class=^"header^"><td>Name</td><td>Version</td><td>Author</td></tr>") pos += copy(motd_body[pos],MOTD_LEN-pos,"</style></head><body><table><tr class=^"header^"><td>Name</td><td>Version</td><td>Author</td></tr>")
@ -426,8 +444,7 @@ public cmdModules(id,level,cid)
{ {
if (equal(state,"one")) copy(state,3,"two") if (equal(state,"one")) copy(state,3,"two")
else copy(state,3,"one") else copy(state,3,"one")
new name[32],version[32],author[32],filename[32],status[32] get_module(i,name,31,author,31,version,31)
get_plugin(i,filename,31,name,31,version,31,author,31,status,31)
pos += format(motd_body[pos],MOTD_LEN-pos,"<tr class=^"%s^"><td>%s</td><td>%s</td><td>%s</td></tr>",state,name,version,author) pos += format(motd_body[pos],MOTD_LEN-pos,"<tr class=^"%s^"><td>%s</td><td>%s</td><td>%s</td></tr>",state,name,version,author)
} }
format(motd_body[pos],MOTD_LEN-pos,"</table>%d modules</body></html>",num) format(motd_body[pos],MOTD_LEN-pos,"</table>%d modules</body></html>",num)
@ -438,7 +455,6 @@ public cmdModules(id,level,cid)
console_print(id,"%-23.22s %-8.7s %-20.19s","name","version","author") console_print(id,"%-23.22s %-8.7s %-20.19s","name","version","author")
for (new i=0;i<num;i++) for (new i=0;i<num;i++)
{ {
new name[32],version[32],author[32]
get_module(i,name,31,author,31,version,31) get_module(i,name,31,author,31,version,31)
console_print("%-23.22s %-8.7s %-20.19s",name,version,author) console_print("%-23.22s %-8.7s %-20.19s",name,version,author)
} }