Raised This Month: $51 Target: $400
 12% 

Removing CVAR


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
abgar
Senior Member
Join Date: Apr 2015
Old 08-13-2015 , 17:28   Removing CVAR
Reply With Quote #1

Hi guys,

Below is an extract of the Grenade Smoke Colour plugin (https://forums.alliedmods.net/showthread.php?p=1613820) Thanks to HSFighter - awesome plugin

What I want to know is how would i need to adapt this so that i DONT need to use a CVAR?
Im assuming that I would remove the CVAR and add a new DispatchKeyValue... but I don't know much about CVARs - so how can I change this please?

Cheers


Code:
  
public OnPluginStart()
{
g_hCVColor  = CreateConVar("sm_grenadesmokecolor_color",  "0 255 0", FCVAR_PLUGIN);    
}


                    new iEntity = CreateEntityByName("light_dynamic");
                    if (iEntity != -1)
                    {
                        new iRef = EntIndexToEntRef(iEntity);
                        decl String:sBuffer[64];
                        GetConVarString(g_hCVColor, sBuffer, sizeof(sBuffer));
                        DispatchKeyValue(iEntity, "_light", sBuffer);
                        Format(sBuffer, sizeof(sBuffer), "smokelight_%d", iEntity);
                        DispatchKeyValue(iEntity,"targetname", sBuffer);
                        Format(sBuffer, sizeof(sBuffer), "%f %f %f", a[0], a[1], a[2]);
                        DispatchKeyValue(iEntity, "origin", sBuffer);
                        DispatchKeyValue(iEntity, "iEntity", "-90 0 0");
                        DispatchKeyValue(iEntity, "pitch","-90");
                        DispatchKeyValue(iEntity, "distance","256");
                        DispatchKeyValue(iEntity, "spotlight_radius","96");
                        DispatchKeyValue(iEntity, "brightness","3");
                        DispatchKeyValue(iEntity, "style","6");
                        DispatchKeyValue(iEntity, "spawnflags","1");
                        DispatchSpawn(iEntity);
                        AcceptEntityInput(iEntity, "DisableShadow");
                        
                        AcceptEntityInput(iEntity, "TurnOn");
                        
                        CreateTimer(20.0, Delete, iRef, TIMER_FLAG_NO_MAPCHANGE);
abgar is offline
Miu
Veteran Member
Join Date: Nov 2013
Old 08-13-2015 , 17:36   Re: Removing CVAR
Reply With Quote #2

idk why you would want that but i guess change DispatchKeyValue(iEntity, "_light", sBuffer); to DispatchKeyValue(iEntity, "_light", "0 255 0");
Miu is offline
abgar
Senior Member
Join Date: Apr 2015
Old 08-14-2015 , 08:29   Re: Removing CVAR
Reply With Quote #3

That worked perfectly thanks Miu

Out of curiosity, is there a good place that I can learn about spawning entities and setting the controls etc?

I really have no idea where to start but would like to learn.

Cheers
abgar is offline
Miu
Veteran Member
Join Date: Nov 2013
Old 08-14-2015 , 09:24   Re: Removing CVAR
Reply With Quote #4

valve dev wiki has descriptions of some of the keyvalues, e.g. here's light_dynamic
Miu is offline
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 10:11.


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