Правила форума Гаранты форума
Размещение рекламы AMX-X компилятор

Здравствуйте, гость Вход | Регистрация

Наши новости:

14-дек
24-апр
10-апр
11-апр

set_user_origin(id,orign) и give_item(id, "weapon_c4")

Статус пользователя ssx
сообщение 17.11.2016, 19:08
Сообщение #1


Стаж: 12 лет

Сообщений: 2237
Благодарностей: 1343
Полезность: 836

Помогите решить две проблемки:

первая проблема:
Код:
	new orign[3]
get_user_origin(Players[id][itm],orign,1) // Берём с игрока1 координаты
orign[2] += 15 // добавляем 15 юнитов высоты чтобы не застревал на склонах.
set_user_origin(id,orign) // перемещаем игрока2 на точку игрока1 (в полной версии кода перед перемещением игрока1 убивает)

И так проблема заключается в том что в углах или возле ящиков и т д при телепортации игрок2 застревает .

вторая проблема:
Код:
	static weapons[32], num, i
num = 0
get_user_weapons(Players[id][itm], weapons, num)
for(i = 0; i < num; i ++)
{
switch(weapons[i])
{
case 6: give_item(id, "weapon_c4")
}
}

Дает C4 но нет значка и нельзя поставить. То есть +attack на С4 не работает. Если выбросить бомбу и поднять то всё нормально работает.
Пробовал я вот так выдавать:
Код:
				if ( cs_get_user_plant ( Players[id][itm] ) )
{
cs_set_user_plant(id,1,1)
}

Тогда значёк есть но поставить так же нельзя. Данный баг проявляется не всегда но очень часто (с двумя вариантами) .

Отредактировал: ssx, - 17.11.2016, 19:11


[Half-Life DM FFA] 78.152.169.100:27016
[CS 1.6 GunGame] 78.152.169.100:27018
[CS 1.6 DM AIM] 78.152.169.100:27017
[CS 1.6 DM FFA] 78.152.169.100:27015
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   Цитировать сообщение
Статус пользователя Legenda
сообщение 17.11.2016, 21:10
Сообщение #2


Иконка группы

Стаж: 16 лет

Сообщений: 3619
Благодарностей: 1706
Полезность: 1010

Меценат Меценат

1. открой стандартный плагин телепорта amxmodx и посмотри код
как в нем сделано всё
2.
надо и c4 выдать и выдавать флаг, что игроку доступна установка c4 одновременно

Цитата
Если вы выдали игроку бомбу с помощью функции , то игрок все равно не сможет ее поставить, если выбросит и поднимет то сможет. Функция cs_set_user_plant исправляет эту проблему.
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
Поблагодарили 1 раз
   + Цитировать сообщение
Статус пользователя ssx
сообщение 17.11.2016, 23:01
Сообщение #3


Стаж: 12 лет

Сообщений: 2237
Благодарностей: 1343
Полезность: 836

1. в стандартном телепорте так же
Код:
new origin[3]

get_user_origin(id, origin)
set_user_origin(player, origin)


Не нашел ничего корректирующего при телепортации.

Полный код оригинального плагина телепорта
Код:
/* AMX Mod X
* Teleport Menu Plugin
*
* by the AMX Mod X Development Team
* originally developed by OLO
*
* This file is part of AMX Mod X.
*
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, the author gives permission to
* link the code of this program with the Half-Life Game Engine ("HL
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
* L.L.C ("Valve"). You must obey the GNU General Public License in all
* respects for all of the code used other than the HL Engine and MODs
* from Valve. If you modify this file, you may extend this exception
* to your version of the file, but you are not obligated to do so. If
* you do not wish to do so, delete this exception statement from your
* version.
*/

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

new g_menuPosition[33]
new g_menuPlayers[33][32]
new g_menuPlayersNum[33]
new g_menuOption[33] = {-1, ...}
new g_menuOrgin[33][3]
new g_coloredMenus

public plugin_init()
{
register_plugin("Teleport Menu", AMXX_VERSION_STR, "AMXX Dev Team")
register_dictionary("telemenu.txt")
register_dictionary("common.txt")
register_clcmd("amx_teleportmenu", "cmdTelMenu", ADMIN_CFG, "- displays teleport menu")
register_menucmd(register_menuid("Teleport Menu"), 1023, "actionTelMenu")

g_coloredMenus = colored_menus()
}

public actionTelMenu(id, key)
{
switch (key)
{
case 6:
{
g_menuOption[id] = 1 - g_menuOption[id]
displayTelMenu(id, g_menuPosition[id])
}
case 7:
{
if (g_menuOption[id] < 0) /* unlocking position for the first time */
g_menuOption[id] = 0

get_user_origin(id, g_menuOrgin[id])
displayTelMenu(id, g_menuPosition[id])
}
case 8: displayTelMenu(id, ++g_menuPosition[id])
case 9: displayTelMenu(id, --g_menuPosition[id])
default:
{
new player = g_menuPlayers[id][g_menuPosition[id] * 6 + key]
new name2[32]

get_user_name(player, name2, 31)

if (!is_user_alive(player))
{
client_print(id, print_chat, "%L", id, "CANT_PERF_DEAD", name2)
displayTelMenu(id, g_menuPosition[id])
return PLUGIN_HANDLED
}

if (g_menuOption[id] > 0)
{
set_user_origin(player, g_menuOrgin[id])
} else {
new origin[3]

get_user_origin(id, origin)
set_user_origin(player, origin)
}

new authid[32], authid2[32], name[32]

get_user_authid(id, authid, 31)
get_user_authid(player, authid2, 31)
get_user_name(id, name, 31)

log_amx("Cmd: ^"%s<%d><%s><>^" teleport ^"%s<%d><%s><>^"", name, get_user_userid(id), authid, name2, get_user_userid(player), authid2)

show_activity_key("ADMIN_TELEPORT_1", "ADMIN_TELEPORT_2", name, name2);

displayTelMenu(id, g_menuPosition[id])
}
}

return PLUGIN_HANDLED
}

displayTelMenu(id, pos)
{
if (pos < 0)
return

get_players(g_menuPlayers[id], g_menuPlayersNum[id])

new menuBody[512]
new b = 0
new i
new name[32]
new start = pos * 6
new bool:blockMenu = (is_user_alive(id) && g_menuOption[id] < 1) ? true : false

if (start >= g_menuPlayersNum[id])
start = pos = g_menuPosition[id] = 0

new len = format(menuBody, 511, g_coloredMenus ? "\y%L\R%d/%d^n\w^n" : "%L %d/%d^n^n", id, "TELE_MENU", pos + 1, (g_menuPlayersNum[id] / 6 + ((g_menuPlayersNum[id] % 6) ? 1 : 0)))
new end = start + 6
new keys = MENU_KEY_0|MENU_KEY_8

if (end > g_menuPlayersNum[id])
end = g_menuPlayersNum[id]

for (new a = start; a < end; ++a)
{
i = g_menuPlayers[id][a]
get_user_name(i, name, 31)

if (blockMenu || !is_user_alive(i) || (id != i && get_user_flags(i) & ADMIN_IMMUNITY))
{
++b

if (g_coloredMenus)
len += format(menuBody[len], 511-len, "\d%d. %s^n\w", b, name)
else
len += format(menuBody[len], 511-len, "#. %s^n", name)
} else {
keys |= (1<<b)

if (is_user_admin(i))
len += format(menuBody[len], 511-len, g_coloredMenus ? "%d. %s \r*^n\w" : "%d. %s *^n", ++b, name)
else
len += format(menuBody[len], 511-len, "%d. %s^n", ++b, name)
}
}

if (g_menuOption[id] > 0) // 1
{
keys |= MENU_KEY_7
len += format(menuBody[len], 511-len, "^n7. To location: %d %d %d^n", g_menuOrgin[id][0], g_menuOrgin[id][1], g_menuOrgin[id][2])
}
else if (g_menuOption[id]) // -1
{
if (g_coloredMenus)
len += format(menuBody[len], 511-len, "^n\d7. %L^n\w", id, "CUR_LOC")
else
len += format(menuBody[len], 511-len, "^n#. %L^n", id, "CUR_LOC")
} else { // 0
keys |= MENU_KEY_7
len += format(menuBody[len], 511-len, "^n7. %L^n", id, "CUR_LOC")
}

len += format(menuBody[len], 511-len, "8. %L^n", id, "SAVE_LOC")

if (end != g_menuPlayersNum[id])
{
format(menuBody[len], 511-len, "^n9. %L...^n0. %L", id, "MORE", id, pos ? "BACK" : "EXIT")
keys |= MENU_KEY_9
}
else
format(menuBody[len], 511-len, "^n0. %L", id, pos ? "BACK" : "EXIT")

show_menu(id, keys, menuBody, -1, "Teleport Menu")
}

public cmdTelMenu(id, level, cid)
{
if (cmd_access(id, level, cid, 1))
displayTelMenu(id, g_menuPosition[id] = 0)

return PLUGIN_HANDLED
}


[Half-Life DM FFA] 78.152.169.100:27016
[CS 1.6 GunGame] 78.152.169.100:27018
[CS 1.6 DM AIM] 78.152.169.100:27017
[CS 1.6 DM FFA] 78.152.169.100:27015
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   + Цитировать сообщение
Статус пользователя ssx
сообщение 17.11.2016, 23:16
Сообщение #4


Стаж: 12 лет

Сообщений: 2237
Благодарностей: 1343
Полезность: 836

Нашел вот такой плагин
Smoke Teleport
Код:
/* AMX Mod X
* Teleport Smoke Grenade
*
* © Copyright 2006 by VEN
*
* This file is provided as is (no warranties)
*
* DESCRIPTION
* Plugin changes the smoke grenade to teleport grenade with a bit of smoke.
* Usage: drop the grenade, you will be teleported to the spot of explosion.
* Try to crouch if the height of the spot are small for uncrouched player.
*
* CREDITS
* Dread Pirate - idea
*/

#include <amxmodx>
#include <fakemeta>

#define PLUGIN_NAME "Teleport Smoke Grenade"
#define PLUGIN_VERSION "0.1"
#define PLUGIN_AUTHOR "VEN"

#define SMOKE_SCALE 30
#define SMOKE_FRAMERATE 12
#define SMOKE_GROUND_OFFSET 6

// do not edit
new const g_sound_explosion[] = "weapons/sg_explode.wav"
new const g_classname_grenade[] = "grenade"

new const Float:g_sign[4][2] = {{1.0, 1.0}, {1.0, -1.0}, {-1.0, -1.0}, {-1.0, 1.0}}

new g_spriteid_steam1
new g_eventid_createsmoke

public plugin_init() {
register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR)

register_forward(FM_EmitSound, "forward_emitsound")
register_forward(FM_PlaybackEvent, "forward_playbackevent")

// we do not precaching, but retrieving the indexes
g_spriteid_steam1 = engfunc(EngFunc_PrecacheModel, "sprites/steam1.spr")
g_eventid_createsmoke = engfunc(EngFunc_PrecacheEvent, 1, "events/createsmoke.sc")
}

public forward_emitsound(ent, channel, const sound[]) {
if (!equal(sound, g_sound_explosion) || !is_grenade(ent))
return FMRES_IGNORED

static id, Float:origin[3]
id = pev(ent, pev_owner)
pev(ent, pev_origin, origin)
engfunc(EngFunc_EmitSound, ent, CHAN_WEAPON, g_sound_explosion, VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
engfunc(EngFunc_RemoveEntity, ent)
origin[2] += SMOKE_GROUND_OFFSET
create_smoke(origin)

if (is_user_alive(id)) {
static Float:mins[3], hull
pev(id, pev_mins, mins)
origin[2] -= mins[2] + SMOKE_GROUND_OFFSET
hull = pev(id, pev_flags) & FL_DUCKING ? HULL_HEAD : HULL_HUMAN
if (is_hull_vacant(origin, hull))
engfunc(EngFunc_SetOrigin, id, origin)
else { // close to a solid object, trying to find a vacant spot
static Float:vec[3]
vec[2] = origin[2]
for (new i; i < sizeof g_sign; ++i) {
vec[0] = origin[0] - mins[0] * g_sign[i][0]
vec[1] = origin[1] - mins[1] * g_sign[i][1]
if (is_hull_vacant(vec, hull)) {
engfunc(EngFunc_SetOrigin, id, vec)
break
}
}
}
}

return FMRES_SUPERCEDE
}

public forward_playbackevent(flags, invoker, eventindex) {
// we do not need a large amount of smoke
if (eventindex == g_eventid_createsmoke)
return FMRES_SUPERCEDE

return FMRES_IGNORED
}

bool:is_grenade(ent) {
if (!pev_valid(ent))
return false

static classname[sizeof g_classname_grenade + 1]
pev(ent, pev_classname, classname, sizeof g_classname_grenade)
if (equal(classname, g_classname_grenade))
return true

return false
}

create_smoke(const Float:origin[3]) {
// engfunc because origin are float
engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, origin, 0)
write_byte(TE_SMOKE)
engfunc(EngFunc_WriteCoord, origin[0])
engfunc(EngFunc_WriteCoord, origin[1])
engfunc(EngFunc_WriteCoord, origin[2])
write_short(g_spriteid_steam1)
write_byte(SMOKE_SCALE)
write_byte(SMOKE_FRAMERATE)
message_end()
}

stock bool:is_hull_vacant(const Float:origin[3], hull) {
new tr = 0
engfunc(EngFunc_TraceHull, origin, origin, 0, hull, 0, tr)
if (!get_tr2(tr, TR_StartSolid) && !get_tr2(tr, TR_AllSolid) && get_tr2(tr, TR_InOpen))
return true

return false
}


В нём есть:
Код:
	static id, Float:origin[3]
id = pev(ent, pev_owner)
pev(ent, pev_origin, origin)
engfunc(EngFunc_EmitSound, ent, CHAN_WEAPON, g_sound_explosion, VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
engfunc(EngFunc_RemoveEntity, ent)
origin[2] += SMOKE_GROUND_OFFSET
create_smoke(origin)

if (is_user_alive(id)) {
static Float:mins[3], hull
pev(id, pev_mins, mins)
origin[2] -= mins[2] + SMOKE_GROUND_OFFSET
hull = pev(id, pev_flags) & FL_DUCKING ? HULL_HEAD : HULL_HUMAN
if (is_hull_vacant(origin, hull))
engfunc(EngFunc_SetOrigin, id, origin)
else { // close to a solid object, trying to find a vacant spot
static Float:vec[3]
vec[2] = origin[2]
for (new i; i < sizeof g_sign; ++i) {
vec[0] = origin[0] - mins[0] * g_sign[i][0]
vec[1] = origin[1] - mins[1] * g_sign[i][1]
if (is_hull_vacant(vec, hull)) {
engfunc(EngFunc_SetOrigin, id, vec)
break
}
}
}
}

...


stock bool:is_hull_vacant(const Float:origin[3], hull) {
new tr = 0
engfunc(EngFunc_TraceHull, origin, origin, 0, hull, 0, tr)
if (!get_tr2(tr, TR_StartSolid) && !get_tr2(tr, TR_AllSolid) && get_tr2(tr, TR_InOpen))
return true

return false
}


Это и есть проверка на застревание ?


[Half-Life DM FFA] 78.152.169.100:27016
[CS 1.6 GunGame] 78.152.169.100:27018
[CS 1.6 DM AIM] 78.152.169.100:27017
[CS 1.6 DM FFA] 78.152.169.100:27015
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   + Цитировать сообщение
voed
сообщение 18.11.2016, 1:08
Сообщение #5
Стаж: 11 лет

Сообщений: 2593
Благодарностей: 1760
Полезность: 405

ssx, поиск свободного места для размещения энтити, да
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   + Цитировать сообщение
  Ответить в данную темуНачать новую тему
 
0 пользователей и 1 гостей читают эту тему: