Raised This Month: $ Target: $400
 0% 

Solved Shake Screen


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
dangerlord63
Senior Member
Join Date: Aug 2011
Old 08-26-2016 , 08:38   Shake Screen
Reply With Quote #1

Hi guys, i have a problem with shake screen

i found some codes and i merged them so i have this code;
PHP Code:

#define    SHAKE_START                    0            // Starts the screen shake for all players within the radius.
#define    SHAKE_STOP                    1            // Stops the screen shake for all players within the radius.
#define    SHAKE_AMPLITUDE                2            // Modifies the amplitude of an active screen shake for all players within the radius.
#define    SHAKE_FREQUENCY                3            // Modifies the frequency of an active screen shake for all players within the radius.
#define    SHAKE_START_RUMBLEONLY        4            // Starts a shake effect that only rumbles the controller, no screen effect.
#define    SHAKE_START_NORUMBLE        5            // Starts a shake that does NOT rumble the controller.
stock ScreenShakeAll(Float:intensity=30.0Float:duration=10.0Float:frequency=3.0){
    for(new 
1;i<=MAXPLAYERS;i++){
        if(!
IsClientInGame(i))
            continue;
        if(!
IsPlayerAlive(i))
            continue;
        
Client_Shake(i,SHAKE_START,intensity,duration,frequency);
    }
}
stock bool:Client_Shake(clientcommand=SHAKE_STARTFloat:amplitude=50.0Float:frequency=150.0Float:duration=3.0){
    new 
Handle:userMessage StartMessageOne("Shake"client);
    if(
userMessage == INVALID_HANDLE)
        return 
false;
    if(
command == SHAKE_STOP)
        
amplitude 0.0;
    else if (
amplitude <= 0.0)
        return 
false;
    
BfWriteByte(userMessage,    command);    // Shake Command
    
BfWriteFloat(userMessage,    amplitude);    // shake magnitude/amplitude
    
BfWriteFloat(userMessage,    frequency);    // shake noise frequency
    
BfWriteFloat(userMessage,    duration);    // shake lasts this long
    
EndMessage();
    return 
true;

I try to execute command like this;
PHP Code:
ScreenShakeAll(20.0,10.0,0.7); 
And then server crash or screen not shaking
Server crash error:
PHP Code:
L 08/26/2016 15:30:50: [SMPlugin encountered error 21Native is not bound
L 08
/26/2016 15:30:50: [SMNative "BfWriteByte" reported
L 08/26/2016 15:30:50: [SMDisplaying call stack trace for plugin "isyanmenu.smx":
L 08/26/2016 15:30:50: [SM]   [0]  Line 209F:\Oyunlar\CSGO\Pluginler\Market *********syan Men*********Yeni\isyanmenu.sp::Client_Shake()
L 08/26/2016 15:30:50: [SM]   [1]  Line 179F:\Oyunlar\CSGO\Pluginler\Market *********syan Men*********Yeni\isyanmenu.sp::ScreenShakeAll()
L 08/26/2016 15:30:50: [SM]   [2]  Line 133F:\Oyunlar\CSGO\Pluginler\Market *********syan Men*********Yeni\isyanmenu.sp::TMenuHandler() 

Last edited by dangerlord63; 08-28-2016 at 03:45.
dangerlord63 is offline
cravenge
Veteran Member
Join Date: Nov 2015
Location: Chocolate Factory
Old 08-27-2016 , 10:29   Re: Shake Screen
Reply With Quote #2

You're using the function incorrectly. By looking at the code and assuming you included the necessary includes, it should not be a boolean because you're calling it, not determining if it's true or false. Rewriting this would be:

PHP Code:
public ScreenShakeAll()

     for (new 
1i<=MaxClientsi++)
     { 
          if (!
IsClientInGame(i) || !IsPlayerAlive(i)) 
          {
                continue;
          }
          
          
ApplyScreenShake(i30.010.03.0); 
     } 


ApplyScreenShake(targetFloat:amplitudeFloat:frequencyFloat:duration)

     new 
Handle:userMessage;
     
userMessage StartMessageOne("Shake"target);
     
     
BfWriteByte(userMessage0); // no need to use 1 if you want it to stop
     
BfWriteFloat(userMessageamplitude);
     
BfWriteFloat(userMessagefrequency);
     
BfWriteFloat(userMessageduration); // just change the value of this variable to 0.0
     
EndMessage();


Last edited by cravenge; 08-27-2016 at 10:30.
cravenge is offline
dangerlord63
Senior Member
Join Date: Aug 2011
Old 08-27-2016 , 19:26   Re: Shake Screen
Reply With Quote #3

Still not working

PHP Code:
L 08/28/2016 02:23:11: [SMPlugin encountered error 21Native is not bound
L 08
/28/2016 02:23:11: [SMNative "BfWriteByte" reported
L 08/28/2016 02:23:11: [SMDisplaying call stack trace for plugin "isyanmenu.smx":
L 08/28/2016 02:23:11: [SM]   [0]  Line 177F:\Oyunlar\CSGO\Pluginler\Market *********syan Men*********Yeni\isyanmenu.sp::ApplyScreenShake()
L 08/28/2016 02:23:11: [SM]   [1]  Line 133F:\Oyunlar\CSGO\Pluginler\Market *********syan Men*********Yeni\isyanmenu.sp::TMenuHandler() 
And after then server crashes.
dangerlord63 is offline
Franc1sco
Veteran Member
Join Date: Oct 2010
Location: Spain (Madrid)
Old 08-27-2016 , 19:38   Re: Shake Screen
Reply With Quote #4

Games like CS:GO use protobuf so try something like this:
PHP Code:
stock players_Fade(clientIndexduration=1000hold=300flags=0x0009color[4]={000255})
{
    new 
Handle:message StartMessageOne("Fade"clientIndexUSERMSG_RELIABLE);
    
PbSetInt(message"duration"duration);
    
PbSetInt(message"hold_time"hold);
    
PbSetInt(message"flags"flags);
    
PbSetColor(message"clr"color);
    
EndMessage();

More info:
https://forums.alliedmods.net/showthread.php?t=250287
__________________
Veteran Coder -> Activity channel
Coding on CS2 and taking paid and free jobs.

Contact: Steam, Telegram or discord ( franug ).

You like my work? +Rep in my steam profile comments or donate.


Last edited by Franc1sco; 08-27-2016 at 19:41.
Franc1sco is offline
Send a message via MSN to Franc1sco
dangerlord63
Senior Member
Join Date: Aug 2011
Old 08-28-2016 , 03:45   Re: Shake Screen
Reply With Quote #5

Quote:
Originally Posted by Franc1sco View Post
Games like CS:GO use protobuf so try something like this:
PHP Code:
stock players_Fade(clientIndexduration=1000hold=300flags=0x0009color[4]={000255})
{
    new 
Handle:message StartMessageOne("Fade"clientIndexUSERMSG_RELIABLE);
    
PbSetInt(message"duration"duration);
    
PbSetInt(message"hold_time"hold);
    
PbSetInt(message"flags"flags);
    
PbSetColor(message"clr"color);
    
EndMessage();

More info:
https://forums.alliedmods.net/showthread.php?t=250287
Thx, problem solved.
dangerlord63 is offline
milutinke
AlliedModders Donor
Join Date: Jun 2012
Location: Serbia
Old 08-28-2016 , 04:37   Re: Shake Screen
Reply With Quote #6

I have a question.
If duration is 1000, does sceen fade is going to last for 1 second.
Basicaly if that is true I can do: #define ToSeconds(%0) ( %0 * 1000 )
milutinke is offline
Send a message via Skype™ to milutinke
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 14:24.


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