|
楼主 |
发表于 2009-7-22 19:04:26
|
显示全部楼层
来自 中国–广西–百色
本帖最后由 心静如水 于 2009-7-22 19:08 编辑
new filePath[64]
get_configsdir(filePath, 63)
format(filePath, 63, "%s/CSCP.dat", filePath)
copy(fileName,63,filePath)
loadFile(filePath)
public client_connect(id){
new pname[32],msg[128]
get_user_name(id,pname,31)
for (new i=0; i<MAX_RECORD_PLAYER; i++){
if( equal(g_recordName,pname) ){
format(msg,127,"新进服的玩家 %s 曾经作弊,立刻封禁他IP.",pname);
set_hudmessage(colR, colG, colB, 0.5, 0.8, 0, 0.02, 5.0, 0.01, 0.2, 2)
show_hudmessage(0 , msg)
new ipStr[16]
get_user_ip(id, ipStr, 15, 1 )
server_cmd("addip %.2f %s;wait;writeip", 60.0, ipStr);
return PLUGIN_HANDLED;
}
}
g_playerFlag[id]=0;
return PLUGIN_HANDLED;
}
public client_disconnect(id){
if( g_playerFlag[id] && !is_user_bot(id) ){
new ipStr[16],Msg[128],pname[32];
get_user_ip(id, ipStr, 15, 1 )
get_user_name(id,pname,31);
if( WriteToFile(ipStr,pname ) ){
//copy(g_recordIp[g_recordNum],15,ipStr);
copy(g_recordName[g_recordNum++],32,pname);
format(Msg,127,"[OP]: 作弊的玩家已被记录姓名.");
set_hudmessage(colR, colG, colB, 0.5, 0.8, 0, 0.02, 5.0, 0.01, 0.2, 2)
show_hudmessage(0 , Msg)
}
server_cmd("addip %.2f %s;wait;writeip", 60.0, ipStr);
}
}
loadFile(filename[]){
new fp
if( !file_exists(filename) ){
fp=fopen(filename,"w")
fclose(fp)
return 0
}
new text[256],pos=0,a,lineStr[3];
while( g_recordNum < MAX_RECORD_PLAYER && read_file(filename,pos++,text,255,a) ){
if(text[0]==';')
continue
if( parse(text,lineStr,2,g_recordName[g_recordNum],31,g_recordIp[g_recordNum],15)==3 )
g_recordNum++;
}
return 1
}
WriteToFile(ipStr[],nameStr[]){
if( g_recordNum>MAX_RECORD_PLAYER*0.9 )
client_print(0,print_console,"** you have writed %i lines(MAX %i). You should clear it.",g_recordNum,MAX_RECORD_PLAYER)
if( g_recordNum==MAX_RECORD_PLAYER-1 ){
client_print(0,print_console,"** Sorry, can't write to file. you have writed %i lines(MAX %i). You must clear it.",g_recordNum,MAX_RECORD_PLAYER)
return 0;
}
new str[64];
format(str,63,"%i ^"%s^" %s",g_recordNum+1,nameStr,ipStr);
write_file(fileName,str,-1);
g_recordNum++;
return 1;
}
public client_infochanged(id){
if( g_playerFlag[id] ){
new nname[32],pname[32]
get_user_info(id, "name", nname,31)
get_user_name(id,pname,31)
if( !equal(nname,pname) ){
client_print(id,print_chat,"****** 对不起,你不能改名 ! ******")
set_user_info(id,"name",pname);
}
}
}
.. |
|