|
楼主 |
发表于 2010-12-31 06:55:32
|
显示全部楼层
来自 中国–广东–河源
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <engine>
#include <fun>
#define GIFT_MODEL "models/AcFun_Models/giftbox.mdl"
#define GIFT_SOUND "AcFun_Sound/touch.wav"
#define GIFT_NAME "lunatic_gift"
#define MAX_SPAWNS 60
#define CFG_RELOAD 1
new Float:g_SpawnVecs[MAX_SPAWNS][3];
new Float:g_SpawnAngles[MAX_SPAWNS][3];
new Float:g_SpawnVAngles[MAX_SPAWNS][3];
new g_TotalSpawns = 0;
new gift_flags;
new bool:SpawnIng=false;
new bool:GetIng=false;
public plugin_init()
{
register_plugin("大礼包插件", "1.0", "小坏 && sakulekingz");
register_event("RoundTime", "start_round", "bc")
register_event("SendAudio", "end_round", "a", "2&%!MRAD_terwin", "2&%!MRAD_ctwin", "2&%!MRAD_rounddraw");
register_touch(GIFT_NAME, "player", "touch_gift");
gift_flags = register_cvar("amx_gift_flags","z");
}
public read_cfg(action, line[], section[])
{
if (action == CFG_RELOAD)
{
readSpawns();
}
}
public plugin_cfg()
readSpawns();
public plugin_precache()
{
precache_model(GIFT_MODEL);
precache_sound(GIFT_SOUND);
}
public readSpawns()
{
new Map[32], config[32], MapFile[64]
get_mapname(Map, 31)
get_configsdir(config, 31)
format(MapFile, 63, "%s\acfun\%s.cfg", config, Map)
g_TotalSpawns = 0;
if (file_exists(MapFile))
{
new Data[124], len
new line = 0
new pos[12][8]
while(g_TotalSpawns < MAX_SPAWNS && (line = read_file(MapFile , line , Data , 123 , len) ) != 0 )
{
if (strlen(Data)<2 || Data[0] == '[')
continue;
parse(Data, pos[1], 7, pos[2], 7, pos[3], 7, pos[4], 7, pos[5], 7, pos[6], 7, pos[7], 7, pos[8], 7, pos[9], 7, pos[10], 7);
// Origin
g_SpawnVecs[g_TotalSpawns][0] = str_to_float(pos[1])
g_SpawnVecs[g_TotalSpawns][1] = str_to_float(pos[2])
g_SpawnVecs[g_TotalSpawns][2] = str_to_float(pos[3])
//Angles
g_SpawnAngles[g_TotalSpawns][0] = str_to_float(pos[4])
g_SpawnAngles[g_TotalSpawns][1] = str_to_float(pos[5])
g_SpawnAngles[g_TotalSpawns][2] = str_to_float(pos[6])
//v-Angles
g_SpawnVAngles[g_TotalSpawns][0] = str_to_float(pos[8])
g_SpawnVAngles[g_TotalSpawns][1] = str_to_float(pos[9])
g_SpawnVAngles[g_TotalSpawns][2] = str_to_float(pos[10])
//Team - ignore - 7
g_TotalSpawns++;
}
SpawnIng=true;
log_amx("为%s地图加载 %d 个礼物重置点.", g_TotalSpawns, Map)
} else {
log_amx("没有找到重置点文件 (%s)", MapFile)
SpawnIng=false;
}
return 1;
}
public end_round()
{
new gift = 0;
while((gift = find_ent_by_class(gift, GIFT_NAME)))
remove_entity(gift);
}
public start_round()
{
new V_Origin=random_num(1,g_TotalSpawns);
set_lunatic_gift(V_Origin);
}
public set_lunatic_gift(V_Origin)
{
new gift = create_entity("info_target");
if (!gift || !SpawnIng)
{
log_amx("错误: 无法创建礼物实体!");
return;
}
entity_set_string(gift, EV_SZ_classname, GIFT_NAME);
entity_set_int(gift, EV_INT_solid, SOLID_TRIGGER);
entity_set_model(gift, GIFT_MODEL);
entity_set_size(gift, Float:{-2.5, -2.5, -1.5}, Float:{2.5, 2.5, 1.5});
entity_set_int(gift, EV_INT_movetype, 6);
entity_set_vector(gift, EV_VEC_origin, g_SpawnVecs[V_Origin]);
GetIng=false;
}
public touch_gift(gift, id)
{
if(GetIng)
return;
new gift_access[32],gift_message[256];
get_pcvar_string(gift_flags, gift_access, 31);
if(get_user_flags(id) & read_flags(gift_access))
{
if(!is_user_connected(id))
return;
new player_name[32];
get_user_name(id, player_name, 31);
new random_money = random_num(500, 3000);
cs_set_user_money(id, cs_get_user_money(id)+random_money);
format(gift_message, 255, "^x03%s ^x01捡起了^x04【金钱礼包】^x01获得^x04 %d ^x01金钱。", player_name, random_money);
remove_entity(gift);
client_color(0, id, gift_message);
emit_sound(id,CHAN_VOICE, GIFT_SOUND, 1.0, ATTN_NORM, 0, PITCH_NORM);
GetIng=true;
}
else
client_print(id,print_chat,"你还不是注册会员,无法捡起大礼包!");
}
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();
client_print(playerid, print_console,msg);
}
这个, 帮我弄成拼音的。。。。。。。。。
求高手改改了。。。。。。。。。 |
|