AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [ H3LP ] SetLights engine -> fakemeta (https://forums.alliedmods.net/showthread.php?t=307572)

DarthMan 05-15-2018 17:12

[ H3LP ] SetLights engine -> fakemeta
 
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 !

E1_531G 05-15-2018 18:49

Re: [ H3LP ] SetLights engine -> fakemeta
 
You have no reason to use fakemeta instead of the engine.
Also, engine already does what you want.

fysiks 05-15-2018 20:18

Re: [ H3LP ] SetLights engine -> fakemeta
 
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.

CrazY. 05-16-2018 00:10

Re: [ H3LP ] SetLights engine -> fakemeta
 
It's just going to be a waste of precious time. It doesn't make sense since the engine version it's working correctly.

HamletEagle 05-16-2018 04:30

Re: [ H3LP ] SetLights engine -> fakemeta
 
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.

DarthMan 05-16-2018 05:39

Re: [ H3LP ] SetLights engine -> fakemeta
 
Quote:

Originally Posted by HamletEagle (Post 2592402)
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.

klippy 05-16-2018 06:01

Re: [ H3LP ] SetLights engine -> fakemeta
 
Quote:

Originally Posted by DarthMan (Post 2592407)
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.

CrazY. 05-16-2018 07:56

Re: [ H3LP ] SetLights engine -> fakemeta
 
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.

HamletEagle 05-16-2018 13:39

Re: [ H3LP ] SetLights engine -> fakemeta
 
Quote:

Originally Posted by DarthMan (Post 2592407)
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.


All times are GMT -4. The time now is 03:54.

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