Raised This Month: $32 Target: $400
 8% 

Solved Max Z Stock


Post New Thread Reply   
 
Thread Tools Display Modes
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 07-13-2018 , 19:19   Re: Max Z Stock
Reply With Quote #11

In util.cpp. Half-life 1 or ReGameDLL source code.
__________________








CrazY. is offline
Ghosted
Veteran Member
Join Date: Apr 2015
Location: Georgia
Old 07-14-2018 , 03:05   Re: Max Z Stock
Reply With Quote #12

Quote:
Originally Posted by edon1337 View Post
Do you even read what I write or you just post unknowingly? I basically just stated that I'm aware you can't assign values as in C++ here in Pawn and that we need to go through both of the arrays dimensions at the same time and assign values.

PHP Code:
public MyFunction( )
{
    new 
aArray], bArray];
    
MixArraysaArraybArray );
}

MixArraysaArray[ ], bArray[ ] )
{
    for( new 
i3i++ )
    {
        
aArray] = bArray];
    }

I helped in ur previous post and now u posted a thing that also is connected to my post and you say what are you posting. Are you...?
__________________

[MOD] CS Weapon Mod V1.7.1
[MM] MetaMod-C V1.0
[MOD] CS NPC Mod (5%)


Probably Left AM
Ghosted is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 07-14-2018 , 04:25   Re: Max Z Stock
Reply With Quote #13

Quote:
Originally Posted by edon1337 View Post
Do you even read what I write or you just post unknowingly? I basically just stated that I'm aware you can't assign values as in C++ here in Pawn and that we need to go through both of the arrays dimensions at the same time and assign values.

PHP Code:
public MyFunction( )
{
    new 
aArray], bArray];
    
MixArraysaArraybArray );
}

MixArraysaArray[ ], bArray[ ] )
{
    for( new 
i3i++ )
    {
        
aArray] = bArray];
    }

He actually gave you a good answer(except the fact that you can't assign array to array, which you can if they have the same size).
__________________

Last edited by HamletEagle; 07-14-2018 at 04:27.
HamletEagle is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 07-15-2018 , 11:26   Re: Max Z Stock
Reply With Quote #14

I may be misunderstanding what you're trying to do but if you go up outside of the boundaries of the map or a wall you run into CONTENTS_SOLID. This will find the max Z where a player can exist without being stuck. Not thoroughly tested.

PHP Code:
#include <amxmodx>
#include <fakemeta>

//#define CONTENTS_EMPTY                  -1
//#define CONTENTS_SOLID                  -2
//#define CONTENTS_SKY                    -6

public plugin_init() 
{
    
register_clcmd"say a" "Test");
}

public 
Testid )
{
    new 
Float:fOrigin];
    
    
pevid pev_origin fOrigin );
    
    
fOrigin] = GetMaxHeightid );
    
    
set_pevid pev_origin fOrigin );
}

public 
Float:GetMaxHeightid 

    new 
Float:fOrigin] , pcCurrent;
    
    
pevid pev_origin fOrigin ); 
    
    while ( 
engfuncEngFunc_PointContents fOrigin ) == CONTENTS_EMPTY )
    {
        
fOrigin] += 5.0
    }
    
    
pcCurrent engfuncEngFunc_PointContents fOrigin ); 

    return ( ( 
pcCurrent == CONTENTS_SKY ) || ( pcCurrent == CONTENTS_SOLID ) ) ? fOrigin] - 75.0 fOrigin];

__________________

Last edited by Bugsy; 07-15-2018 at 12:22.
Bugsy is offline
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 07-15-2018 , 12:15   Re: Max Z Stock
Reply With Quote #15

Quote:
Originally Posted by Bugsy View Post
I may be misunderstanding what you're trying to do but if you go up outside of the boundaries of the map or a wall you run into CONTENTS_SOLID. This will find the max Z where a player can exist without being stuck. Not thoroughly tested.

PHP Code:
#include <amxmodx>
#include <fakemeta>

//#define CONTENTS_EMPTY                  -1
//#define CONTENTS_SOLID                  -2
//#define CONTENTS_SKY                    -6

public plugin_init() 
{
    
register_clcmd"say a" "Test");
}

public 
Testid )
{
    new 
Float:fOrigin];
    
    
pevid pev_origin fOrigin );
    
    
fOrigin] = GetMaxHeightid );
    
    
set_pevid pev_origin fOrigin );
}

public 
Float:GetMaxHeightid 

    new 
Float:fOrigin], Float:fDist pcCurrent;
    
    
pevidpev_originfOrigin ); 
    
    
fDist fOrigin]; 
    
    while ( 
engfuncEngFunc_PointContentsfOrigin ) == CONTENTS_EMPTY )
    {
        
fOrigin] += 5.0
    }
    
    
pcCurrent engfuncEngFunc_PointContents fOrigin ); 
    
    if ( ( 
pcCurrent == CONTENTS_SKY ) || ( pcCurrent == CONTENTS_SOLID ) )
    {
        
fDist fOrigin] - 75.0
    }
    
    return 
fDist;

Tested a few times, it spawned me in a glitched area once where I was stuck (not max height) and once on ground.
__________________
edon1337 is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 07-15-2018 , 12:23   Re: Max Z Stock
Reply With Quote #16

I just made a few fixes, try it again. And where exactly are you when it sets you on the ground? For avoiding getting stuck, increase the '- 75' to '- 85'
__________________

Last edited by Bugsy; 07-15-2018 at 12:24.
Bugsy is offline
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 07-15-2018 , 12:27   Re: Max Z Stock
Reply With Quote #17

Ok now I think it's better, I tried ~30 times and never got stuck anywhere or landed on the ground. What do you mean by 'where exactly are you when it sets you on the ground'?
__________________
edon1337 is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 07-15-2018 , 12:28   Re: Max Z Stock
Reply With Quote #18

Quote:
Originally Posted by edon1337 View Post
Ok now I think it's better, I tried ~30 times and never got stuck anywhere or landed on the ground. What do you mean by 'where exactly are you when it sets you on the ground'?
What I meant is are you always standing in the same location on the same map with all of your tests?
__________________
Bugsy is offline
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 07-15-2018 , 12:29   Re: Max Z Stock
Reply With Quote #19

Quote:
Originally Posted by Bugsy View Post
What I meant is are you always standing in the same location on the same map with all of your tests?
No, I'm using Joropito's superspawns which generates random locations.
__________________
edon1337 is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 07-15-2018 , 12:31   Re: Max Z Stock
Reply With Quote #20

Ok, if you notice any issues, try to remember where you were on which map so it can be troubleshooted why you are having an issue. There may be unhandled CONTENTS_ values that will need to be added in the code.
__________________
Bugsy is offline
Reply


Thread Tools
Display Modes

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 18:56.


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