lydjjlyd
|
分享:
▼
x0
|
[1.6][插件] 关于zp_presents补给包问题
为啥用zp这个补给包会出现一个补给包出现多种枪,就像是坐标重叠,我有源码,但不知道该怎么写,让随机坐标不重复刷。希望各位大神帮帮忙!下面就是这插件关键部位,武器设置什么的就没发了,毕竟太多了。public plugin_init(){register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR)register_event("HLTV", "event_round_start", "a", "1=0", "2=0")register_touch("maximusbroodPresent", "player", "event_presentTouch");g_persents_time = register_cvar("zp_presents_time", "45")g_persents_num_o = register_cvar("zp_presents_randm_a", "1")g_persents_num_t = register_cvar("zp_presents_randm_b", "3")new cfgdir[32]get_configsdir(cfgdir, 255)new mapname[32];get_mapname(mapname, 31);format(g_orginFilePath, 255, "%s/presents/%s.ini", cfgdir, mapname);loadData();set_task(0.3,"event_round_start") }public event_round_start(){removePresents()set_task(get_pcvar_float(g_persents_time), "set_present",111111,_,_,"b") }public zp_round_ended(winteam){remove_task(111111)}public plugin_precache() {precache_sound(sound_present)precache_sound(sound_get)precache_model("models/presents.mdl")}loadData(){g_totalOrigins = 0;new buffer[128];new strX[12], strY[12], strZ[12];if( file_exists(g_orginFilePath) ) {new readPointer = fopen(g_orginFilePath, "rt");if(!readPointer)return;while( !feof(readPointer) ){fgets(readPointer, buffer, 127);if(buffer[0] == ';' || !buffer[0])continue;parse(buffer, strX, 11, strY, 11, strZ, 11);g_spawnOrigins[g_totalOrigins][0] = float(str_to_num(strX));g_spawnOrigins[g_totalOrigins][1] = float(str_to_num(strY));g_spawnOrigins[g_totalOrigins][2] = float(str_to_num(strZ));++g_totalOrigins;}fclose(readPointer);}}public removePresents(){new currentEntity;while ( (currentEntity = find_ent_by_class(currentEntity, "maximusbroodPresent")) != 0){remove_entity(currentEntity);}}public spawnPresent(){new f,entidf = random_num(1,g_totalOrigins - 1)entid = create_entity("info_target")entity_set_string(entid, EV_SZ_classname, "maximusbroodPresent")entity_set_model(entid, "models/presents.mdl")entity_set_origin(entid, g_spawnOrigins[f])entity_set_int(entid, EV_INT_solid, 1)entity_set_int(entid, EV_INT_movetype, 6)return PLUGIN_CONTINUE;}public event_presentTouch(pTouched, pToucher){if(zp_get_user_zombie(pToucher))return PLUGIN_HANDLED;if(!is_valid_ent(pToucher) || !is_valid_ent(pTouched) || !is_user_connected(pToucher))return PLUGIN_HANDLED;client_cmd(pToucher, "spk %s", sound_get)remove_entity(pTouched);new tt = random_num(1,6)get_user_name(pToucher, szName, 31);if (t == 1){get_sg552(pToucher)client_print(0, print_center, "%s 捡到旋风AK",szName);}else if (t == 2){get_he(pToucher)client_print(0, print_center, "%s 捡到两颗高爆手雷",szName);}else if (t == 3){get_m249(pToucher)client_print(0, print_center, "%s 捡到MG3毁灭者",szName);}else if (t == 4){get_m4a1(pToucher)client_print(0, print_center, "%s 捡到迷彩M4A1",szName);}else if (t == 5){get_mac10(pToucher)client_print(0, print_center, "%s 捡到双持MP7A1",szName);}else if (t == 6){get_bpammo(pToucher)client_print(0, print_center, "%s 捡到一些弹药",szName);}return PLUGIN_CONTINUE;}public set_present(){new gg = random_num(get_pcvar_num(g_persents_num_o),get_pcvar_num(g_persents_num_t))client_print(0, print_center, "补给箱已经到达!!!");client_cmd(0, "spk %s", sound_present) removePresents()for (new i = 0; i < g + 1; i++) {set_task(1.0,"spawnPresent")}}
|
|
x0
[樓 主]
From:歐洲 | Posted:2017-12-01 16:59 |
|
|
|