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

edge detection


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
abckrieger
Senior Member
Join Date: Oct 2012
Location: Germany
Old 08-09-2013 , 13:48   edge detection
Reply With Quote #1

hello,

i got another problem which i've been trying to fix for several hours now.
the problem is about jumping and calculation of the distances (bhop or longjump)
the method WallTouch must detect when a player touches a wall (not the ground) while he is jumping. (Surfing would falsify the results..)

that works but...
the method detects sometimes a edge as a wall on landing.. that shouldnt be
is a player not detected as onground in the first msecs when he hits a edge?

thx 4 help

Code:
public OnEntityCreated(iEntity, const String:classname[]) 
{
    if(StrEqual(classname, "player")) 
    {    
        SDKHook(iEntity, SDKHook_StartTouch, WallTouch);
    }
}
//here lies the problem
public WallTouch(iPlayer, iEntity) 
{
    if (iEntity==0)
    if (GetEntityFlags(iEntity) & FL_ONGROUND)
    {
    }
        else
            g_bCheckSurf[iPlayer]=true;
}

public Action:OnPlayerRunCmd(client, &buttons)
{
    if (IsPlayerAlive(client) && IsClientInGame(client))
    {      
            //COUNT GROUND FRAME
            if (playersArray[client][p_Jumped] == false &&  GetEntityFlags(client) & FL_ONGROUND && ((buttons &  IN_MOVERIGHT) || (buttons & IN_MOVELEFT) || (buttons & IN_BACK)  || (buttons & IN_FORWARD)))
                g_ground_frames[client]++;
            
                
            //SURF_PROTECTION (
            if (g_bCheckSurf[client] == true && playersArray[client][p_Jumped] == true)
            {    
                    playersArray[client][p_Jumped] = false;
                    g_bCheckSurf[client] = false;
                    return Plugin_Continue;
            }
.............

Last edited by abckrieger; 08-09-2013 at 14:09.
abckrieger is offline
Glite
Senior Member
Join Date: Sep 2011
Location: Ukraine
Old 08-10-2013 , 03:35   Re: edge detection
Reply With Quote #2

PHP Code:
public OnClientPutInServer(client)
{
    
SDKHook(clientSDKHook_TouchOnTouch); //Or StartTouch
}


public 
OnTouch(clientother)
{
    if ((
<= client <= MaxClients) && !(GetEntityFlags(client) & FL_ONGROUND))
    {
        
g_bCheckSurf[client] = true;
    }

    if ((
<= other <= MaxClients) && !(GetEntityFlags(other) & FL_ONGROUND))
    {
        
g_bCheckSurf[other] = true;
    }


Last edited by Glite; 08-10-2013 at 03:37.
Glite is offline
Glite
Senior Member
Join Date: Sep 2011
Location: Ukraine
Old 08-10-2013 , 03:44   Re: edge detection
Reply With Quote #3

Also you need to check if player not on ground and was not on ground in previous frame on OnPlayerRunCmd before checking surfing.

Last edited by Glite; 08-10-2013 at 03:45.
Glite is offline
abckrieger
Senior Member
Join Date: Oct 2012
Location: Germany
Old 08-11-2013 , 09:10   Re: edge detection
Reply With Quote #4

okay, thx u :-)
working now
abckrieger is offline
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 18:26.


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