Raised This Month: $ Target: $400
 0% 

Solved Player "not in-game" at Ham_Spawn (post) on lastest 1.9 but working on 1.8.2


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Th3822
Member
Join Date: Jan 2013
Location: Venezuela
Old 09-11-2019 , 23:20   Player "not in-game" at Ham_Spawn (post) on lastest 1.9 but working on 1.8.2
Reply With Quote #1

While testing this plugin:
PHP Code:
#include <amxmodx>
#include <engine>
#include <hamsandwich>

// random_mod(max): A small function to give a random number from 0 to max-1. Useful for get random values from arrays
#define random_mod(%1) (random_num(0, (100 * (%1)) - 1) % (%1))

new Array:g_aSpawnOrigins, Array:g_aSpawnAngles;
new 
g_iSpawnsCount;

public 
plugin_init()
{
    
register_plugin("[HL] Random Spawn Sort""1.0""Th3-822");

    
g_aSpawnOrigins ArrayCreate(3);
    
g_aSpawnAngles ArrayCreate(3);
}

public 
plugin_cfg()
{
    
loadSpawns();

    if (
g_iSpawnsCount 1)
    {
        
RegisterHam(Ham_Spawn"player""Ham_Player_Spawn_Post"1);
    }
}

loadSpawns()
{
    new 
iEnt get_maxplayers(), Float:fVector[3];
    while ((
iEnt find_ent_by_class(iEnt"info_player_deathmatch")))
    {
        
entity_get_vector(iEntEV_VEC_originfVector);
        
ArrayPushArray(g_aSpawnOriginsfVector);

        
entity_get_vector(iEntEV_VEC_anglesfVector);
        
ArrayPushArray(g_aSpawnAnglesfVector);

        
g_iSpawnsCount++;
    }
}

is_spawn_valid(idFloat:vOrigin[3])
{
    return (
trace_hull(vOrigin, (get_user_flags(id) & FL_DUCKING HULL_HEAD HULL_HUMAN), idDONT_IGNORE_MONSTERS) & 2) ? 1;
}

public 
Ham_Player_Spawn_Post(id)
{
    
//if (is_user_alive(id))
    //{
    
new iRandomSpawn random_mod(g_iSpawnsCount), Float:fVector[3];
    
entity_get_vector(idEV_VEC_originfVector);
    
server_print(" * Player %i spawned @ {%.2f, %.2f, %.2f} : is_user_alive = %i*"idfVector[0], fVector[1], fVector[2], is_user_alive(id));

    
ArrayGetArray(g_aSpawnOriginsiRandomSpawnfVector);
    if (
is_spawn_valid(idfVector))
    {
        
entity_set_origin(idfVector);

        
ArrayGetArray(g_aSpawnAnglesiRandomSpawnfVector);
        
entity_set_vector(idEV_VEC_anglesfVector);
        
entity_set_int(idEV_INT_fixangle1);

        return 
HAM_HANDLED;
    }
    
//}
    
return HAM_IGNORED;

Got the following error while running it on 1.9.0.5249 (Windows):
Code:
[ENGINE] Invalid player 1 (not in-game)
[AMXX] Displaying debug trace (plugin "hl_random_spawn_sort.amxx", version "1.0")
[AMXX] Run time error 10: native error (native "trace_hull")
[AMXX]    [0] hl_random_spawn_sort.sma::is_spawn_valid (line 46)
[AMXX]    [1] hl_random_spawn_sort.sma::Ham_Player_Spawn_Post (line 58)
but on 1.8.2 the same plugin works fine, this happens on the first spawn when i join to the server
here are pictures from the console (i was using rehlds when i got the error, so i did had to switch to vanilla hlds to test too)

(Win) HLDS (8196) & AMXX v1.9.0.5249:

(Win) HLDS (8196) & AMXX v1.8.2:


(Win) reHLDS (3.6.0.672-dev) & AMXX v1.9.0.5249:

(Win) reHLDS (3.6.0.672-dev) & AMXX v1.8.2:


the hlds build is a couple of months old (too lazy to update it), but the issue gets noticed on the images with the server version and meta dll too (also tested with other metamod with the same)

also, i wasn't expecting is_user_alive returning 0 in Ham_Spawn_Post, but, as the result is the same as 1.9.0, i will do a workaround for it

--- Edit 1 ---

Forgot to add that, on the 1.9.0 tests, i tested both plugins: Compiled with 1.9.0 and with 1.8.2 and the issue was present on both cases (just in case)

--- Edit 2 ---

Got to test on a linux server too (just with reHLDS 3.7.0.687-dev) and it was the same result

(Linux) reHLDS (3.7.0.687-dev) & AMXX v1.9.0.5249:

(Linux) reHLDS (3.7.0.6872-dev) & AMXX v1.8.2:


--- Edit 3 ---

Solved, the issue was on 1.8.2, more info: https://forums.alliedmods.net/showpo...87&postcount=5
If anybody wants to use the plugin, apply the workaround on the post and uncomment the "if" block

Last edited by Th3822; 09-12-2019 at 22:17. Reason: Solved
Th3822 is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 17:29.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode