Raised This Month: $32 Target: $400
 8% 

[ H3LP ] SetLights engine -> fakemeta


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
DarthMan
Veteran Member
Join Date: Aug 2011
Old 05-15-2018 , 17:12   [ H3LP ] SetLights engine -> fakemeta
Reply With Quote #1

Hello. Could anyone help me with a fakemeta version of set_lights ? (EngFunc_LightStyle)
I know I could just do engfunc(EngFunc_LightStyle, 0, "value") where value would be a letter from a to z and then execute the 3 server commands.
Problem is that I want to also be able to reset lights to default value by using #OFF as the value just like it works with engine.

Original C++ code from engine.cpp

PHP Code:
static cell AMX_NATIVE_CALL set_lights(AMX *amxcell *params) { 
    
int iLength;
    
char *szLights MF_GetAmxString(amxparams[1], 0, &iLength);

    if (
FStrEq(szLights"#OFF")) {
        
glinfo.bCheckLights false;
        
memset(glinfo.szLastLights0x0128);
        
LIGHT_STYLE(0glinfo.szRealLights);
        return 
1;
    }
    
    
glinfo.bCheckLights true;

    
//Reset LastLights and store custom lighting
    
ke::SafeStrcpy(glinfo.szLastLightssizeof(glinfo.szLastLights), szLights);

    
LightStyleDetour->DisableDetour();
    
LIGHT_STYLE(0glinfo.szLastLights);
    
LightStyleDetour->EnableDetour();

    
// These make it so that players/weaponmodels look like whatever the lighting is
    // at. otherwise it would color players under the skybox to these values.
    
SERVER_COMMAND("sv_skycolor_r 0\n");
    
SERVER_COMMAND("sv_skycolor_g 0\n");
    
SERVER_COMMAND("sv_skycolor_b 0\n");

    return 
1;

Thanks !

Last edited by DarthMan; 05-15-2018 at 17:15.
DarthMan is offline
 



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 16:48.


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