AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Hey (https://forums.alliedmods.net/showthread.php?t=255136)

Kazalu 01-11-2015 05:29

Hey
 
How can I compare a player's coordinates to some already defined coordinates?

zmd94 01-11-2015 06:08

Re: Hey
 
Maybe this code can help:

https://forums.alliedmods.net/showpo...&postcount=551

Kazalu 01-11-2015 06:15

Re: Hey
 
Did not really help tbh :(

Syturi0 01-11-2015 07:33

Re: Hey
 
Lets say i want to make a "cube zone" in my map by coords, and when players enter inside of that "cube zone", it execs a command. Thats what he meant.

HamletEagle 01-11-2015 08:52

Re: Hey
 
Use this to check if an ent is inside of another ent.

iFirstIndex should be the player index if it's about your exmaple and iSecondIndex the cube zone index.
PHP Code:

stock boolEntInsideEntiFirstIndexiSecondIndex)
{
    new  
FloatfEntMin    ];  peviFirstIndexpev_absminfEntMin )
    new  
FloatfEntMax    ];  peviFirstIndexpev_absmaxfEntMax )
    new  
FloatfTargetMin    ];  peviSecondIndexpev_absminfTargetMin )
    new  
FloatfTargetMax    ];  peviSecondIndexpev_absmaxfTargetMax )
    new  
Floatv_fDistance    ]

    for( new 
i3i++ )
    {
        if( 
fEntMin] > fTargetMax] )
        {
            
v_fDistance] = fEntMin] - fTargetMax]
        }
        
        else if( 
fTargetMin] > fEntMax] )
        {
            
v_fDistance] = fTargetMin] - fEntMax]
        }
    }
    
    if( 
vector_lengthv_fDistance ) )
    {
        return 
false
    
}
    
    else
    {
        return 
true 
    
}
    
    return 
false



Kazalu 01-11-2015 10:44

Re: Hey
 
What if I want to compare the object's coordinates with some numeral coordinates?

Like coord[ 1 ] <= 529345095 bla bla bla

HamletEagle 01-11-2015 14:09

Re: Hey
 
Quote:

Originally Posted by Kazalu (Post 2247809)
What if I want to compare the object's coordinates with some numeral coordinates?

Like coord[ 1 ] <= 529345095 bla bla bla

Then get them and compare.

Kazalu 01-12-2015 06:49

Re: Hey
 
I did, seems to be bugged.I print out the coords.Then copy paste them into the code.I even take some error margins to be sure.Not working at all.

HamletEagle 01-12-2015 12:45

Re: Hey
 
Show us what you did, in this context words are = 0.

Syturi0 01-12-2015 13:07

Re: Hey
 
Quote:

Originally Posted by HamletEagle (Post 2248322)
Show us what you did, in this context words are = 0.

PHP Code:

public Messagecount )
{
    new 
Players[32
    new 
playerCountiid 
    get_players
(PlayersplayerCount"c"
    for (
i=0i<playerCounti++) 
    {
        
id Players[i
        
now get_gametime()
        
show floatroundCOOLDOWN ) - floatroundnow ) + floatroundthen )
        new 
FloatvecOrigin]
        
pev(idpev_originvecOrigin)
        if( 
vecOrigin] >= -1012797890 && vecOrigin] <= -1005540167 && vecOrigin] >=  1161517179 && vecOrigin] <= 1162705220 && vecOrigin] >= 1142000000 && vecOrigin] <= 1143000000 )
        {
            
client_print(idprint_center"%d"show )
        }
    }




All times are GMT -4. The time now is 15:28.

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