Raised This Month: $ Target: $400
 0% 

[ALL] Real Sky Changer


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
CryWolf
Veteran Member
Join Date: Jul 2008
Location: Romania
Old 07-12-2022 , 13:08   Re: [CSS|ZPS|CSGO] Real Sky Changer
Reply With Quote #33

v1.4 beta test only , unstable
PHP Code:
/*
    
    -------------------------------------------------------------
        Cusom SKY Changer
        v1.4 by CryWolf
    
    - Provides realtime sky change features
    - Auto precache the needed sky texture (bouth .VMT and .VTF files)
    - Simple code
    - Extra config features (cfg/sourcemod/skychanger.cfg)
    - disabled 3d skybox thanks sekac
    - removed index
    - new download files syntax
    - removed new syntax plugin erros on compile
    -------------------------------------------------------------
*/


#include < sourcemod >
#include < sdktools >
#include < clientprefs >

#pragma semicolon 1


// Plugin Information
#define PLUGIN_VERSION    "1.4 beta"

// pCvarS:
new Handle:cvarEnabled;
new 
Handle:cvarSkybox;


public 
Plugin:myinfo =
{
    
name "Sky Changer",
    
author "CryWolf",
    
description "Provides Sky changer feature",
    
version PLUGIN_VERSION,
    
url "https://forums.alliedmods.net/showthread.php?t=258603"
};

public 
OnPluginStart()
{
    
cvarEnabled CreateConVar "sm_custom_sky""1.0""Skybox plugin on / off" );
    
cvarSkybox  CreateConVar "sm_skybox_name""deadend_hdr""Skybox texture name" );
    
    
// Load configuration file
    
AutoExecConfig(true"skychanger");
    
}

public 
OnMapStart()
{
    if ( 
GetConVarBool (cvarEnabled))
    {
        
PrecacheSkyBoxTexture ( );
        
ChangeSkyboxTexture ( );
    }
}

public 
PrecacheSkyBoxTexture ( ) 
{
    
decl String:newskybox 32 ];
    
GetConVarString cvarSkyboxnewskyboxsizeof newskybox ) );
    
    
Handle kv;
    static 
char path[PLATFORM_MAX_PATH];
    
FileToKeyValues(kvpath);
    
    static 
char suffix[][] =
    {
        
"bk",
        
"Bk",
        
"dn",
        
"Dn",
        
"ft",
        
"Ft",
        
"lf",
        
"Lf",
        
"rt",
        
"Rt",
        
"up",
        
"Up",
    };
    
    
char sPath[64];
    
char name[32];
    
char buffer[PLATFORM_MAX_PATH];
    
    
//Get path & name
    
KvGetString(kv"path"sPathsizeof(sPath));
    
KvGetString(kv"newskybox"namesizeof(name));
    
    
//Loop through suffixes and add to downloads table
    
for (int i 0sizeof(suffix);i++)
    {
        
FormatEx(buffersizeof(buffer), "materials/skybox/%s%s.vtf"sPathsuffix[i]);
        if(
FileExists(bufferfalse)) AddFileToDownloadsTable(buffer);
        
        
FormatEx(buffersizeof(buffer), "materials/skybox/%s%s.vmt"sPathsuffix[i]);
        if(
FileExists(bufferfalse)) AddFileToDownloadsTable(buffer);
    }
    
    
CloseHandle(kv);
    
}

public 
ChangeSkyboxTexture()
{
    if ( 
GetConVarBool (cvarEnabled))
    {
        
decl String:newskybox  32 ];
        
GetConVarString(cvarSkyboxnewskyboxsizeof newskybox ));
        
        
// If there is a convar set, change the skybox to it
        
if ( strcmp newskybox""false ) !=)
        {
            
// PrintToServer ( "[CSC] Changing the Skybox to %s", newskybox );
            
DispatchKeyValue 0"skyname"newskybox );
        }
    }
}

public 
void OnClientPostAdminCheck(int client)
{
    if (!
IsFakeClient(client)) 
    {
        
CreateTimer(1.0Timer_DisableSkyboxclient);
    }
}

public 
Action Timer_DisableSkybox(Handle timerint client)
{
    if (!
IsClientInGame(client))
        return 
Plugin_Stop;
    
    
SetEntProp(clientProp_Send"m_skybox3d.area"255);
    
    return 
Plugin_Continue;

Test it at first, and then ill upload on main page, but first whanna add external .ini file per map ex
Code:
mapname skybox
mapname skybox
mapname default
__________________
I dont walk trough this world with fear in my heart.
www.dark-arena.com L4D, CS1.6, CZ Servers

Last edited by CryWolf; 07-12-2022 at 13:12.
CryWolf is offline
Send a message via MSN to CryWolf Send a message via Yahoo to CryWolf
 



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 17:43.


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