|
发表于 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()
}
试试吧,好久没有发帖了 |
|