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

[ H3LP ] SetLights engine -> fakemeta


Post New Thread Reply   
 
Thread Tools Display Modes
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
E1_531G
Senior Member
Join Date: Dec 2017
Old 05-15-2018 , 18:49   Re: [ H3LP ] SetLights engine -> fakemeta
Reply With Quote #2

You have no reason to use fakemeta instead of the engine.
Also, engine already does what you want.
__________________
My English is A0
E1_531G is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 05-15-2018 , 20:18   Re: [ H3LP ] SetLights engine -> fakemeta
Reply With Quote #3

If engine works then you should use that. There is most often no good reason to convert to anything else if the original works just fine.
__________________
fysiks is offline
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 05-16-2018 , 00:10   Re: [ H3LP ] SetLights engine -> fakemeta
Reply With Quote #4

It's just going to be a waste of precious time. It doesn't make sense since the engine version it's working correctly.
__________________








CrazY. is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 05-16-2018 , 04:30   Re: [ H3LP ] SetLights engine -> fakemeta
Reply With Quote #5

Will this kind of posts ever stop? GET THIS INTO YOUR HEAD PEOPLE, stop trying to convert one module to another and stop trying to use only one module, you are not gaining anything and in certain cases you can even lose efficiency.
__________________

Last edited by HamletEagle; 05-16-2018 at 04:30.
HamletEagle is offline
DarthMan
Veteran Member
Join Date: Aug 2011
Old 05-16-2018 , 05:39   Re: [ H3LP ] SetLights engine -> fakemeta
Reply With Quote #6

Quote:
Originally Posted by HamletEagle View Post
Will this kind of posts ever stop? GET THIS INTO YOUR HEAD PEOPLE, stop trying to convert one module to another and stop trying to use only one module, you are not gaining anything and in certain cases you can even lose efficiency.
I was trying to convert it to FakeMeta becuz I don't feel like using engine only for 1 command. The whole plug-in makes use of FakeMeta and I'm using engine only to set lights. Also, what's wrong in converting? I know, execution is slower since it's not done directly from the c++ module but that isn't a problem. It's just that it makes no sense to use engine only for 1 small thing that can also be done using FakeMeta.
DarthMan is offline
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 05-16-2018 , 06:01   Re: [ H3LP ] SetLights engine -> fakemeta
Reply With Quote #7

Quote:
Originally Posted by DarthMan View Post
It's just that it makes no sense to use engine only for 1 small thing that can also be done using FakeMeta.
It does make perfect sense. You lose absolutely nothing.
__________________

Last edited by klippy; 05-16-2018 at 06:02.
klippy is offline
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 05-16-2018 , 07:56   Re: [ H3LP ] SetLights engine -> fakemeta
Reply With Quote #8

I see no problem adding another include. It is certain that some have the preference to use only one of the modules, but depending on what you want to do, it is a real waste of time to find another way, being that it already exists.

I particularly use the engine more, and yet I've never come across any performance-related issues.
__________________








CrazY. is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 05-16-2018 , 13:39   Re: [ H3LP ] SetLights engine -> fakemeta
Reply With Quote #9

Quote:
Originally Posted by DarthMan View Post
I was trying to convert it to FakeMeta becuz I don't feel like using engine only for 1 command. The whole plug-in makes use of FakeMeta and I'm using engine only to set lights. Also, what's wrong in converting? I know, execution is slower since it's not done directly from the c++ module but that isn't a problem. It's just that it makes no sense to use engine only for 1 small thing that can also be done using FakeMeta.
Well, it clearly can not be done with "default" fakemeta, otherwise you would not be asking for help.
__________________
HamletEagle is offline
Reply


Thread Tools
Display Modes

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 19:58.


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