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

[help] consulta


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
luis enrique
Member
Join Date: Oct 2017
Location: peru
Old 05-31-2018 , 14:59   [help] consulta
Reply With Quote #1

can be added with a color plugin to physics and Dynamic objects
saved
Attached Images
File Type: jpg bandicam 2018-05-31 14-10-16-083.jpg (28.2 KB, 236 views)

Last edited by luis enrique; 05-31-2018 at 15:18.
luis enrique is offline
LenHard
Senior Member
Join Date: Jan 2016
Old 06-01-2018 , 03:09   Re: [help] consulta
Reply With Quote #2

I'm not sure what you're asking, but I'm assuming changing the colors of entities?

PHP Code:
void SetGlow(int entityint r 255int g 255int b 255int o 255)
{
    if (
IsValidEntity(entity))
    {
        
SetEntityRenderMode(entityRENDER_TRANSCOLOR);
        
SetEntityRenderColor(entityrgbo);
    }

__________________
LenHard is offline
Aceleracion
Member
Join Date: Jul 2017
Location: Ecuador
Old 06-01-2018 , 20:46   Re: [help] consulta
Reply With Quote #3

Quote:
Originally Posted by luis enrique View Post
can be added with a color plugin to physics and Dynamic objects
saved
Of course you can assign color. You can assign color to any physical or dynamic object, and you can save it in a keyvalues file (.cfg file), and then load it in the map you want, with the position and the specified color.
There are plugins that store objects on the map.
Spawner Objects: https://forums.alliedmods.net/showthread.php?t=127418
Fort Spawner: https://forums.alliedmods.net/showthread.php?t=129603

Of course these plugins do not save the color but you can add that value to a key value in the files that these plugins generate.

A solution to your problem using the Spawner Objects plugin would look something like this:

This is an example of a bus that was saved on a map.
Code:
"Objects_Cache"
{
	"object_1"
	{
		"origin"		"123.000000 456.000000 789.000000"
		"angles"		"0.000000 95.502655 0.000000"
		"model"			"models/props_waterfront/tour_bus.mdl"
		"classname"		"prop_physics_override"
		"rendercolor"	"255 0 0 255" //I keep the color
	}
}
To establish the color you can follow the advice of LenHard. It is one of the ways to establish color. Another would be:

Code:
void SetColorEntity(entity, String:strColor[]) 
{ 
    if (IsValidEntity(entity)) 
    { 
        DispatchKeyValue(entity, "rendercolor", strColor);
    } 
}
Now use this method in the place where the plugin gets the data from the keyvalues file. For you to understand me better, read about the keyvalues files.

If I want the Object Spawner plugin to assign color to the entity, it would be something like this:

PHP Code:
stock LoadPluginProps(clientnumber)
{
    
LogSpawn("%N loaded the objects for this map"client);
    
PrintToChat(client"\x04[SM] Loading content. Please Wait");
    new 
Handle:keyvalues INVALID_HANDLE;
    
decl String:KvFileName[256], String:map[256], String:name[256];
    
GetCurrentMap(mapsizeof(map));
    
BuildPath(Path_SMKvFileNamesizeof(KvFileName), "data/maps/plugin_cache/%s_%i.txt"mapnumber);
    if(!
FileExists(KvFileName))
    {
        
PrintToChat(client"\x04[SM] The file does not exist");
        
PrintHintText(client"\x04[SM] The file does not exist");
        return;
    }
    
keyvalues CreateKeyValues("Objects_Cache");
    
FileToKeyValues(keyvaluesKvFileName);
    
KvRewind(keyvalues);
    if(
KvJumpToKey(keyvalues"total_cache"))
    {
        new 
max KvGetNum(keyvalues"total"0);
        if(
max <= 0)
        {
            
PrintToChat(client"\x04[SM] No objects found in the cache");
            return;
        }
        
decl String:model[256], String:class[64], Float:vecOrigin[3], Float:vecAngles[3];
        
decl String:strColor//Variable to store the color. Format RGBA
        
new solid;
        
KvRewind(keyvalues);
        for(new 
count=1count <= maxcount++)
        {
            
Format(namesizeof(name), "object_%i"count);
            if(
KvJumpToKey(keyvaluesname))
            {
                
solid KvGetNum(keyvalues"solid");
                
KvGetVector(keyvalues"origin"vecOrigin);
                
KvGetVector(keyvalues"angles"vecAngles);
                
KvGetString(keyvalues"model"modelsizeof(model));
                
KvGetString(keyvalues"classname", class, sizeof(class));
                
KvGetString(keyvalues"rendercolor"strColorsizeof(strColor)); // Here I get the color of the .cfg file
                
new prop = -1;
                
KvRewind(keyvalues);
                if(
StrContains(class, "prop_physics") >= 0)
                {
                    
prop CreateEntityByName("prop_physics_override");
                }
                else
                {
                    
prop CreateEntityByName("prop_dynamic_override");
                    
SetEntProp(propProp_Send"m_nSolidType"solid);
                }
                
DispatchKeyValue(prop"model"model);
                
DispatchKeyValue(prop"rendercolor"strColor); // Here I set the color to the entity in progress.
                
DispatchKeyValue(prop"targetname""l4d2_spawn_props_prop");
                
                
g_vecLastEntityAngles[client][0] = vecAngles[0];
                
g_vecLastEntityAngles[client][1] = vecAngles[1];
                
g_vecLastEntityAngles[client][2] = vecAngles[2];
                
DispatchKeyValueVector(prop"angles"vecAngles);
                
DispatchSpawn(prop);
                
TeleportEntity(propvecOriginNULL_VECTORNULL_VECTOR);
                
g_bSpawned[prop] = true;
                
g_vecEntityAngles[prop] = vecAngles;                
            }
            else
            {
                break;
            }
        }
    }
    
CloseHandle(keyvalues);
    
PrintToChat(client"\x03[SM] Succesfully loaded the map data");
    
PrintHintText(client"[SM] If nothing is visible, you probably forgot something during installation");

Now if you want to obtain the color of an entity, it would be as follows:

Code:
void GetColorEntity(entity, String:strColor[], maxlength) 
{ 
    if (IsValidEntity(entity)) 
    { 
        new r, g, b, a;
        GetEntityRenderColor(entity, r, g, b, a);

        Format(strColor, maxlength, "%d %d %d %d", r, g, b, a);
    } 
}
Check where the data saves the plugin you have to save the color. You can save it manually or using the plugin.
You can save the color, at the moment the plugin saves the object in a keyvalues file. It is similar to obtaining data, using the methods of keyvalues (keyvalues.inc) or also some plugins use the functions to save files offered by sourcemod (file.inc). Read the documentation of the sourcemod api for more information.

Greetings.
__________________
by Aceleración
To succeed in your goals, use your true potential

Last edited by Aceleracion; 06-01-2018 at 21:41.
Aceleracion is offline
luis enrique
Member
Join Date: Oct 2017
Location: peru
Old 06-01-2018 , 20:52   Re: [help] consulta
Reply With Quote #4

Quote:
Originally Posted by Aceleracion View Post
Of course you can assign color. You can assign color to any physical or dynamic object, and you can save it in a keyvalues file (.cfg file), and then load it in the map you want, with the position and the specified color.
There are plugins that store objects on the map.
Spawner Objects: https://forums.alliedmods.net/showthread.php?t=127418
Fort Spawner: https://forums.alliedmods.net/showthread.php?t=129603

Of course these plugins do not save the color but you can add that value to a key value in the files that these plugins generate.
To establish the color you can follow the advice of LenHard. It is one of the ways to establish color. Another would be:

Code:
void SetColorEntity(entity, String:strColor[]) 
{ 
    if (IsValidEntity(entity)) 
    { 
        DispatchKeyValue(entity, "rendercolor", strColor);
    } 
}
Now if you want to obtain the color of an entity, it would be as follows:

Code:
void GetColorEntity(entity, String:strColor[], maxlength) 
{ 
    if (IsValidEntity(entity)) 
    { 
        new r, g, b, a;
        GetEntityRenderColor(entity, r, g, b, a);

        Format(strColor, maxlength, "%d %d %d %d", r, g, b, a);
    } 
}
Greetings.


I'll try -.-, thanks for answering: V
luis enrique is offline
luis enrique
Member
Join Date: Oct 2017
Location: peru
Old 06-01-2018 , 20:53   Re: [help] consulta
Reply With Quote #5

Quote:
Originally Posted by LenHard View Post
I'm not sure what you're asking, but I'm assuming changing the colors of entities?

PHP Code:
void SetGlow(int entityint r 255int g 255int b 255int o 255)
{
    if (
IsValidEntity(entity))
    {
        
SetEntityRenderMode(entityRENDER_TRANSCOLOR);
        
SetEntityRenderColor(entityrgbo);
    }


thank you I will take into account thank you for your attention
luis enrique 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 04:40.


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