AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   Solved CSS - Is it possible to make a player float above ground? (https://forums.alliedmods.net/showthread.php?t=316372)

blackdevil72 05-20-2019 03:24

CSS - Is it possible to make a player float above ground?
 
Hello!

As the title say I'd like to know is its possible to make a player float above ground. Not "fly", just float X above ground, that mean able to move, jump etc and still be affect by gravity while not touching ground.

I hope I was clear enought, I'm sorry if you need I can try to be more precise.

Thank you for future help!

hleV 05-23-2019 08:01

Re: CSS - Is it possible to make a player float above ground?
 
Perhaps you could create an invisible entity with the height of X underneath the player, and make it solid for that particular player only? Not sure about implementation, just need to play around and test.

blackdevil72 05-23-2019 17:29

Re: CSS - Is it possible to make a player float above ground?
 
The entity would have to move everywhere at the same time as the play player. That seem a bit too much?

I've tried to play with some ideas but that did work:

PHP Code:

public void Make_Player_Foat(int client)
{
    
float ClientPosition[MAXPLAYERS][3]
    
float ClientPreviousHeight[MAXPLAYERS]

    if (
GetClientButtons(client) == IN_JUMP || GetClientButtons(client) == IN_FORWARD || GetClientButtons(client) == IN_BACK || GetClientButtons(client) == IN_MOVELEFT || GetClientButtons(client) == IN_MOVERIGHT && GetEntityMoveType(client) != MOVETYPE_WALK && Global_IsPlayerFreeze[client] == false)
        
SetEntityMoveType(clientMOVETYPE_WALK)

    else if (
GetClientButtons(client) != IN_JUMP || GetClientButtons(client) != IN_FORWARD || GetClientButtons(client) != IN_BACK || GetClientButtons(client) != IN_MOVELEFT || GetClientButtons(client) != IN_MOVERIGHT && GetEntityMoveType(client) != MOVETYPE_NONE && Global_IsPlayerFreeze[client] == false)
    {
        
GetClientAbsOrigin(clientClientPosition[client])

        if (
ClientPreviousHeight[client] != ClientPosition[client][2])
        {
            
ClientPosition[client][2] = ClientPosition[client][2] + Global_ModelHeightFix[client]
            
ClientPreviousHeight[client] = ClientPosition[client][2]

            
TeleportEntity(clientClientPosition[client], NULL_VECTORNULL_VECTOR)
            
SetEntityMoveType(clientMOVETYPE_NONE)
        }
    }

    
Make_Player_Foat(client)


When I do that th eplayer is teleported up to the maximum height. It theory it shouldn't happen. I don't see what I'm doing badly here.

blackdevil72 05-30-2019 21:24

Re: CSS - Is it possible to make a player float above ground?
 
Any one else with an idea?


All times are GMT -4. The time now is 19:46.

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