- 听众
- 收听
- 积分
- 90
- 主题
- 回帖
- 0
- 精华
注册时间2008-11-24
最后登录1970-1-1
该用户从未签到
|
楼主 |
发表于 2008-11-27 13:55:48
|
显示全部楼层
Simen.newbie终于把你盼来了!
我也不知是哪个版本,nameu.sma里写的是:#define VERSION "0.12"。
我把nameu.sma里的FM_ClientUserInfoChanged, "fwdClientUserInfoChanged", 0改成FM_ClientUserInfoChanged, "fwdClientUserInfoChanged", 1后,我的名字变成一串数字,如012345,按tab显示正常;此时不与"显示在线OPVIP"和"前五名杀敌奖励"冲突,但是换下一张地图过1分钟后卡住然后自动退出。
如果我不做任何修改,玩1分钟左右卡住然后自动退出。
请看这两个插件的源代码:
1前五名杀敌奖励:/*
* AMXMOD script.
* (plugin_bonus1.sma)
* by DreamZSW <DreamZSW@hotmail.com>
* This file is provided as is (no warranties).
*
*/
#include <amxmod>
#define MAX_NAME_LENGTH 32
#define MAX_TEXT_LENGTH 512
#define ACCESS_LEVEL ADMIN_LEVEL_A
// Default on/off
new gBonusMode = 1
new gBonusCount = 0
new gBonusIndex[5] = { 2000,1500,1000,800,500 }
public admin_bonuskill(id)
{
// Check access level
if (!(get_user_flags(id)&ACCESS_LEVEL)) {
console_print(id,"[AMX] You have no access to that command")
return PLUGIN_HANDLED
}
// Check arguments
if (read_argc() < 2) {
console_print(id,"[AMX] Usage: amx_bonuskill < 1 | 0 >")
return PLUGIN_HANDLED
}
new sArg1[MAX_NAME_LENGTH]
read_argv(1,sArg1,MAX_NAME_LENGTH)
if (str_to_num(sArg1)) {
gBonusMode = 1
client_print(id,print_console,"[AMX] Bonus money for kills is now ON.")
}
else {
gBonusMode = 0
client_print(id,print_console,"[AMX] Bonus money for kills is now OFF.")
}
return PLUGIN_HANDLED
}
public event_death()
{
if (gBonusMode) {
new iKiller = read_data(1)
new iVictim = read_data(2)
new sMsg[MAX_TEXT_LENGTH]
new sName[MAX_NAME_LENGTH]
get_user_name(iKiller,sName,MAX_NAME_LENGTH)
if ((iKiller != iVictim) && (gBonusCount < sizeof gBonusIndex) && (get_user_team(iKiller) != get_user_team(iVictim))) {
gBonusCount++
set_user_money(iKiller,get_user_money(iKiller)+gBonusIndex[gBonusCount-1])
if (gBonusCount == 1) {
format(sMsg,MAX_TEXT_LENGTH,"【飞鹰奖励】%s 第一个杀敌奖励$%i",sName,gBonusIndex[gBonusCount-1])
client_cmd(0, "spk misc/coin01")
set_hudmessage(random_num(255,255), random_num(255,255), random_num(0,0), 0, 0.27, 0, 6.0, 6.0, 0.5, 0.15, 1)
}
else if (gBonusCount == 2) {
format(sMsg,MAX_TEXT_LENGTH,"【飞鹰奖励】%s 第二个杀敌奖励$%i",sName,gBonusIndex[gBonusCount-1])
client_cmd(0, "spk misc/coin01")
set_hudmessage(random_num(218,218), random_num(178,178), random_num(115,115), 0, 0.27, 0, 6.0, 6.0, 0.5, 0.15, 1)
}
else if (gBonusCount == 3) {
format(sMsg,MAX_TEXT_LENGTH,"【飞鹰奖励】%s 第三个杀敌奖励$%i",sName,gBonusIndex[gBonusCount-1])
client_cmd(0, "spk misc/coin01")
set_hudmessage(random_num(255,255), random_num(0,0), random_num(255,255), 0, 0.27, 0, 6.0, 6.0, 0.5, 0.15, 1)
}
else if (gBonusCount == 4) {
format(sMsg,MAX_TEXT_LENGTH,"【飞鹰奖励】%s 第四个杀敌奖励$%i",sName,gBonusIndex[gBonusCount-1])
client_cmd(0, "spk misc/coin01")
set_hudmessage(random_num(0,0), random_num(255,255), random_num(0,0), 0, 0.27, 0, 6.0, 6.0, 0.5, 0.15, 1)
}
else {
format(sMsg,MAX_TEXT_LENGTH,"【飞鹰奖励】%s 第%i个杀敌奖励$%i",sName,gBonusCount,gBonusIndex[gBonusCount-1])
client_cmd(0, "spk misc/coin01")
set_hudmessage(random_num(255,255), random_num(0,0), random_num(0,0), 0, 0.27, 0, 4.0, 4.0, 0.5, 0.15, 1)
}
show_hudmessage(0,sMsg)
}
}
return PLUGIN_CONTINUE
}
public event_round_end() {
gBonusCount = 0
}
public plugin_precache(){
precache_sound( "misc/coin01.wav")
return PLUGIN_CONTINUE
}
/************************************************************
* PLUGIN FUNCTIONS
************************************************************/
public plugin_init()
{
register_plugin("Plugin Money Bonus","1.0","DreamZSW")
register_event("DeathMsg","event_death","a")
register_event("SendAudio","event_round_end","a","2&%!MRAD_terwin","2&%!MRAD_ctwin","2&%!MRAD_rounddraw")
register_concmd("amx_bonuskill","admin_bonuskill",ACCESS_LEVEL,"amx_powers < authid | part of nick >")
}
2显示在线OPVIP:/* AMX Mod
* Info. Messages Plugin
*
* by the AMX Mod Development Team
* originally developed by OLO
*
* This file is part of AMX Mod.
*
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, the author gives permission to
* link the code of this program with the Half-Life Game Engine ("HL
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
* L.L.C ("Valve"). You must obey the GNU General Public License in all
* respects for all of the code used other than the HL Engine and MODs
* from Valve. If you modify this file, you may extend this exception
* to your version of the file, but you are not obligated to do so. If
* you do not wish to do so, delete this exception statement from your
* version.
*/
#include <amxmod>
#include <amxmisc>
#define MAX_MESSAGES 32
#define X_POS -1.0
#define Y_POS 0.30
#define HOLD_TIME 12.0
new g_Values[MAX_MESSAGES][3]
new g_Messages[MAX_MESSAGES][384]
new g_MessagesNum,g_subMsgNum
new g_Current,g_subCurrent
public plugin_init() {
register_plugin("Info. Messages","0.9","default")
register_srvcmd("amx_admin","setMessage")
register_cvar("amx_freq_admin","10")
new lastinfo[8]
get_localinfo("lastinfomsg",lastinfo,7)
g_Current = str_to_num(lastinfo)
g_subCurrent = 0
g_subMsgNum=2
set_localinfo("lastinfomsg","")
}
public infoMessage() {
if(g_Current==0) g_subCurrent=0
if (g_Current >= g_MessagesNum)
{
g_subCurrent++;
if(g_subCurrent>=g_subMsgNum){
g_Current = 0
}
//在这里我们增加一个现实在线OP的模块
new opmsg[512],playerslist[32],playerscount,i,pos,opcount
get_players(playerslist,playerscount,"c")//Skip Bot
opcount=0;
if(g_subCurrent==1){
opmsg="当前在线管理员^n"
pos=strlen(opmsg)
for(i=0;i<playerscount;i++){
if(access(playerslist,ADMIN_IMMUNITY)){
new username[33]
get_user_name(playerslist,username,32)
opcount++
pos+=format(opmsg[pos],511-pos,"%s^n",username)
}
}
if(opcount==0) opmsg="Non---Admin"
}
if(g_subCurrent==2){
opmsg="当前在线VIP^n"
pos=strlen(opmsg)
for(i=0;i<playerscount;i++){
if(access(playerslist,ADMIN_RESERVATION)&&(!access(playerslist,ADMIN_IMMUNITY))){
new username[33]
get_user_name(playerslist,username,32)
opcount++
pos+=format(opmsg[pos],511-pos,"%s^n",username)
}
}
if(opcount==0) {
opmsg="Non---VIP"//We Do not display NO VIP
set_task(0.1,"infoMessage",12345)
return
}
}
set_hudmessage(255,105,180,-1.0,0.20,2,0.5,HOLD_TIME,0.080,2.0,3)
show_hudmessage(0,opmsg)
new Float:freq_im = get_cvar_float("amx_freq_admin")
if ( freq_im > 0.0 ) set_task( freq_im ,"infoMessage",12345)
}
else {
set_hudmessage(g_Values[g_Current][0], g_Values[g_Current][1], g_Values[g_Current][2],
X_POS, Y_POS, 2, 0.5, HOLD_TIME , 0.080, 2.0, 3)
show_hudmessage(0,g_Messages[g_Current])
client_print(0,print_console,g_Messages[g_Current])
++g_Current
new Float:freq_im = get_cvar_float("amx_freq_admin")
if ( freq_im > 0.0 ) set_task( freq_im ,"infoMessage",12345)
}
}
public setMessage() {
if (g_MessagesNum >= MAX_MESSAGES) {
return PLUGIN_HANDLED
}
remove_task(12345)
read_argv(1,g_Messages[g_MessagesNum],380)
new hostname[64]
get_cvar_string("hostname",hostname,63)
replace(g_Messages[g_MessagesNum],380,"%hostname%",hostname)
while(replace(g_Messages[g_MessagesNum],380,"\n","^n")){}
new mycol[12]
read_argv(2,mycol,11) // RRRGGGBBB
g_Values[g_MessagesNum][2] = str_to_num(mycol[6])
mycol[6] = 0
mycol[3] = 0
g_Values[g_MessagesNum][0] = str_to_num(mycol[0])
g_MessagesNum++
new Float:freq_im = get_cvar_float("amx_freq_admin")
if ( freq_im > 0.0 ) set_task( freq_im ,"infoMessage",12345)
return PLUGIN_HANDLED
}
public plugin_end() {
new lastinfo[8]
num_to_str(g_Current,lastinfo,7)
set_localinfo("lastinfomsg",lastinfo)
}
[ 本帖最后由 小健健 于 2008-11-30 12:40 编辑 ] |
|