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

how slowly tilt the screen


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
NagarD
Junior Member
Join Date: Jun 2011
Old 01-19-2014 , 08:35   how slowly tilt the screen
Reply With Quote #1

Hi people.
i have code :

PHP Code:
new Float:vec[3];
vec[0] = 0.0;
vec[1] = 0.0;
vec[2] = -5.0;
SetEntPropVector(clientProp_Send"m_vecPunchAngle"vec); 
This code very fast tilt screen left. How to slowly tilt screen?
sorry for my bad english language. Thanks.

Last edited by NagarD; 01-19-2014 at 08:38.
NagarD is offline
Static2601
Senior Member
Join Date: Jun 2010
Old 01-19-2014 , 13:21   Re: how slowly tilt the screen
Reply With Quote #2

I think you want to do something that runs the code over and over, increasing or decreasing the vec[2] by x amount (maybe 0.01). I wrote some code to show this but it wasnt working that well. It tilted, slowly but was not how it should be done and was also buggy. I Also can't get the vec[2] to stay at -5, it just snaps back to 0.0.
Static2601 is offline
Static2601
Senior Member
Join Date: Jun 2010
Old 01-19-2014 , 14:35   Re: how slowly tilt the screen
Reply With Quote #3

Ok, I changed it is from what you had and made it tilt, here's the whole thing, not sure if its what you were looking for...
PHP Code:
/* Plugin Template generated by Pawn Studio */
#include <sdktools>
#include <sourcemod>

public Plugin:myinfo 
{
    
name "New Plugin",
    
author "Unknown",
    
description "<- Description ->",
    
version "1.0",
    
url "<- URL ->"
}

public 
OnPluginStart()
{
    
RegConsoleCmd("sm_tilt"TiltToggle);
}
new 
bool:bIsTiltEnabled false;
public 
Action:TiltToggle(clientargs)
{
    if(
bIsTiltEnabled == false)
    {
        
bIsTiltEnabled true;
        
PrintToChat(client"Tilt On");
    }else
    {
        
bIsTiltEnabled false;
        
PrintToChat(client"Tilt Off");
    }
    return 
Plugin_Handled;
}
public 
OnGameFrame()
{
    for(new 
i=1;i<MaxClients;i++)
    {    
        if(
bIsTiltEnabled == true)
        {
            if(
IsValidEntity(i))
            {
                new 
Float:angles[3];
                
GetClientEyeAngles(iangles);
                
//angles[0] = 0.0;
                //angles[1] = 0.0;
                
angles[2] -= 0.05;
                
TeleportEntity(iNULL_VECTORanglesNULL_VECTOR);
                
                if(
angles[2] <= -5.0)
                {
                    
bIsTiltEnabled false;
                }
            }
        }
    }

The player's angles pitch and yaw get stuck for some reason while its rolling. Also, OnGameFrame might be better as a timer.
Static2601 is offline
NagarD
Junior Member
Join Date: Jun 2011
Old 01-21-2014 , 13:08   Re: how slowly tilt the screen
Reply With Quote #4

Static2601, thanks, I needed to this effect.
NagarD is offline
Mitchell
~lick~
Join Date: Mar 2010
Old 01-21-2014 , 13:24   Re: how slowly tilt the screen
Reply With Quote #5

Client's view angle cannot go beyond a certain angle. i know that, it just stops so a complete barrel roll is impossible. (to an extent, to which secret don't make friends )

Last edited by Mitchell; 01-21-2014 at 13:25.
Mitchell is offline
blodia
Veteran Member
Join Date: Sep 2009
Location: UK
Old 01-21-2014 , 16:47   Re: how slowly tilt the screen
Reply With Quote #6

m_vecPunchAngle isn't clamped on pitch so i may not be clamped on yaw or roll either, as the name suggests the view is punched to what ever angle its set to then slowly reverts back to its initial state.

OnGameFrame eeeeeewwwwwww, use OnPlayerRunCmd as it runs on every client every gameframe so no need for loops or to check if the client is valid, it also has the players angles so no need to grab them separately if you're not using m_vecPunchAngle.

Last edited by blodia; 01-21-2014 at 16:49.
blodia 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 21:04.


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