积分插件免费版 【设置精华自动送积分】的方法 功能增强

兔兔 2月前 337

本例是一个教程,希望能够帮助大家更好地理解Xiuno中的插件hook机制。原文地址:https://www.6rabbit.com/thread-62.htm

一、在/plugin/tt_credits/hook/下新建两个空白文件:thread_digest_change_start.phpthread_digest_change_end.php

二、在thread_digest_change_end.php中,输入以下代码

if($digest!=0) $update_array = array('credits+'=>$credits_set['digest'.$digest.'_exp'] - $before_credits['credits'] ,'golds+'=>$credits_set['digest'.$digest.'_gold']- $before_credits['golds'] ,'rmbs+'=>$credits_set['digest'.$digest.'_rmb'] - $before_credits['rmbs']);
else $update_array = array('credits+'=>0 - $before_credits['credits'] ,'golds+'=>0 - $before_credits['golds'] ,'rmbs+'=>0 - $before_credits['rmbs']);
user_update($uid,$update_array);

三、在thread_digest_change_start.php输入以下代码

$credits_set = array('digest1_rmb'=>'1','digest2_rmb'=>'2','digest3_rmb'=>'3','digest1_gold'=>'1','digest2_gold'=>'2','digest3_gold'=>'3','digest1_exp'=>'1','digest2_exp'=>'2','digest3_exp'=>'3');
$before_digest = $arr['digest']; 
if($before_digest==0) $before_credits = array('credits'=>0,'golds'=>0,'rmbs'=>0 );
else $before_credits = array('credits'=>$credits_set['digest'.$before_digest.'_exp'] ,'golds'=>$credits_set['digest'.$before_digest.'_gold'] ,'rmbs'=>$credits_set['digest'.$before_digest.'_rmb'] );

其中,请您在第一行,按照您的想法进行替换。(rmb单位是分,不要写特殊字符)例如:digest1_gold表示精华1、金币基准奖励。

四、保存,清理缓存即可

最新回复 (0)
返回
发新帖