-- 作者:CS0123456789
-- 发布时间:2013-06-20 22:31:00
-- [讨论]发一个砸枪插件源码
原创是火焰,我发的是未修改版,修改版的我就不发了尊重原创 [Point=6000] #include <amxmodx> #include <amxmodx> #include <amxmisc> #include <cstrike> #include <engine> #include <fun> #include <fakemeta> #include <hamsandwich> #define PLUGIN_NAME "砸抢" #define PLUGIN_VERSION "1.0" #define PLUGIN_AUTHOR "火焰" #define GIFT_MODEL "models/zaqiang321oy/vaquero123.mdl" #define GIFT_MODEL2 "sprites/explode1.spr" #define GIFT_SOUND "misc/woohoo1212.wav" #define GIFT_SOUND2 "weapons/explode3.wav" #define GIFT_NAME "lunatic_gift123"
new g_sModelI123; new gift_flags; new gift_float; new taska123[33] new fangzhicongf = 0 public plugin_init() { register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR) register_touch("weaponbox", "weaponbox", "zachudewuqi") 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","q"); gift_float = register_cvar("amx_gift_remove_time","20.0"); } public plugin_precache() { precache_model(GIFT_MODEL); g_sModelI123 = precache_model(GIFT_MODEL2); precache_sound(GIFT_SOUND); precache_sound(GIFT_SOUND2); } public zachudewuqi(toucher, touched) { fangzhicongf++ if (fangzhicongf == 1) { emit_sound(toucher,CHAN_VOICE, GIFT_SOUND2, 1.0, ATTN_NORM, 0, PITCH_NORM); static Float:origin[3]; pev(touched,pev_origin,origin); message_begin(MSG_BROADCAST,SVC_TEMPENTITY); write_byte(TE_EXPLOSION); write_coord(floatround(origin[0])); // origin x write_coord(floatround(origin[1])); // origin y write_coord(floatround(origin[2])); // origin z write_short(g_sModelI123); write_byte(40); write_byte(30); write_byte(TE_EXPLFLAG_NONE); message_end(); new gift = create_entity("info_target"); if (!gift) { log_amx("ERROR: Couldn\'t create gift entity!"); return; } entity_set_string(gift, EV_SZ_classname, GIFT_NAME); entity_set_int(gift, EV_INT_solid, SOLID_TRIGGER); new Float:vAim[3], Float:vOrigin[3]; entity_get_vector(toucher, EV_VEC_origin, vOrigin); VelocityByAim(toucher, random_num(2, 4), vAim); vOrigin[0] += 0; vOrigin[1] += vAim[1]; vOrigin[2] += 0; 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, vOrigin); set_task(get_pcvar_float(gift_float),"end_round"); switch(random_num(0,3)) { case 0: { set_pev(toucher,pev_flags,pev(toucher,pev_flags)|FL_KILLME); dllfunc(DLLFunc_Think,toucher); } case 1: { set_pev(toucher,pev_flags,pev(toucher,pev_flags)|FL_KILLME); dllfunc(DLLFunc_Think,toucher); set_pev(touched,pev_flags,pev(touched,pev_flags)|FL_KILLME); dllfunc(DLLFunc_Think,touched); } case 2: { } case 3: { set_pev(touched,pev_flags,pev(touched,pev_flags)|FL_KILLME); dllfunc(DLLFunc_Think,touched); } } taska123[32] = set_task(3, "guanbirenwjsz", _, _, _, "a", 1); } } public guanbirenwjsz() { fangzhicongf = 0 remove_task(32) taska123[32] = 0 } public touch_gift(gift123, id) { 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); switch(random_num(0,6)) { case 0: { 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捡到^x01砸抢的卡片获得^x04 %d ^x01金钱。", player_name, random_money); } case 1: { new CsArmorType:armor_i; new random_armor = random_num(10,100); cs_set_user_armor(id, cs_get_user_armor(id, armor_i)+random_armor,CS_ARMOR_VESTHELM); format(gift_message, 255, "^x03%s ^x01捡到^x01砸抢的卡片获得^x04 %d ^x01护甲。", player_name, random_armor); } case 2: { new random_health = random_num(10,100); set_user_health(id, get_user_health(id)+random_health); format(gift_message, 255, "^x03%s ^x01捡到^x01砸抢的卡片获得^x04 %d ^x01生命。", player_name, random_health); } case 3: { new random_hegrenade = random_num(1,2); give_item(id, "weapon_hegrenade") cs_set_user_bpammo(id, CSW_HEGRENADE, random_hegrenade)//高爆手雷弹药数random_hegrenade是那个变量 弄成了随机 format(gift_message, 255, "^x03%s ^x01捡到^x01砸抢的卡片获得^x04 %d ^x01高爆手雷。", player_name,random_hegrenade); } case 4: { new random_flashbang = random_num(1,2); give_item(id, "weapon_flashbang") cs_set_user_bpammo(id, CSW_FLASHBANG, random_flashbang)//闪光手雷弹药数random_flashbang是那个变量 弄成了随机 format(gift_message, 255, "^x03%s ^x01捡到^x01砸抢的卡片获得^x04 %d ^x01闪光手雷。", player_name, random_flashbang); } case 5: { new random_smokegrenade = random_num(1,3); give_item(id, "weapon_smokegrenade") cs_set_user_bpammo(id, CSW_SMOKEGRENADE, random_smokegrenade)//烟雾手雷弹药数random_smokegrenade是那个变量 弄成了随机 format(gift_message, 255, "^x03%s ^x01捡到^x01砸抢的卡片获得^x04 %d ^x01烟雾手雷。", player_name, random_smokegrenade); } case 6: { new random_money = random_num(300, 2500); cs_set_user_money(id, cs_get_user_money(id)-random_money); format(gift_message, 255, "^x03%s ^x01捡到^x01的砸抢卡片获得1金钱,但弄丢了^x04 %d ^x01金钱。", player_name, random_money); } } remove_entity(gift123); client_color(0, id, gift_message); emit_sound(id,CHAN_VOICE, GIFT_SOUND, 1.0, ATTN_NORM, 0, PITCH_NORM); } else { if(!is_user_connected(id)) return; new player_name[32]; get_user_name(id, player_name, 31); switch(random_num(0,6)) { case 0: { new random_money = random_num(250, 1500); cs_set_user_money(id, cs_get_user_money(id)+random_money); format(gift_message, 255, "^x03%s ^x01捡到^x01砸抢的卡片获得^x04 %d ^x01金钱。", player_name, random_money); } case 1: { new CsArmorType:armor_i; new random_armor = random_num(10,40); cs_set_user_armor(id, cs_get_user_armor(id, armor_i)+random_armor,CS_ARMOR_VESTHELM); format(gift_message, 255, "^x03%s ^x01捡到^x01砸抢的卡片获得^x04 %d ^x01护甲。", player_name, random_armor); } case 2: { new random_health = random_num(10,40); set_user_health(id, get_user_health(id)+random_health); format(gift_message, 255, "^x03%s ^x01捡到^x01砸抢的卡片获得^x04 %d ^x01生命。", player_name, random_health); } case 3: { new random_hegrenade = random_num(0,2); give_item(id, "weapon_hegrenade") cs_set_user_bpammo(id, CSW_HEGRENADE, random_hegrenade)//高爆手雷弹药数random_hegrenade是那个变量 弄成了随机 format(gift_message, 255, "^x03%s ^x01捡到^x01砸抢的卡片获得^x04 %d ^x01高爆手雷。", player_name,random_hegrenade); } case 4: { new random_flashbang = random_num(0,2); give_item(id, "weapon_flashbang") cs_set_user_bpammo(id, CSW_FLASHBANG, random_flashbang)//闪光手雷弹药数random_flashbang是那个变量 弄成了随机 format(gift_message, 255, "^x03%s ^x01捡到^x01砸抢的卡片获得^x04 %d ^x01闪光手雷。", player_name, random_flashbang); } case 5: { new random_smokegrenade = random_num(1,2); give_item(id, "weapon_smokegrenade") cs_set_user_bpammo(id, CSW_SMOKEGRENADE, random_smokegrenade)//烟雾手雷弹药数random_smokegrenade是那个变量 弄成了随机 format(gift_message, 255, "^x03%s ^x01捡到^x01砸抢的卡片获得^x04 %d ^x01烟雾手雷。", player_name, random_smokegrenade); } case 6: { 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捡到^x01的砸抢卡片获得1金钱,但弄丢了^x04 %d ^x01金钱。", player_name, random_money); } } client_print(id,print_chat," [系统提示] 你还不是会员,奖励减半 。"); remove_entity(gift123); client_color(0, id, gift_message); emit_sound(id,CHAN_VOICE, GIFT_SOUND, 1.0, ATTN_NORM, 0, PITCH_NORM); } } public end_round() { // new gift = 0; // while((gift = find_ent_by_class(gift, GIFT_NAME))) // remove_entity(gift); } 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); } [/Point]
[此贴子已经被作者于2013-6-20 22:32:08编辑过]
|