广告广告
  加入我的最爱 设为首页 风格修改
首页 首尾
 手机版   订阅   地图  繁体 
您是第 3107 个阅读者
 
发表文章 发表投票 回覆文章
  可列印版   加为IE收藏   收藏主题   上一主题 | 下一主题   
Nailaz 手机
个人头像
个人文章 个人相簿 个人日记 个人地图
特殊贡献奖 社区建设奖 创作大师奖
小有名气
级别: 小有名气 该用户目前不上站
推文 x77 鲜花 x253
分享: 转寄此文章 Facebook Plurk Twitter 复制连结到剪贴簿 转换为繁体 转换为简体 载入图片
推文 x0
[1.6][插件] 读取ini
复制程式
public clcmd_say(id)
{
       read_args (message, 127)
       remove_quotes (message)

       new name[128]
       get_user_name (id, name, 127)

       static szArg1[128], szArg2[128], szArg3[128];
       copy(szArg1, charsmax(szArg1), "")
       copy(szArg2, charsmax(szArg2), "")
       copy(szArg3, charsmax(szArg3), "")

       parse(message, szArg1, charsmax(szArg1), szArg2, charsmax(szArg2), szArg3, charsmax(szArg3))
       if (message[0] == '@' || message[0] == '%' || equal (message, ""))
              return PLUGIN_CONTINUE

       if(register[id])
       {
              new alive[128]

              if (is_user_alive (id))
                     alive = ""
              else
                     alive = "\y*死亡*"
              if(login[id])
              {
                     if (message[0] == '@' || message[0] == '/' || message[0] == '%' || message[0] == '#' || equal (message, ""))                                                      
                            return PLUGIN_CONTINUE

                     client_printc(0, "%s%s:%s",alive, name, message)
              }
              else
              {
                     if(equali( szArg1, "/log") && !(equali( szArg2, "")))
                     {
                            new text[128], len, line = 0
                            while(read_file( g_motdFile, line++, text, 127, len))
                            {
                                   if(如果szArg2 = 密码)
                                          login[id] = true
                                   else
                                          client_printc(id, "\g[密码の讯息: 密码错误,请重新输入]")
                            }
                     }
                     else
                     {
                            client_printc(id, "\g[密码の讯息: 请输入/log <密码> 登入游戏]")
                            return PLUGIN_CONTINUE
                     }
              }
       }
       else
       {
              if(equali( szArg1, "/reg") && !(equali( szArg2, "")))
              {
                     if(file_exists(g_motdFile))
                     {
                            new text[128], len, line = 0
                            while(read_file( g_motdFile, line++, text, 127, len))
                            {
                                   if( containi( szArg2, text) != -1 )
                                   {
                                          client_printc(id, "\g[密码の讯息: 请勿使用此密码]")
                                          return PLUGIN_CONTINUE
                                   }
                            }
                     }
                     if(1 > strlen(szArg2))
                     {
                            client_printc(id, "\g[密码の讯息: 请输入密码]")
                            return PLUGIN_CONTINUE
                     }
                     if(equali(g_c[id], ""))
                     {
                            new Buffer[128]
                            format(Buffer, sizeof Buffer - 1, "^"%s^" ^"%s^"^n", name, szArg2)
                            copy(g_c[id], sizeof g_c - 1, szArg2)
                            new file = fopen(users_db_file, "at+")
                            fprintf(file, Buffer)
                            fclose(file)
                     }
                     else
                     {
                            new Buffer[128], counter
                            new file = fopen(users_db_file, "rt")
                            if(file)
                            {
                                   while(!feof(file))
                                   {
                                          fgets(file, Buffer, 127)
                                          parse(Buffer, Buffer, sizeof Buffer -1)
                                          if(equal(Buffer, name))
                                          {
                                                 format(Buffer, sizeof Buffer - 1, "^"%s^" ^"%s^"", name, szArg2)
                                                 copy(g_c[id], sizeof g_c - 1, szArg2)
                                                 write_file(users_db_file, Buffer, counter)
                                          }
                                          counter++
                                   }
                                   fclose(file)
                            }
                     }
                     client_printc(id, "\g[密码の讯息: 密码以设定为为:%s]", szArg2)
                     register[id] = 1
              }
              else
              {
                     client_printc(id, "\g[密码の讯息: 请输入/reg <密码> 注册密码]")
                     return PLUGIN_CONTINUE
              }
       }
       return PLUGIN_CONTINUE
}

上面是我尝试写了密码系统,注册在say|say_team里触发
/reg pw 注册 | /log pw 登入
储存方面没问题,但是要怎么读取还有
判断if啊..上方的那里 if(如果szArg2 = 密码)
我搞到快疯了..
会的话教下我吧..
谢谢了= =



web front-end and software engineer.
献花 x0 回到顶端 [楼 主] From:台湾中华电信股份有限公司 | Posted:2014-01-26 17:17 |
a543658883
个人文章 个人相簿 个人日记 个人地图
路人甲
级别: 路人甲 该用户目前不上站
推文 x4 鲜花 x3
分享: 转寄此文章 Facebook Plurk Twitter 复制连结到剪贴簿 转换为繁体 转换为简体 载入图片

我在插件区发个SMA挡出来~~


献花 x0 回到顶端 [1 楼] From:未知地址 | Posted:2014-01-26 17:34 |
a7811311622 手机
个人头像
个人文章 个人相簿 个人日记 个人地图
特殊贡献奖 优秀管理员勋章 社区建设奖
头衔:我…在工作了…我…在工作了…
版主
级别: 版主 该用户目前不上站
版区: CS提问区
推文 x771 鲜花 x2152
分享: 转寄此文章 Facebook Plurk Twitter 复制连结到剪贴簿 转换为繁体 转换为简体 载入图片

………
不懂在问什么…
用了这么多 equal 却不知道 if(如果szArg2 = 密码) 要怎么写…?
难道 szArg2 还有夹杂密码以外的文字?


尚无签名,欢迎 [新增个性化签名]
献花 x0 回到顶端 [2 楼] From:台湾中华电信股份有限公司 | Posted:2014-01-26 21:22 |
Nailaz 手机
个人头像
个人文章 个人相簿 个人日记 个人地图
特殊贡献奖 社区建设奖 创作大师奖
小有名气
级别: 小有名气 该用户目前不上站
推文 x77 鲜花 x253
分享: 转寄此文章 Facebook Plurk Twitter 复制连结到剪贴簿 转换为繁体 转换为简体 载入图片

可是我写出来一直有错误无法转档..


web front-end and software engineer.
献花 x0 回到顶端 [3 楼] From:台湾中华电信股份有限公司 | Posted:2014-01-26 21:30 |
a7811311622 手机
个人头像
个人文章 个人相簿 个人日记 个人地图
特殊贡献奖 优秀管理员勋章 社区建设奖
头衔:我…在工作了…我…在工作了…
版主
级别: 版主 该用户目前不上站
版区: CS提问区
推文 x771 鲜花 x2152
分享: 转寄此文章 Facebook Plurk Twitter 复制连结到剪贴簿 转换为繁体 转换为简体 载入图片

下面是引用 Nailaz 于 2014-01-26 21:30 发表的 : 到引言文
可是我写出来一直有错误无法转档..
复制程式
if (equali( szArg2, text ))
不就这样而已…?
不过得先确定 text 有经过文字处理…
别连个密码都用 containi …
安全性根本有和没有一样…


尚无签名,欢迎 [新增个性化签名]
献花 x0 回到顶端 [4 楼] From:台湾中华电信股份有限公司 | Posted:2014-01-26 22:28 |

首页  发表文章 发表投票 回覆文章
Powered by PHPWind v1.3.6
Copyright © 2003-04 PHPWind
Processed in 0.021415 second(s),query:16 Gzip disabled
本站由 瀛睿律师事务所 担任常年法律顾问 | 免责声明 | 本网站已依台湾网站内容分级规定处理 | 连络我们 | 访客留言