Raised This Month: $51 Target: $400
 12% 

Think and origin & sizes


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
OnePL
BANNED
Join Date: May 2012
Location: GB
Old 09-26-2018 , 06:18   Think and origin & sizes
Reply With Quote #1

PHP Code:
Coordination (jail_pyramid map):
//maxs
g_fFieldSize[0][0] = -1564.17
g_fFieldSize
[0][1] = -85.03
g_fFieldSize
[0][2] = -313.79

//mins
g_fFieldSize[1][0] = -3090.92
g_fFieldSize
[1][1] = 863.03 
g_fFieldSize
[1][2] = -313.00

//maxs
g_fGoalSize[0][0][0] = -3091.03
g_fGoalSize
[0][0][1] = 484.05
g_fGoalSize
[0][0][2] = -206.05

//mins
g_fGoalSize[0][1][0] = -3091.03
g_fGoalSize
[0][1][1] = 289.15
g_fGoalSize
[0][1][2] = -313.96

//maxs
g_fGoalSize[1][0][0] = -1550.96
g_fGoalSize
[1][0][1] = 290.98
g_fGoalSize
[1][0][2] = -206.05

//mins
g_fGoalSize[1][1][0] = -1550.96
g_fGoalSize
[1][1][1] = 485.64
g_fGoalSize
[1][1][2] = -313.96 
PHP Code:
register_think("ball""BallThink");

public 
BallThink(iEnt) {
    if(!
pev_valid(iEnt)) return;

    static 
Float:vecOrigin[3];
    
pev(iEntpev_originvecOrigin);

    if(
g_fGoalSize[0][1][0] <= vecOrigin[0] <= g_fGoalSize[0][0][0] && g_fGoalSize[0][1][1] <= vecOrigin[1] <= g_fGoalSize[0][0][1] && g_fGoalSize[0][1][2] <= vecOrigin[2] <= g_fGoalSize[0][0][2]) {
        
ballScore(iEnt0);
        return;
    }

    if(
g_fGoalSize[1][1][0] <= vecOrigin[0] <= g_fGoalSize[1][0][0] && g_fGoalSize[1][1][1] <= vecOrigin[1] <= g_fGoalSize[1][0][1] && g_fGoalSize[1][1][2] <= vecOrigin[2] <= g_fGoalSize[1][0][2]) {
        
ballScore(iEnt1);
        return;
    }

    if(!(
g_fFieldSize[0][0] >= vecOrigin[0] >= g_fFieldSize[1][0]) || !(g_fFieldSize[0][1] >= vecOrigin[1] >= g_fFieldSize[1][1])) {
        
set_hudmessage(211211211, -1.00.8206.06.0);
        
show_hudmessage(0"Ball out of bounds!");
    }

Above code does not work, what is wrong?

Last edited by OnePL; 09-26-2018 at 06:19.
OnePL is offline
Send a message via ICQ to OnePL Send a message via AIM to OnePL Send a message via Yahoo to OnePL Send a message via Skype™ to OnePL
Black Rose
Veteran Member
Join Date: Feb 2011
Location: Stockholm, Sweden
Old 09-26-2018 , 15:20   Re: Think and origin & sizes
Reply With Quote #2

Code:
g_fGoalSize[0][0][0] = -3091.03 g_fGoalSize[0][1][0] = -3091.03
Code:
g_fGoalSize[0][1][0] <= vecOrigin[0] <= g_fGoalSize[0][0][0]
or just:
Code:
vecOrigin[0] == g_fGoalSize[0][0][0]
Very thin margins.









Maxs and mins of Y-dimension need to switch places.
Code:
g_fFieldSize[0][1] = -85.03 g_fFieldSize[1][1] = 863.03

Otherwise this comparison is impossible:
Code:
!(g_fFieldSize[0][1] >= vecOrigin[1] >= g_fFieldSize[1][1])

Simple fail safe:
Code:
#define is(%0)between(%1,%2) (min(%1, %2) <= %0 <= max(%1, %2)) ! is(vecOrigin[1])between(g_fFieldSize[0][1], g_fFieldSize[1][1])
__________________

Last edited by Black Rose; 09-28-2018 at 06:53.
Black Rose is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 09-27-2018 , 04:21   Re: Think and origin & sizes
Reply With Quote #3

You have mistakes in the maxs and mins.

Max size should always be greater than its min size.
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !


Last edited by Natsheh; 09-27-2018 at 04:22.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
OnePL
BANNED
Join Date: May 2012
Location: GB
Old 09-27-2018 , 16:36   Re: Think and origin & sizes
Reply With Quote #4

I get maxs and mins:
PHP Code:
    static Float:fStart[3], Float:fEnd[3], Float:fTemp[3];
    
pev(idpev_originfStart);
    
pev(idpev_view_ofsfTemp);

    
fStart[0] += fTemp[0];
    
fStart[1] += fTemp[1];
    
fStart[2] += fTemp[2];

    
pev(idpev_v_anglefTemp);
    
angle_vector(fTempANGLEVECTOR_FORWARDfEnd);

    
fEnd[0] *= 4000.0;
    
fEnd[1] *= 4000.0;
    
fEnd[2] *= 4000.0;

    
fEnd[0] += fStart[0];
    
fEnd[1] += fStart[1];
    
fEnd[2] += fStart[2];

    
engfunc(EngFunc_TraceLinefStartfEndDONT_IGNORE_MONSTERSid0);
    
get_tr2(0TR_vecEndPosfEnd); 
OnePL is offline
Send a message via ICQ to OnePL Send a message via AIM to OnePL Send a message via Yahoo to OnePL Send a message via Skype™ to OnePL
Reply



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 01:03.


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