搜索
查看: 3496|回复: 7

求警察买AK 土匪买M4的插件

[复制链接]
发表于 2009-5-30 17:16:26 | 显示全部楼层 |阅读模式 来自 河南周口
如题: 论坛小白发的那个 不在购买区域也可以购买,而且不守购买时间限制,谁发个修改过的 带不带源码都可以
发表于 2009-5-31 13:19:15 | 显示全部楼层 来自 广东深圳
/* 本插件由 AMXX-Studio 中文版自动生成*/
/* UTF-8 func by www.DT-Club.net */

#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fun>


new bool:buyswitch
new iSayTextMsgID
new message[128]

public plugin_init() {
        register_plugin("buy m4&ak","2.3","93")
        register_clcmd("say /m4","M4")
        register_clcmd("say /ak","AK")
        register_cvar("m4cost","3100")
        register_cvar("akcost","2500")
        iSayTextMsgID=get_user_msgid("SayText")
        register_logevent("round_start",2,"0=World triggered","1=Round_Start")
        //1.5就用这句
        //register_event("ResetHUD", "eResetHUD", "be")
        //1.6就用这句
        register_event("HLTV","eResetHUD","a","a=0","2=0")
}

public M4(id) {
        new m4cost = get_cvar_num("m4cost")
        new money = cs_get_user_money(id)
        if(!is_user_alive(id)) {
                format(message, 127, "^x04【爱生活_爱美丽】^x03你都已经死了,买枪干吗?")
                color_saytext(message, MSG_ONE, id, 3)
                return PLUGIN_CONTINUE
        }
        if(money < m4cost) {
                format(message, 127, "^x04【爱生活_爱美丽】^x03你有钱买吗?")
                color_saytext(message, MSG_ONE, id, 3)
                return PLUGIN_CONTINUE                
        }
        if (cs_get_user_hasprim(id)){     //增加行
                format(message, 127, "^x04【爱生活_爱美丽】^x03你想做双枪老太婆吗?^n")
                color_saytext(message, MSG_ONE, id, 3)
                return PLUGIN_CONTINUE                
        }
        if(!cs_get_user_buyzone(id)){
                format(message, 127, "^x04【爱生活_爱美丽】^x03只能在购买区购买武器!")
                color_saytext(message, MSG_ONE, id, 3)
                return PLUGIN_CONTINUE
        }
        if(!buyswitch){
                format(message, 127, "^x04【爱生活_爱美丽】^x03购买武器时间已过!")
                color_saytext(message, MSG_ONE, id, 3)
                return PLUGIN_CONTINUE
        }
        else {
                cs_set_user_money(id,money-m4cost)
                give_item(id, "weapon_m4a1")
                cs_set_user_bpammo(id,CSW_M4A1,90)
        }
        return PLUGIN_CONTINUE
}
public AK(id) {
        new akcost = get_cvar_num("akcost")
        new moneyy = cs_get_user_money(id)
        if(!is_user_alive(id)) {
                format(message, 127, "^x04【爱生活_爱美丽】^x03你都已经死了,买枪干吗?")
                color_saytext(message, MSG_ONE, id, 3)
                return PLUGIN_CONTINUE                
        }
        if(moneyy < akcost) {
                format(message, 127, "^x04【爱生活_爱美丽】^x03你有钱买吗?")
                color_saytext(message, MSG_ONE, id, 3)
                return PLUGIN_CONTINUE                
        }
        if (cs_get_user_hasprim(id)) {  //增加行
                format(message, 127, "^x04【爱生活_爱美丽】^x03你想做双枪老太婆吗?^n")
                color_saytext(message, MSG_ONE, id, 3)
                return PLUGIN_CONTINUE                
        }       
        if(!cs_get_user_buyzone(id)){
                format(message, 127, "^x04【爱生活_爱美丽】^x03只能在购买区购买武器!")
                color_saytext(message, MSG_ONE, id, 3)
                return PLUGIN_CONTINUE                
        }
        if(!buyswitch){
                format(message, 127, "^x04【爱生活_爱美丽】^x03购买武器时间已过!")
                color_saytext(message, MSG_ONE, id, 3)
                return PLUGIN_CONTINUE                
        }
        else {
                cs_set_user_money(id,moneyy-akcost)
                give_item(id, "weapon_ak47")
                cs_set_user_bpammo(id,CSW_AK47,90)
        }
        return PLUGIN_CONTINUE        
}  

public eResetHUD()
{
        new Float:buytime=get_cvar_float("mp_buytime")*60
        buyswitch=true
        set_task(buytime,"buy")
}
public buy()
{
        buyswitch=false
}  
public round_start()
{
        new message[128]
        format(message, 127, "^x04【爱生活_爱美丽】^x03警察可以买AK & 土匪可以买M4a1 ^x01say/m4 & say/ak ")
        color_saytext(message, MSG_ALL, _, 4)
       
}

////////////////////////////// color_saytext ////////////////////////////////////////////
/*
color_by_team = 1  use TE's team-color(red)
color_by_team = 2  use CT's team-color(blue)
color_by_team = 3  use SPEC's team-color(gray)
color_by_team = 4  use everyone's team-color(TE use red, CT use blue, SPECTATOR use gray)
*/
stock color_saytext(message[], dest, id = 0, color_by_team = 0 )
{
        if ( (dest == MSG_ONE || dest == MSG_ONE_UNRELIABLE ) && !id )
                return 0
        new pList[32],pNum,i,color
        if ( color_by_team > 3 )//by current definiens, affirm MSG_ALL
        {
                get_players(pList, pNum)
                for ( i=0; i<pNum; i++ )
                {
                        color = pList
                        message_begin(MSG_ONE, iSayTextMsgID, {0,0,0}, color)
                        write_byte(color)
                        write_string(message)
                        message_end()
                }
                return 1
        }
        if ( color_by_team && color_by_team < 3 )//if use te or ct's team-color
        {
                new iParam
                get_players(pList, pNum)
                for ( i=0; i<pNum; i++ )
                {
                        iParam = pList
                        if ( get_user_team(iParam) == color_by_team )
                        {
                                color = iParam
                                break
                        }
                }
        }
        if ( !color )//if cannot find any player by team or not const id, use gray color
                color = (color_by_team == 3 || !id )?33:id
        message_begin(dest, iSayTextMsgID, {0,0,0}, (dest == MSG_ONE || dest == MSG_ONE_UNRELIABLE)?id: 0)
        write_byte(color)
        write_string(message)
        return message_end()
}

试试吧,好久没有发帖了
回复

使用道具 举报

 楼主| 发表于 2009-5-31 13:56:44 | 显示全部楼层 来自 河南周口
谢谢,我试试。
回复

使用道具 举报

发表于 2009-6-1 00:50:47 | 显示全部楼层 来自 广东佛山
无法编译,怎么回事
回复

使用道具 举报

发表于 2009-7-16 11:26:05 | 显示全部楼层 来自 广东深圳
编译出错没人理??????
回复

使用道具 举报

发表于 2009-7-16 11:26:23 | 显示全部楼层 来自 广东深圳
amxx1.76D.............
回复

使用道具 举报

发表于 2011-1-8 20:12:02 | 显示全部楼层 来自 安徽
能在里面加权限吗?只有会员才可以用!
回复

使用道具 举报

发表于 2011-1-18 04:38:51 | 显示全部楼层 来自 广西玉林
编不了啊
回复

使用道具 举报

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

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