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

[CS:GO] light_dynamic that follows the player


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
valio_skull
Senior Member
Join Date: Jan 2013
Location: at home
Old 01-15-2016 , 15:26   [CS:GO] light_dynamic that follows the player
Reply With Quote #1

Hello, I really need this plugin because I set the brightness (SetLightStyle) to B on all my maps and it's really dark and I want this to be used as a lantern. I want it to be white, to have a medium radius and to follow the player (Only for CT because Terrorists are invisible and that would be an disadvantage).
I tried to make it myself, but no success so I decied to make an request here.
Thanks in advice
__________________
valio_skull is offline
valio_skull
Senior Member
Join Date: Jan 2013
Location: at home
Old 01-20-2016 , 04:52   Re: [CS:GO] light_dynamic that follows the player
Reply With Quote #2

This plugin uses light_dynamic, all I need is a light_dynamic that follows the player.I really tried doing it, but it wasn't successful...
Edit: Sorry for bump, the thread was posted 5 days ago
__________________

Last edited by valio_skull; 01-20-2016 at 04:52.
valio_skull is offline
Mathiaas
Senior Member
Join Date: Aug 2014
Location: Sweden ♥
Old 01-20-2016 , 05:26   Re: [CS:GO] light_dynamic that follows the player
Reply With Quote #3

I believe it would work to create an entity (light_dynamic) and set its targetname to the client ID or something like that.

Or you could use SetParent?

edit: Check this link, it doesn't create a light_dynamic, but you could change that.
https://forums.alliedmods.net/showpo...07&postcount=5

Last edited by Mathiaas; 01-20-2016 at 05:27.
Mathiaas is offline
valio_skull
Senior Member
Join Date: Jan 2013
Location: at home
Old 01-22-2016 , 13:27   Re: [CS:GO] light_dynamic that follows the player
Reply With Quote #4

I tryed, IDK what is wrong..
I hooked Event_OnPlayerSpawn
PHP Code:
public OnPluginStart()
{
/////////////// bla bla //////////////////
    
HookEvent("player_spawn"Event_OnPlayerSpawn);

PHP Code:
public Action Event_OnPlayerSpawn(Handle event, const char[] namebool dontBroadcast)
{
    
int client GetClientOfUserId(GetEventInt(event"userid"));
    if (
IsValidClient(clienttrue) && GetClientTeam(client) != 1)
    {
///////////// bla bla bla ///////////////////
        
else if (GetClientTeam(client) == CS_TEAM_CT)
        {
            
MakeLightDynamic(client);
//////////// some other things /////////// (thoose things are working, that means it's good here)
        
}
    }

There's the wrong part:
PHP Code:
MakeLightDynamic(client)
{
    
decl String:iTarget[16];
    
Format(iTarget16"client%d"client);
    
DispatchKeyValue(client"targetname"iTarget);
    
decl Float:Origin[3];
    
GetClientEyePosition(client,Origin);
    
Origin[2] += 25.0;
    new 
Ent CreateEntityByName("light_dynamic");
    
DispatchKeyValue(Ent"_light""0 0 0 255");
    
DispatchKeyValue(Ent"brightness""1");
    
DispatchKeyValueFloat(Ent"spotlight_radius"32.0);
    
DispatchKeyValueFloat(Ent"distance"10.0);
    
DispatchKeyValue(Ent"style""0");
    
DispatchKeyValue(Ent"rendercolor""255 255 255");
    
DispatchSpawn(Ent);
    
TeleportEntity(EntOriginNULL_VECTORNULL_VECTOR);
    
SetVariantString(iTarget);
    
AcceptEntityInput(Ent"SetParent"EntEnt0);

    return 
Ent;

When the CT is spawning, there is no light around him...
__________________
valio_skull is offline
Totenfluch
AlliedModders Donor
Join Date: Jan 2012
Location: Germany
Old 08-03-2016 , 20:57   Re: [CS:GO] light_dynamic that follows the player
Reply With Quote #5

Code:
int makeLightDynamic(int entity, float pos[3]) 
{ 
    pos[2] += 50.0; 
    int Ent = CreateEntityByName("light_dynamic"); 
    DispatchKeyValue(Ent, "_light", "150 50 200 255"); 
    DispatchKeyValue(Ent, "brightness", "2"); 
    DispatchKeyValueFloat(Ent, "spotlight_radius", 64.0); 
    DispatchKeyValueFloat(Ent, "distance", 3500.0); 
    DispatchKeyValue(Ent, "style", "0"); 
    DispatchKeyValue(Ent, "rendercolor", "150 50 200"); 
    DispatchSpawn(Ent); 
    TeleportEntity(Ent, pos, NULL_VECTOR, NULL_VECTOR); 
    SetVariantString("!activator"); 
    AcceptEntityInput(Ent, "SetParent", entity, Ent, 0); 

    return Ent; 
}
I've edited your snipped to a working one~
__________________
Notable Projects:
Event Item Spawner | Scissors, Rock, Paper for ZephStore
tVip | Smart Link Remover
PLG & GGC - CS:GO Roleplay

and countless more...

I can make a helicopter shoot missles if you want me to...

Last edited by Totenfluch; 08-03-2016 at 20:58.
Totenfluch is offline
TheWho
AlliedModders Donor
Join Date: Jul 2012
Old 08-04-2016 , 07:41   Re: [CS:GO] light_dynamic that follows the player
Reply With Quote #6

I do not recommend to use far light distance as it will cause huge cpu spikes for every player!!
TheWho is offline
Totenfluch
AlliedModders Donor
Join Date: Jan 2012
Location: Germany
Old 08-04-2016 , 07:54   Re: [CS:GO] light_dynamic that follows the player
Reply With Quote #7

Quote:
Originally Posted by TheWho View Post
I do not recommend to use far light distance as it will cause huge cpu spikes for every player!!
Yeah.. the fps went down from 500 to like 60. But it works^^
__________________
Notable Projects:
Event Item Spawner | Scissors, Rock, Paper for ZephStore
tVip | Smart Link Remover
PLG & GGC - CS:GO Roleplay

and countless more...

I can make a helicopter shoot missles if you want me to...
Totenfluch is offline
TheWho
AlliedModders Donor
Join Date: Jul 2012
Old 08-04-2016 , 07:58   Re: [CS:GO] light_dynamic that follows the player
Reply With Quote #8

He wants it only for making the map more bright on B spot? Then why not putting one of this at the spot instead of every player..
TheWho 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:20.


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