Ошибка Spawn Manager

Статус
В этой теме нельзя размещать новые ответы.
Сообщения
283
Реакции
31
Ошибка
L 08/13/2019 - 09:40:54: [AMXX] Displaying debug trace (plugin "csdm_spawn_manager.amxx", version "0.0.8")
L 08/13/2019 - 09:40:54: [AMXX] Run time error 4: index out of bounds
L 08/13/2019 - 09:40:54: [AMXX] [0] csdm_spawn_manager.sma::RandomSpawn (line 189)
L 08/13/2019 - 09:40:54: [AMXX] [1] csdm_spawn_manager.sma::CSGameRules_GetPlayerSpawnSpot (line 170)
ОС
Linux
Amx Mod X
AMX Mod X 1.9.0.5249 (http://www.amxmodx.org)
Authors:
David "BAILOPAN" Anderson, Pavol "PM OnoTo" Marko
Felix "SniperBeamer" Geyer, Jonny "Got His Gun" Bergstrom
Lukasz "SidLuke" Wlasinski, Christian "Basic-Master" Hammacher
Borja "faluco" Ferrer, Scott "DS" Ehlert
Compiled: Jun 19 2019 13:31:53
Built from: https://github.com/alliedmodders/amxmodx/commit/6cecb34
Build ID: 5249:6cecb34
Core mode: JIT+ASM32
Билд
Protocol version 48
Exe version 1.1.2.7/Stdio (cstrike)
ReHLDS version: 3.7.0.685-dev
Build date: 16:27:16 Aug 11 2019 (1947)
Build from: https://github.com/dreamstalker/rehlds/commit/5b68568
ReGamedll
ReGameDLL version: 5.9.0.369-dev
Build date: 14:12:36 Aug 11 2019
Build from: https://github.com/s1lentq/ReGameDLL_CS/commit/fcb597
Версия Metamod
Metamod-r v1.3.0.128, API (5:13)
Metamod-r build: 17:47:54 Aug 24 2018
Metamod-r from: https://github.com/theAsmodai/metamod-r/commit/0cf2f70
Список метамодулей
[ 1] SafeNameAndChat  RUN   -    SafeNameAndChat.so          v1.1            ini  ANY   ANY  
[ 2] Reunion RUN - reunion_mm_i386.so v0.1.0.133 ini Start Never
[ 3] ReAuthCheck RUN - reauthcheck_mm_i386.so v0.1.6 ini Start Never
[ 4] VoiceTranscoder RUN - VoiceTranscoder.so v2017RC3 ini ANY ANY
[ 5] AMX Mod X RUN - amxmodx_mm_i386.so v1.9.0.5249 ini Start ANY
[ 6] ReSRDetector RUN - resrdetector_mm_i386.so v0.1.0 ini Chlvl ANY
[ 7] WHBlocker RUN - whblocker_mm_i386.so v1.5.696 ini Chlvl ANY
[ 8] ReSemiclip RUN - resemiclip_mm_i386.so v2.3.9 ini Chlvl ANY
[ 9] Rechecker RUN - rechecker_mm_i386.so v2.5 ini Chlvl ANY
[10] ReAimDetector RUN - reaimdetector_amxx_i386.so v0.2.2 pl5 ANY Never
[11] ReAPI RUN - reapi_amxx_i386.so v5.9.0.178-dev pl5 ANY Never
[12] SQLite RUN - sqlite_amxx_i386.so v1.9.0.5249 pl5 ANY ANY
[13] CStrike RUN - cstrike_amxx_i386.so v1.9.0.5249 pl5 ANY ANY
[14] Engine RUN - engine_amxx_i386.so v1.9.0.5249 pl5 ANY ANY
[15] FakeMeta RUN - fakemeta_amxx_i386.so v1.9.0.5249 pl5 ANY ANY
[16] Ham Sandwich RUN - hamsandwich_amxx_i386.so v1.9.0.5249 pl5 ANY ANY
[17] SxGeo RUN - sxgeo_amxx_i386.so v2.2 pl5 ANY Never
17 plugins, 17 running
Список плагинов
[  1] ReAimDetector API       0.2.2       ReHLDS Team       reaimdetector.a  running  
[ 2] Advanced Client Checke 0.3.6 Mistrick cmdchecker.amxx running
[ 3] CSStatsX SQL 0.7.4+2 serfreeman1337 csstatsx_sql.am running
[ 4] FreshBans 1.4.2b kanagava fresh_bans_142_ running
[ 5] ScreenMaker 1.1 neygomon screen_maker.am running
[ 6] RC BaseChanger 1.0 phe rc_basechanger. stopped
[ 7] ReChecker Logging 1.0 phe rc_logging.amxx running
[ 8] Lite Admin ESP 1.1 neygomon, AcE admin_esp_ace.a running
[ 9] Admin Base 1.9.0.5241 AMXX Dev Team admin.amxx running
[ 10] Ping Control 1.4 neygomon Ping_Control.am running
[ 11] AFK Control ReNew 1.2(a) neygomon afk_control.amx running
[ 12] AES: StatsX 0.5+1 serfreeman1337 aes_statsx_cstr running
[ 13] Stats Configuration 1.10.0.525 AMXX Dev Team statscfg.amxx running
[ 14] Advanced Gag 1.9.0 neygomon amx_gag.amxx running
[ 15] [ReAPI] No Team Flash 0.0.2 Vaqtincha no_team_flash.a running
[ 16] Items Restrict 1.0 s1lent items_restrict. running
[ 17] Maps Menu 1.4.1 neugomon mapsmenu.amxx running
[ 18] Server Menu 1.5.0 [email protected] server_menu.amx running
[ 19] [ReAPI] Parachute 1.1.1 ReHLDS Team parachute.amxx running
[ 20] DemoRecoder 1.1 neygomon amx_demorec.amx running
[ 21] Rock to Ban 1.02 Safety1st rock2ban.amxx running
[ 22] Players Menu 1.7 neugomon players_menu.am running
[ 23] [ReAPI] Kills Counter 0.3 serfreeman1337 kills_counter.a running
[ 24] Killer ScreenFade 0.0.5 Vaqtincha reapi_killer_sc running
[ 25] SF Warn Menu 0.1.4g serfreeman1337 sf_admin_warns. running
[ 26] AES: StatsX Info Rank 0.1 serfreeman1337 aes_statsx_rank running
[ 27] Adverts 1.0 pUzzlik adverts_message running
[ 28] BunnyHop 1.0 PurposeLess bunnyhop.amxx running
[ 29] Advanced MapChooser 1.4 neygomon map_chooser_CSD running
[ 30] ReCSDM Team Balance 1.0.3 the_hunter recsdm_team_bal running
[ 31] resetscore(ReAPI) 1.0 Phantom resetscore.amxx running
[ 32] Steam Models 0.1b+mod.l Freedo.m steam_models.am running
[ 33] Online Helper 2.1.3 Nordic Warrior online_helper.a running
[ 34] [SxGeo] Connect Info 1.0 s1lent sxgeo_connect_i running
[ 35] Grab 2.5 Support123 grab_new.amxx running
[ 36] ProKreedz Hook v2.3 vato loco [GE-S] dr_hook.amxx running
[ 37] [ReAPI] Damager 1.1 phe re_damager.amxx running
[ 38] Weapon Icon 1.0 Zenix (m$ubn) weapon_icon.amx running
[ 39] Easy MultiJump 1.6 twistedeuphoria/ reapi_multijump running
[ 40] Ultimate KillStreak Ad 0.7 SAMURAI ut_killstreak_a running
[ 41] Multiple Game Names дата автор mgn.amxx running
[ 42] CSDM Core 0.0.8 Vaqtincha csdm_core.amxx running
[ 43] CSDM Equip Manager 0.0.8 Vaqtincha csdm_equip_mana running
[ 44] CSDM Map Cleaner 0.0.8 Vaqtincha csdm_map_cleane running
[ 45] CSDM Misc 0.0.8 Vaqtincha csdm_misc.amxx running
[ 46] CSDM Protection 0.0.8 Vaqtincha csdm_protection running
[ 47] CSDM Spawn Manager 0.0.8 Vaqtincha csdm_spawn_mana debug
[ 48] Team Grenade Trail 1.2 Numb team_grenade_tr running
[ 49] AMX Vampire 0.1 [email protected] amx_vampire.amx running
[ 50] Vzruv Golovu 1.0 eL vzruv_golovu.am running
[ 51] Lite Translit 2.8 neygomon lite_translit_c running
[ 52] Advanced Experience Sy 0.5.9 [REA serfreeman1337/s aes_main.amxx running
[ 53] AES: CStrike Addon 0.5.9 [REA serfreeman1337/s aes_exp_cstrike running
[ 54] AES: Informer 0.5.9 [REA serfreeman1337/s aes_informer.am running
[ 55] AES: Admin Tools 0.5.9 [REA serfreeman1337/s aes_exp_editor. running
55 plugins, 54 running
Автор плагина
Vaqtincha
Версия плагина
0.0.8
Исходник
// Copyright © 2016 Vaqtincha

#include <amxmodx>
#include <csdm>
#include <fakemeta>
#include <xs>

#if AMXX_VERSION_NUM < 183
#include <colorchat>
#endif

#define IsVectorZero(%1) (%1[X] == 0.0 && %1[Y] == 0.0 && %1[Z] == 0.0)
#define IsPlayer(%1) (1 <= %1 <= g_iMaxPlayers)

#define FIND_ENT_IN_SPHERE(%1,%2,%3) engfunc(EngFunc_FindEntityInSphere, %1, %2, %3)

const MAX_SPAWNS = 64
const Float:MIN_SPAWN_RADIUS = 450.0 // beta

// spawn editor options
const MAX_SEARCH_DISTANCE = 2500
const Float:ADD_Z_POSITION = 15.0

new const Float:g_flGravityValues[] = {1.0, 0.5, 0.25, 0.15, 0.05}

const MENU_KEY_BITS = (MENU_KEY_1|MENU_KEY_2|MENU_KEY_3|MENU_KEY_4|MENU_KEY_5|MENU_KEY_6|MENU_KEY_8)
const FORCE_VIEW_ANGLES = 1

enum coord_e { Float:X, Float:Y, Float:Z }

enum
{
FAILED_CREATE,
FILE_SAVED,
FILE_DELETED
}

new const g_szModel[] = "models/player/vip/vip.mdl"
new const g_szClassName[] = "view_spawn"
new const g_szEditorMenuTitle[] = "SpawnEditor"



new HookChain:g_hGetPlayerSpawnSpot

new Float:g_vecSpotOrigin[MAX_SPAWNS][coord_e],
Float:g_vecSpotVAngles[MAX_SPAWNS][coord_e],
Float:g_vecSpotAngles[MAX_SPAWNS][coord_e]

new Float:g_vecLastOrigin[MAX_CLIENTS + 1][coord_e],
Float:g_vecLastAngles[MAX_CLIENTS + 1][coord_e],
Float:g_vecLastVAngles[MAX_CLIENTS + 1][coord_e]

new g_pAimedEntity[MAX_CLIENTS + 1], g_iLastSpawnIndex[MAX_CLIENTS + 1], bool:g_bFirstSpawn[MAX_CLIENTS + 1]
new g_szSpawnDirectory[MAX_CONFIG_PATH_LEN], g_szSpawnFile[MAX_CONFIG_PATH_LEN + 32], g_szMapName[32]
new g_iTotalPoints, g_iEditorMenuID, bool:g_bEditSpawns, bool:g_bNotSaved
new g_iGravity, g_iMaxPlayers

public plugin_precache()
{
precache_model(g_szModel)
}

public plugin_init()
{
register_plugin("CSDM Spawn Manager", CSDM_VERSION_STRING, "Vaqtincha")
register_concmd("sp", "ConCmd_EditSpawns", ADMIN_MAP, "Edits spawn configuration")
register_clcmd("nightvision", "ClCmd_Nightvision")
register_menucmd((g_iEditorMenuID = register_menuid(g_szEditorMenuTitle)), MENU_KEY_BITS, "EditorMenuHandler")

DisableHookChain(g_hGetPlayerSpawnSpot = RegisterHookChain(RG_CSGameRules_GetPlayerSpawnSpot, "CSGameRules_GetPlayerSpawnSpot", .post = false))

g_iMaxPlayers = get_maxplayers()
}

public plugin_cfg()
{
new iLen = get_localinfo("amxx_configsdir", g_szSpawnDirectory, charsmax(g_szSpawnDirectory))
formatex(g_szSpawnDirectory[iLen], charsmax(g_szSpawnDirectory) - iLen, "%s/%s/%s", g_szSpawnDirectory[iLen], g_szMainDir, g_szSpawnDir)
MakeDir(g_szSpawnDirectory)

get_mapname(g_szMapName, charsmax(g_szMapName))
formatex(g_szSpawnFile, charsmax(g_szSpawnFile), "%s/%s.spawns.cfg", g_szSpawnDirectory, g_szMapName)
LoadPoints()
}

public plugin_end()
{
if(g_bEditSpawns && g_bNotSaved) // autosave
{
MakeDir(g_szSpawnDirectory)
SavePoints()
}
}

public CSDM_Initialized(const szVersion[])
{
if(!szVersion[0])
pause("ad")
}

public CSDM_ExecuteCVarValues()
{
if(g_iTotalPoints)
{
set_member_game(m_iSpawnPointCount_Terrorist, get_member_game(m_iSpawnPointCount_Terrorist) + (g_iTotalPoints / 2))
set_member_game(m_iSpawnPointCount_CT, get_member_game(m_iSpawnPointCount_CT) + (g_iTotalPoints / 2))
}
}

public CSDM_RestartRound(const bool:bNewGame)
{
if(bNewGame) {
ArraySet(g_iLastSpawnIndex, INVALID_INDEX)
}
}

public client_connect(pPlayer)
{
g_bFirstSpawn[pPlayer] = true
}

public client_putinserver(pPlayer)
{
g_pAimedEntity[pPlayer] = NULLENT
g_iLastSpawnIndex[pPlayer] = INVALID_INDEX
g_bFirstSpawn[pPlayer] = false
}

public ClCmd_Nightvision(const pPlayer, const level)
{
if(!g_bEditSpawns || !is_user_alive(pPlayer) || ~get_user_flags(pPlayer) & level)
return PLUGIN_CONTINUE

return ShowEditorMenu(pPlayer)
}

public ConCmd_EditSpawns(const pPlayer, const level)
{
if(!is_user_alive(pPlayer) || ~get_user_flags(pPlayer) & level)
return PLUGIN_HANDLED

if(g_bEditSpawns)
{
if(g_bNotSaved && SavePoints() == FAILED_CREATE)
{
console_print(pPlayer, "[CSDM] Autosave is failed. Please try again")
return ShowEditorMenu(pPlayer)
}

console_print(pPlayer, "[CSDM] Редактор спавнов выключен!")
CloseOpenedMenu(pPlayer)
RemoveAllSpotEntitys()
g_bEditSpawns = false

set_entvar(pPlayer, var_gravity, 1.0)
return PLUGIN_HANDLED
}

console_print(pPlayer, "[CSDM] Редактор спавнов включен!")
MakeAllSpotEntitys()
g_bEditSpawns = true

set_entvar(pPlayer, var_gravity, g_flGravityValues[g_iGravity])
return ShowEditorMenu(pPlayer)
}

public CSGameRules_GetPlayerSpawnSpot(const pPlayer)
{
if(RandomSpawn(pPlayer))
{
SetHookChainReturn(ATYPE_INTEGER, pPlayer)
return HC_SUPERCEDE
}

return HC_CONTINUE
}

RandomSpawn(const pPlayer)
{
if(!g_iTotalPoints || g_bFirstSpawn[pPlayer])
return false

new iRand = random(g_iTotalPoints), iAttempts, iLast = g_iLastSpawnIndex[pPlayer]
do
{
iAttempts++
/* && IsHullVacant(g_vecSpotOrigin[iRand], HULL_HUMAN, DONT_IGNORE_MONSTERS) */
if(iRand != iLast && !IsVectorZero(g_vecSpotOrigin[iRand]) && !CheckDistance(pPlayer, g_vecSpotOrigin[iRand]))
{
SetPlayerPosition(pPlayer, g_vecSpotOrigin[iRand], g_vecSpotVAngles[iRand])
g_iLastSpawnIndex[pPlayer] = iRand

return true
}

if(iRand++ > g_iTotalPoints) {
iRand = random(g_iTotalPoints)
}

} while(iAttempts <= g_iTotalPoints)

return false
}

bool:CheckDistance(const pPlayer, const Float:vecOrigin[coord_e])
{
new pEntity = NULLENT
while((pEntity = FIND_ENT_IN_SPHERE(pEntity, vecOrigin, MIN_SPAWN_RADIUS)))
{
if(IsPlayer(pEntity) && pEntity != pPlayer && get_entvar(pEntity, var_deadflag) == DEAD_NO) {
// server_print("Client %i fount! skip...", pEntity)
return true
}
}

return false
}

public ShowEditorMenu(const pPlayer)
{
new szMenu[512], Float:vecOrigin[coord_e], bitKeys, iLen
get_entvar(pPlayer, var_origin, vecOrigin)
iLen = formatex(szMenu, charsmax(szMenu), "\yРедактор точек возрождения^n^n")
bitKeys |= g_bNotSaved ? (MENU_KEY_2|MENU_KEY_5|MENU_KEY_6|MENU_KEY_8) : (MENU_KEY_2|MENU_KEY_5|MENU_KEY_6)

if(!IsVectorZero(g_vecLastOrigin[pPlayer])) {
bitKeys |= MENU_KEY_4
}

if(g_pAimedEntity[pPlayer] == NULLENT)
{
iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen,
"%s^n^n\
\y2. \wВыделить текущ. точку возрождения^n\
\d3. Проверка точек возрождения^n\
%s^n^n",
(g_iTotalPoints >= MAX_SPAWNS) ? "\d1. Достигнут максим. лимит \w(\rточек возрождения\w)" : "\y1. \wДобавить точку возрождения",

!IsVectorZero(g_vecLastOrigin[pPlayer]) ? "\y4. \wОтменить удаление" : "\d4. Удалить текущую точку возрождения"
)

bitKeys |= (g_iTotalPoints >= MAX_SPAWNS) ? 0 : MENU_KEY_1
}
else
{
iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen,
"\y1. \wИзменить текущую точку возрождения^n^n\
\y2. \wСнять выделение с текущей точки возрождения^n\
\y3. \wПроверка текущей точки возрождения^n\
\y4. %s^n^n",
!IsVectorZero(g_vecLastOrigin[pPlayer]) ? "\wОтменить удаление" : "\rУдалить текущ. точку возрождения"
)

bitKeys |= (MENU_KEY_1|MENU_KEY_3|MENU_KEY_4)
}

iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen,
"\y5. \wПоказать статистику^n\
\y6. \wГравитация: \y%0.2f^n^n\
%s^n", g_flGravityValues[g_iGravity],
g_bNotSaved ? "\y8. \wСохранить" : "\d8. Сохранить"
)

formatex(szMenu[iLen], charsmax(szMenu) - iLen,
"^n\wВсего точек: \y%d^n\wТекущее положение: \rX \y%0.f \rY \y%0.f \rZ \y%0.f",
g_iTotalPoints, vecOrigin[X], vecOrigin[Y], vecOrigin[Z]
)

show_menu(pPlayer, bitKeys, szMenu, .title = g_szEditorMenuTitle)
return PLUGIN_HANDLED
}

public EditorMenuHandler(const pPlayer, iKey)
{
if(!g_bEditSpawns)
return PLUGIN_HANDLED

iKey++
switch(iKey)
{
case 1: {
g_bNotSaved = bool:(g_pAimedEntity[pPlayer] == NULLENT ? AddSpawn(pPlayer) : MoveSpawn(pPlayer, g_pAimedEntity[pPlayer]))
g_vecLastOrigin[pPlayer][X] = g_vecLastOrigin[pPlayer][Y] = g_vecLastOrigin[pPlayer][Z] = 0.0
}
case 2:
{
if(g_pAimedEntity[pPlayer] == NULLENT)
{
if(!SetAimedEntity(pPlayer)) {
client_print(pPlayer, print_center, "Нет выделенных точек возрождения!")
}
}
else
{
ClearAimedEntity(pPlayer)
// SetAimedEntity(pPlayer)
}
}
case 3: TeleportToAimed(pPlayer, g_pAimedEntity[pPlayer])
case 4:
{
g_bNotSaved = bool:(IsVectorZero(g_vecLastOrigin[pPlayer]) ? DeleteSpawn(pPlayer, g_pAimedEntity[pPlayer]) : AddSpawn(pPlayer, true))
}
case 5:
{
new Float:vecOrigin[coord_e]
get_entvar(pPlayer, var_origin, vecOrigin)

client_print_color(pPlayer, print_team_grey,
"Всего точек: ^3%d^1, ^3Текущее положение^1: ^3X ^4%0.f ^3Y ^4%0.f ^3Z ^4%0.f",
g_iTotalPoints, vecOrigin[X], vecOrigin[Y], vecOrigin[Z])
}
case 6:
{
if(g_iGravity++ >= sizeof(g_flGravityValues)-1)
g_iGravity = 0

set_entvar(pPlayer, var_gravity, g_flGravityValues[g_iGravity])
}
case 8:
{
static const szResultPrint[][] = {"Failed to create file!^rPlease try again!", "Успешно сохранено!", "File deleted"}
client_print(pPlayer, print_center, "%s", szResultPrint[SavePoints()])
}
}

return ShowEditorMenu(pPlayer)
}

bool:AddSpawn(const pPlayer, bool:bUndo = false)
{
new Float:vecOrigin[coord_e], Float:vecAngles[coord_e], Float:vecVAngles[coord_e], pEntity = NULLENT

if((pEntity = CreateEntity()) == NULLENT)
return false

if(bUndo)
{
SetPosition(pEntity, g_vecLastOrigin[pPlayer], g_vecLastAngles[pPlayer], g_vecLastVAngles[pPlayer])
SetAimedEntity(pPlayer, pEntity, false)
}
else
{
GetPosition(pPlayer, vecOrigin, vecAngles, vecVAngles)
vecOrigin[Z] += ADD_Z_POSITION

if(!IsFreeSpace(pPlayer, vecOrigin))
return false

SetPosition(pEntity, vecOrigin, vecAngles, vecVAngles)
}

min(g_iTotalPoints++, MAX_SPAWNS)

return true
}

bool:MoveSpawn(const pPlayer, const pEntity = NULLENT)
{
new Float:vecOrigin[coord_e], Float:vecAngles[coord_e], Float:vecVAngles[coord_e]
GetPosition(pPlayer, vecOrigin, vecAngles, vecVAngles)
vecOrigin[Z] += ADD_Z_POSITION

if(IsFreeSpace(pPlayer, vecOrigin))
{
SetPosition(pEntity, vecOrigin, vecAngles, vecVAngles)
return true
}

return false
}

bool:DeleteSpawn(const pPlayer, const pEntity = NULLENT)
{
if(is_nullent(pEntity))
return false

GetPosition(pEntity, g_vecLastOrigin[pPlayer], g_vecLastAngles[pPlayer], g_vecLastVAngles[pPlayer])

g_pAimedEntity[pPlayer] = NULLENT
REMOVE_ENTITY(pEntity)
max(0, g_iTotalPoints--)

return true
}

bool:TeleportToAimed(const pPlayer, const pEntity = NULLENT)
{
if(pEntity == NULLENT)
return false

new Float:vecOrigin[coord_e], Float:vecAngles[coord_e], Float:vecVAngles[coord_e]
GetPosition(pEntity, vecOrigin, vecAngles, vecVAngles)

if(IsFreeSpace(pPlayer, vecOrigin))
{
SetPlayerPosition(pPlayer, vecOrigin, vecVAngles)
return true
}

return false
}

LoadPoints()
{
new pFile
if(!(pFile = fopen(g_szSpawnFile, "rt")))
{
server_print("[CSDM] No spawn points file found ^"%s^"", g_szMapName)
return
}

new szDatas[MAX_LINE_LEN], szOrigin[coord_e][6], szTeam[3], szAngles[coord_e][6], szVAngles[coord_e][6]
while(!feof(pFile))
{
fgets(pFile, szDatas, charsmax(szDatas))
trim(szDatas)

if(!szDatas[0] || IsCommentLine(szDatas))
continue

if(parse(szDatas,
szOrigin[X], 5, szOrigin[Y], 5, szOrigin[Z], 5,
szAngles[X], 5, szAngles[Y], 5, szAngles[Z], 5,
szTeam, charsmax(szTeam), // ignore team param 7
szVAngles[X], 5, szVAngles[Y], 5, szVAngles[Z], 5
) != 10)
{
continue // ignore invalid lines
}

if(g_iTotalPoints >= MAX_SPAWNS)
{
server_print("[CSDM] Max limit %d reached!", MAX_SPAWNS)
break
}

g_vecSpotOrigin[g_iTotalPoints][X] = str_to_float(szOrigin[X])
g_vecSpotOrigin[g_iTotalPoints][Y] = str_to_float(szOrigin[Y])
g_vecSpotOrigin[g_iTotalPoints][Z] = str_to_float(szOrigin[Z])

g_vecSpotAngles[g_iTotalPoints][X] = str_to_float(szAngles[X])
g_vecSpotAngles[g_iTotalPoints][Y] = str_to_float(szAngles[Y])
// g_vecSpotAngles[g_iTotalPoints][Z] = str_to_float(szAngles[Z])

g_vecSpotVAngles[g_iTotalPoints][X] = str_to_float(szVAngles[X])
g_vecSpotVAngles[g_iTotalPoints][Y] = str_to_float(szVAngles[Y])
// g_vecSpotVAngles[g_iTotalPoints][Z] = str_to_float(szVAngles[Z])

g_iTotalPoints++
}
if(g_iTotalPoints)
{
server_print("[CSDM] Loaded %d spawn points for map ^"%s^"", g_iTotalPoints, g_szMapName)
EnableHookChain(g_hGetPlayerSpawnSpot)
}

fclose(pFile)
}

SavePoints()
{
if(!g_iTotalPoints)
{
delete_file(g_szSpawnFile)
DisableHookChain(g_hGetPlayerSpawnSpot)
return FILE_DELETED
}

new pFile, pEntity = NULLENT
if(!(pFile = fopen(g_szSpawnFile, "wt")))
{
MakeDir(g_szSpawnDirectory, false)
return FAILED_CREATE
}

fprintf(pFile, "// File generated by ^"CSDM Spawn Manager^" Version: %s^n// Total spawns: %d^n^n", CSDM_VERSION_STRING, g_iTotalPoints)
ClearAllArrays()

while((pEntity = rg_find_ent_by_class(pEntity, g_szClassName)))
{
if(g_iTotalPoints >= MAX_SPAWNS)
{
server_print("[CSDM] Max limit %d reached!", MAX_SPAWNS)
break
}

GetPosition(pEntity, g_vecSpotOrigin[g_iTotalPoints], g_vecSpotAngles[g_iTotalPoints], g_vecSpotVAngles[g_iTotalPoints])
if(IsVectorZero(g_vecSpotOrigin[g_iTotalPoints]))
continue

fprintf(pFile,
"%-6.f %-6.f %-6.f %-4.f %-5.f %-2.f %-2.1d %-4.f %-5.f %-1.f^n",
g_vecSpotOrigin[g_iTotalPoints][X], g_vecSpotOrigin[g_iTotalPoints][Y], g_vecSpotOrigin[g_iTotalPoints][Z],
g_vecSpotAngles[g_iTotalPoints][X], g_vecSpotAngles[g_iTotalPoints][Y], g_vecSpotAngles[g_iTotalPoints][Z],
0, // ignore team param 7
g_vecSpotVAngles[g_iTotalPoints][X], g_vecSpotVAngles[g_iTotalPoints][Y], g_vecSpotVAngles[g_iTotalPoints][Z]
)

g_iTotalPoints++
}

if(g_iTotalPoints)
EnableHookChain(g_hGetPlayerSpawnSpot)
else
DisableHookChain(g_hGetPlayerSpawnSpot)

g_bNotSaved = false
fclose(pFile)

return FILE_SAVED
}

MakeAllSpotEntitys()
{
if(!g_iTotalPoints)
return

for(new i = 0; i < MAX_SPAWNS; i++)
{
if(IsVectorZero(g_vecSpotOrigin[i]))
continue

SetPosition(CreateEntity(), g_vecSpotOrigin[i], g_vecSpotAngles[i], g_vecSpotVAngles[i])
}
}

RemoveAllSpotEntitys()
{
new pEntity = NULLENT
ArraySet(g_pAimedEntity, NULLENT)
while((pEntity = rg_find_ent_by_class(pEntity, g_szClassName)))
{
REMOVE_ENTITY(pEntity)
}
}

CreateEntity()
{
new pEntity = rg_create_entity("info_target")
if(is_nullent(pEntity))
{
server_print("Failed to create entity")
return NULLENT
}

set_entvar(pEntity, var_classname, g_szClassName)
SET_MODEL(pEntity, g_szModel)
// SET_SIZE(pEntity, VECTOR_ZERO, VECTOR_ZERO)
set_entvar(pEntity, var_solid, SOLID_SLIDEBOX)

rg_animate_entity(pEntity, ACT_IDLE)

return pEntity
}

SetPlayerPosition(const pPlayer, const Float:vecOrigin[coord_e], const Float:vecAngles[coord_e])
{
SET_ORIGIN(pPlayer, vecOrigin)
set_entvar(pPlayer, var_velocity, VECTOR_ZERO)
set_entvar(pPlayer, var_v_angle, VECTOR_ZERO)
set_entvar(pPlayer, var_angles, vecAngles)
set_entvar(pPlayer, var_punchangle, VECTOR_ZERO)
set_entvar(pPlayer, var_fixangle, FORCE_VIEW_ANGLES)
}

SetPosition(const pEntity, const Float:vecOrigin[coord_e], const Float:vecAngles[coord_e], const Float:vecVAngles[coord_e])
{
if(pEntity != NULLENT)
{
SET_ORIGIN(pEntity, vecOrigin)
set_entvar(pEntity, var_angles, vecAngles)
set_entvar(pEntity, var_v_angle, vecVAngles) // temporary save
}
}

GetPosition(const pEntity, Float:vecOrigin[coord_e], Float:vecAngles[coord_e], Float:vecVAngles[coord_e])
{
get_entvar(pEntity, var_origin, vecOrigin)
get_entvar(pEntity, var_angles, vecAngles)
get_entvar(pEntity, var_v_angle, vecVAngles)
}

bool:SetAimedEntity(const pPlayer, pEntity = NULLENT, bool:bPrint = true)
{
if(pEntity > 0 || (pEntity = FindEntityByAim(pPlayer)) != NULLENT)
{
rg_animate_entity(pEntity, ACT_RUN, 1.0)
rg_set_rendering(pEntity, kRenderFxGlowShell, Vector(0, 250, 0), 20.0)

g_pAimedEntity[pPlayer] = pEntity
if(bPrint) {
client_print(pPlayer, print_center, "Количество entity объектов: %d", g_pAimedEntity[pPlayer])
}

g_vecLastOrigin[pPlayer][X] = g_vecLastOrigin[pPlayer][Y] = g_vecLastOrigin[pPlayer][Z] = 0.0

return true
}

return false
}

ClearAimedEntity(const pPlayer)
{
rg_animate_entity(g_pAimedEntity[pPlayer], ACT_IDLE)
rg_set_rendering(g_pAimedEntity[pPlayer])
g_pAimedEntity[pPlayer] = NULLENT
}

ClearAllArrays()
{
g_iTotalPoints = 0
for(new i = 0; i < MAX_SPAWNS; i++)
{
g_vecSpotOrigin[i][X] = g_vecSpotOrigin[i][Y] = g_vecSpotOrigin[i][Z] = 0.0
g_vecSpotVAngles[i][X] = g_vecSpotVAngles[i][Y] = g_vecSpotVAngles[i][Z] = 0.0
g_vecSpotAngles[i][X] = g_vecSpotAngles[i][Y] = g_vecSpotAngles[i][Z] = 0.0
}
}

CloseOpenedMenu(const pPlayer)
{
new iMenuID, iKeys
get_user_menu(pPlayer, iMenuID, iKeys)
if(iMenuID == g_iEditorMenuID)
{
menu_cancel(pPlayer)
show_menu(pPlayer, 0, "^n", 1)
}
}

stock rg_animate_entity(const pEntity, const Activity:iSequence, const Float:flFramerate = 0.0)
{
set_entvar(pEntity, var_sequence, iSequence)
set_entvar(pEntity, var_framerate, flFramerate)
}

stock FindEntityByAim(const pPlayer)
{
new pEntity = NULLENT, dummy

SetEntitysSolid(true)
get_user_aiming(pPlayer, pEntity, dummy, MAX_SEARCH_DISTANCE)
SetEntitysSolid(false)

return (FClassnameIs(pEntity, g_szClassName)) ? pEntity : NULLENT
}

SetEntitysSolid(const bool:bSolid)
{
new pEntity = NULLENT
while((pEntity = rg_find_ent_by_class(pEntity, g_szClassName)))
{
if(!bSolid)
SET_SIZE(pEntity, VECTOR_ZERO, VECTOR_ZERO)
else
SET_SIZE(pEntity, Vector(-16, -16, -36), Vector(16, 16, 36))
}
}

bool:IsFreeSpace(const pPlayer, const Float:vecOrigin[coord_e])
{
if(!IsHullVacant(vecOrigin, HULL_HUMAN, DONT_IGNORE_MONSTERS, pPlayer))
{
client_print(pPlayer, print_center, "Нет выделенных точек возрождения!")
return false
}

return true
}

// checks if a space is vacant, by VEN
stock bool:IsHullVacant(const Float:vecOrigin[coord_e], const iHullNumber, const fNoMonsters, pSkipEnt = 0)
{
new ptr
engfunc(EngFunc_TraceHull, vecOrigin, vecOrigin, fNoMonsters, iHullNumber, pSkipEnt, ptr)

return bool:(!get_tr2(ptr, TR_StartSolid) && !get_tr2(ptr, TR_AllSolid) && get_tr2(ptr, TR_InOpen))
}
Прочитал в теме такую же ошибку но так и не понял что и куда :dntknw: https://dev-cs.ru/threads/121/post-11036 я так понял это указывает границу спавнов на карте если так то мне нужно её опустить?. Поправите если что.
P.S сипет ошибки только на de_inferno и там спавнов как раз 64
 
В этой теме было размещено решение! Перейти к решению.
Последнее редактирование:

Ayk

Сообщения
173
Реакции
113
const MAX_SPAWNS = 64
Увеличь значение.
 
Сообщения
283
Реакции
31
Ayk, спасибо большое за ответ. Я уже потом только догадался.
 
Статус
В этой теме нельзя размещать новые ответы.

Пользователи, просматривающие эту тему

Сейчас на форуме нет ни одного пользователя.
Сверху Снизу