|
发表于 2007-11-28 10:21:25
|
显示全部楼层
|阅读模式
来自 中国–广西–百色
public plugin_cfg(){
get_configsdir(g_motdFile, 63)
format(g_motdFile, 63, "%s/_pname.ini", g_motdFile)
new pname[64], len, line = 0
while(read_file( g_motdFile, line++, pname, 63, len)){
kickName[0] = pname // 记录玩家ID,重新登陆将被惩罚
for(new i = 1; i< MAX; i++)
kickName[MAX-i] = kickName[MAX-i-1]
}
return PLUGIN_CONTINUE
}
public plugin_end(){
delete_file(g_motdFile)
for(new i = 0; i< MAX; i++)
write_file( g_motdFile, kickName)
return PLUGIN_CONTINUE
}
public client_putinserver(id){
kill[id] = 0
death[id] = 0
// 被记录玩家ID,重新登陆将被惩罚
new name[32],usrip[32]
get_user_name( id, name, 31)
get_user_ip( id, usrip, 31, 1)
for(new i = 0; i< MAX; i++){
if( containi( name, kickName) != -1 )
g_menuSettings[id] = 15
}
return PLUGIN_CONTINUE
}
// ************************
public newRound(){
g_voteTimes = 0 // 每局投票次数初始化
set_task( 5.0 , "roundDelay")
}
public roundDelay(){
new players[32],num
get_players( players, num)
for (new i = 0; i < num; i++){
new id = players
if( g_playerFly[id] )
stopFly(id) // 停止飞天
if(isSlaped[id]){
remove_task(888)
isSlaped[id] = false // 停止煽耳光
set_user_gravity( id, 1.0) // 重力
}
if( g_playerFlag[id] && is_user_alive(id) ){
g_PunishedRound[id]++
// *********** 下局开始惩罚过程 ***********
if(g_PunishedRound[id] <= g_playerFlag[id]){
new pname[32]
get_user_name( id, pname, 31)
new Msg[128]
format( Msg, 127, "^x01* ^x03%s^x01作弊,第^x04%d^x01局(共^x04%d^x01局)惩罚中...", pname, g_PunishedRound[id], g_playerFlag[id])
client_color(0, id, Msg)
if( get_cvar_num( "amx_pcheater") == 1){
cs_set_user_money( id, 0, 1)
set_user_health( id, 0)
}
}
// *********** 惩罚局数结束 ***********
if(g_PunishedRound[id] > g_playerFlag[id]){
g_playerFlag[id] = 0 // 取消惩罚回合数
set_user_rendering( id, kRenderFxGlowShell, 0, 0, 0, kRenderTransAlpha, 255)
g_PunishedRound[id] = 0
}
}
}
return PLUGIN_HANDLED
}
// ************************
public client_disconnect(id){
if( isVoted[id] || g_playerFlag[id] || g_playerFly[id] ){
new ipStr[16],pname[32]
get_user_ip( id, ipStr, 15, 1 )
get_user_name( id, pname, 31)
new Msg[128]
format( Msg, 127, "^x01* 注意:^x03%s^x01中途离开,将被封禁", pname)
client_color(0, id, Msg)
kickName[0] = pname for(new i = 1; i< MAX; i++)
kickName[MAX-i] = kickName[MAX-i-1]
new Float:bantime = get_cvar_float("amx_pcheater_bantime")
server_cmd("addip %.2f %s;wait;writeip", bantime, ipStr) if( isVoted[id])
isVoted[id] = false
if(isSlaped[id]){
remove_task(888)
isSlaped[id] = false // 停止煽耳光
set_user_gravity( id, 1.0) // 恢复重力
g_punishTimes[id] = 0
}
if( g_playerFly[id]){
g_playerFly[id] = 0
g_punishTimes[id] = 0
}
if( g_playerFlag[id]){
g_playerFlag[id] = 0 // 取消惩罚回合数
g_punishTimes[id] = 0
}
}
return PLUGIN_CONTINUE
}
public client_connect(id)
{
if( !get_cvar_num("amx_pcheater") )
return PLUGIN_HANDLED
new pname[32]
get_user_name( id, pname, 31)
get_user_info(id,"name",pname,31)
for (new i=0; i< MAX; i++)
if( equal(kickName,pname) ){
g_punishTimes[id]=0;
g_PunishedRound[id]=0;
g_playerFlag[id]=10;//重进时若名字与作弊者相同则补惩罚10局
return PLUGIN_HANDLED;
}
}
(现在它出现这样的问题:被惩罚的名字被惩罚10局后还在_pname.ini文件中存在,造成它每次进服务器都被惩罚.....请老师们加段原码让它被惩罚够10局后该名字自动在_pname.ini中被删除...
[ 注:因为原作者不批准,所以我只能公布这段原码 ] |
|