搜索
查看: 3283|回复: 11

帮忙修改一下

[复制链接]
发表于 2008-5-4 01:17:38 | 显示全部楼层 |阅读模式 来自 台湾
public client_putinserver(id)
{
new Name[32]
get_user_name(id,Name,31)
if(get_user_flags(id)&ADMIN_IMMUNITY)
{
client_print(0,print_chat,"[OP]%s来了",Name)
}else if(get_user_flags(id)&ADMIN_RESERVATION){
client_print(0,print_chat,"[VIP]%s来了",Name)
}
}


=============================

谁能帮我修改 玩家进来的时候 名字是蓝色字体?

如圖...

发表于 2008-5-4 02:54:55 | 显示全部楼层 来自 广东惠州

回复: 帮忙修改一下

[php]
public client_putinserver(id)
{
set_task(6.0,"show_client",id)
}
public client_color(playerid, colorid, msg[])
{
message_begin(playerid?MSG_ONE:MSG_ALL,get_user_msgid("SayText"),_,playerid)
write_byte(colorid)
write_string(msg)
message_end()
}
public show_client(id)
{
new Name[32],SayMsg[64]
get_user_name(id,Name,31)
if(get_user_flags(id)&ADMIN_IMMUNITY)
{
  formatex(SayMsg,63,"^x04[OP]^x03%s^x01来了",Name)
}else if(get_user_flags(id)&ADMIN_RESERVATION){
  formatex(SayMsg,63,"^x04[VIP]^x03%s^x01来了",Name)
}
client_color(0,id,SayMsg)
}
[/php]
回复

使用道具 举报

 楼主| 发表于 2008-5-4 04:31:51 | 显示全部楼层 来自 台湾

回复: 帮忙修改一下

提供一下原码

#include <amxmodx>
#include <amxmisc>

#define PLUGIN_NAME        "New Plug-In"
#define PLUGIN_VERSION        "1.0"
#define PLUGIN_AUTHOR        "admin"

public plugin_init()
{
        register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR);        
}

public client_putinserver(id)
{
        new Name[32]
        get_user_name(id,Name,31)
        if(get_user_flags(id)&ADMIN_IMMUNITY)
        {
                client_print(0,print_chat,"[OP]%s来了",Name)
        }else if(get_user_flags(id)&ADMIN_RESERVATION){
                client_print(0,print_chat,"[VIP]%s来了",Name)
        }
}


可以再请这位大哥帮我修改一下
因为按照我图片上的服务器 好像可以判断 玩家选择队伍按下后才会显示 xxx 来了
并且可以判断玩家加入的是CT或者是TS 例如加入CT的玩家是蓝色字体 加入TS的是红色字体
不晓得这样有办法吗?
回复

使用道具 举报

 楼主| 发表于 2008-5-4 14:20:19 | 显示全部楼层 来自 台湾

回复: 帮忙修改一下

测试成功 很满意 谢谢
回复

使用道具 举报

 楼主| 发表于 2008-5-4 15:24:37 | 显示全部楼层 来自 台湾

回复: 帮忙修改一下

不过刚刚有发现一个问题 不知道有谁能帮解决一下

就是当我自定义

formatex(SayMsg,63,"^x04[VIP]^x03%s^x01来了",Name)

"来了"的后面如果加上太多文字 当名字过长 会将后面文字吃掉

不知道有没有办法可以解决?
回复

使用道具 举报

发表于 2008-5-4 15:27:08 | 显示全部楼层 来自 香港

回复: 帮忙修改一下

Post by 6016
不过刚刚有发现一个问题 不知道有谁能帮解决一下

就是当我自定义

formatex(SayMsg,512,"^x04[VIP]^x03%s^x01来了",Name)
回复

使用道具 举报

发表于 2008-5-4 15:30:47 | 显示全部楼层 来自 广东惠州

回复: 帮忙修改一下

SayMsg[64]
改为SayMsg[128]


formatex(SayMsg,63
改成
formatex(SayMsg,127
回复

使用道具 举报

 楼主| 发表于 2008-5-4 15:35:25 | 显示全部楼层 来自 台湾

回复: 帮忙修改一下

感谢楼上两位大哥帮小弟解答
回复

使用道具 举报

发表于 2008-5-4 17:25:47 | 显示全部楼层 来自 浙江温州

回复: 帮忙修改一下

要记得使用帖子里的感谢贴.
回复

使用道具 举报

发表于 2008-5-5 15:41:48 | 显示全部楼层 来自 广东深圳

回复: 帮忙修改一下

Post by zwfgdlc
[php]
public client_putinserver(id)
{
set_task(6.0,"show_client",id)
}
public client_color(playerid, colorid, msg[])
{
message_begin(playerid?MSG_ONE:MSG_ALL,get_user_msgid("SayText"),_,playerid)
write_byte(colorid)
write_string(msg)
message_end()
}
public show_client(id)
...

第一次看到formatex(),没怎么看明白copy back。。。。

formatex

[ Main ] [ Core ] [ string.inc ]
[ comments ]

formatex - Same as format(), except does not perform a "copy back" check.

Syntax:

     formatex ( output[] ,len ,const format[] , {Float,Sql,Result,_}:... )
Type:

    Native
Notes:

Same as format(), except does not perform a "copy back" check.
This means formatex() is faster, but DOES NOT ALLOW this type of call:
formatex(buffer, len, "%s", buffer)
formatex(buffer, len, buffer, buffer)
formatex(buffer, len, "%s", buffer[5])
This is because the output is directly stored into "buffer", rather than copied back at the end.
回复

使用道具 举报

游客
回复
您需要登录后才可以回帖 登录 | 注个册吧

快速回复 返回顶部 返回列表