This site is a testing version, but all data is shared with the live forum.


Raised This Month: $ Target: $400
 0% 

[L4D2] Removal of Crosshair on Primary weapon when Laserpointer is Equipped


Post New Thread Reply   
 
Thread Tools Display Modes
DieTeetasse
Senior Member
Join Date: Jul 2009
Old 11-30-2009 , 10:03   Re: [L4D2] Removal of Crosshair on Primary weapon when Laserpointer is Equipped
Reply With Quote #11

The idea of AtomicStryker is a good beginning.
If you pickup a weapon with lasersight or you equip your weapon with it, you change the user cvar or let pop up the question.
If you want to force that, then you have to watch over the cvar again and again, because you cant block the change on the client side.
DieTeetasse is offline
noodleboy347
AlliedModders Donor
Join Date: Mar 2009
Old 11-30-2009 , 10:26   Re: [L4D2] Removal of Crosshair on Primary weapon when Laserpointer is Equipped
Reply With Quote #12

Quote:
Originally Posted by Visual77 View Post
As I understand it, crosshairs are client commands and since you can't change a cvar on a client, it makes the hole idea pointless
Um...

Also, could you use
PHP Code:
ClientCommand(client"crosshair 0"); 
noodleboy347 is offline
Visual77
Veteran Member
Join Date: Jan 2009
Old 11-30-2009 , 10:51   Re: [L4D2] Removal of Crosshair on Primary weapon when Laserpointer is Equipped
Reply With Quote #13

Did you read the comments? http://forums.alliedmods.net/showpos...7&postcount=16

"cl_" commands are client commands and those can't be forced on a client, hence it woulden't work since crosshair is a "cl_" command.
I might be wrong on this one, but this is how I've always seen it.

Last edited by Visual77; 11-30-2009 at 10:58.
Visual77 is offline
GM-Scorp
Senior Member
Join Date: Jun 2009
Location: netherlands
Old 11-30-2009 , 12:51   Re: [L4D2] Removal of Crosshair on Primary weapon when Laserpointer is Equipped
Reply With Quote #14

Quote:
Originally Posted by Visual77 View Post
As I understand it, crosshairs are client commands and since you can't change a cvar on a client, it makes the hole idea pointless

wel i can't realy agree with you here
cuzz when you got a laser on L4D 1 the croshair was removed by the game itself

so why not on L4D 2 ?
__________________
GM-Scorp is offline
Send a message via MSN to GM-Scorp
Visual77
Veteran Member
Join Date: Jan 2009
Old 11-30-2009 , 13:14   Re: [L4D2] Removal of Crosshair on Primary weapon when Laserpointer is Equipped
Reply With Quote #15

Quote:
Originally Posted by GM-Scorp View Post
wel i can't realy agree with you here
cuzz when you got a laser on L4D 1 the croshair was removed by the game itself

so why not on L4D 2 ?
That was in L4D1, L4D 2 is completly different on the other hand. (valve hardcoded the crosshair to stay with the laser sight)
Read my message above please.

Last edited by Visual77; 11-30-2009 at 13:16.
Visual77 is offline
GM-Scorp
Senior Member
Join Date: Jun 2009
Location: netherlands
Old 11-30-2009 , 13:22   Re: [L4D2] Removal of Crosshair on Primary weapon when Laserpointer is Equipped
Reply With Quote #16

wasnt the crosshair in L4D 1 also a CL

but still the game could force the crosshair to disapear right

i dont think they changed that in L4D 2 i can be wrong afcourse i didnt make the game
__________________
GM-Scorp is offline
Send a message via MSN to GM-Scorp
Visual77
Veteran Member
Join Date: Jan 2009
Old 11-30-2009 , 13:33   Re: [L4D2] Removal of Crosshair on Primary weapon when Laserpointer is Equipped
Reply With Quote #17

Well, cl_crosshair is used on all source games (L4D1/L4D2/CS:S/TF2/HL)
And those cannot be changed on clients. You can change them yourself in your config.cfg to customize your crosshair with different colours, size, etc. But What differs in L4D2 is that valve made the laser completly different, so if valve would have made the laser remove the crosshair, it would have worked, but we cannot manually remove someones crosshair, can we?

In L4D 1, valve was using a completly different coding for the laser, to remove the crosshair. That was changed in L4D2 (survivor_upgrades command do no longer exist)
Visual77 is offline
Big Myke
Senior Member
Join Date: Jan 2009
Location: Grain Belt, USA
Old 11-30-2009 , 16:02   Re: [L4D2] Removal of Crosshair on Primary weapon when Laserpointer is Equipped
Reply With Quote #18

It is nice to see that my idea is getting off with a good start.
Big Myke is offline
GM-Scorp
Senior Member
Join Date: Jun 2009
Location: netherlands
Old 11-30-2009 , 17:31   Re: [L4D2] Removal of Crosshair on Primary weapon when Laserpointer is Equipped
Reply With Quote #19

Quote:
Originally Posted by Big Myke View Post
It is nice to see that my idea is getting off with a good start.
Yeah lol

but i still think its possible, but thats just me
__________________
GM-Scorp is offline
Send a message via MSN to GM-Scorp
DieTeetasse
Senior Member
Join Date: Jul 2009
Old 11-30-2009 , 19:20   Re: [L4D2] Removal of Crosshair on Primary weapon when Laserpointer is Equipped
Reply With Quote #20

Before L4D2 i worked at a realistic mod like the one in 2.

PHP Code:
//Hide glow from survivors and item that are far away, strength glow of near items
    
ClientCommand(client"cl_glow_survivor_r 0.0");
    
ClientCommand(client"cl_glow_survivor_g 0.0");
    
ClientCommand(client"cl_glow_survivor_b 0.0");
    
ClientCommand(client"cl_glow_survivor_hurt_r 0.0");
    
ClientCommand(client"cl_glow_survivor_hurt_g 0.0");
    
ClientCommand(client"cl_glow_survivor_hurt_b 0.0");
    
ClientCommand(client"cl_glow_survivor_vomit_r 0.0");
    
ClientCommand(client"cl_glow_survivor_vomit_g 0.0");
    
ClientCommand(client"cl_glow_survivor_vomit_b 0.0");
    
ClientCommand(client"cl_glow_item_r 1.0");
    
ClientCommand(client"cl_glow_item_g 1.0");
    
ClientCommand(client"cl_glow_item_b 1.0");
    
ClientCommand(client"cl_glow_item_far_r 0.0");
    
ClientCommand(client"cl_glow_item_far_g 0.0");
    
ClientCommand(client"cl_glow_item_far_b 0.0");
    
ClientCommand(client"cl_glow_ability_r 0.0");
    
ClientCommand(client"cl_glow_ability_g 0.0");
    
ClientCommand(client"cl_glow_ability_b 0.0");
    
    
//Hide crosshair
    
ClientCommand(client"crosshair 0"); 
And this code snippet was working

You can change client side variables, but you can't block, that the user will open his console and type "crosshair 1" in. Therefor you have to check that x seconds/minutes.

Edit:
I just tried it in L4D2 and its working.
See yourself:
PHP Code:
#include <sourcemod>
#include <sdktools>

#pragma semicolon 1

public OnMapStart()
{
    
HookEvent("upgrade_pack_added"Event_upgrade_pack_added);
}

public 
Action:Event_upgrade_pack_added(Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
id GetEventInt(event"userid");
    new 
client GetClientOfUserId(id);
    
    new 
upgrade GetEventInt(event"upgradeid");
    
    new 
String:class[256];
    
/* upgrade_ammo_explosive, upgrade_ammo_incendiary, upgrade_laser_sight */
    
GetEdictClassname(upgrade, class, sizeof(class));
    
    
//Laser Sight
    
if (StrContains(class, "upgrade_laser_sight") > -1)
    {
         
//Hide crosshair
         
ClientCommand(client"crosshair 0");
    }


Last edited by DieTeetasse; 11-30-2009 at 20:25.
DieTeetasse 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 19:49.


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