Page 1 of 1

Why is this not just for the person who triggered it?

Posted: May 9th, 2010, 1:18 pm
by Rezil
Ok so I have this code:

Code: Select all

[snip snip]


		t waittill("trigger", user);
		if (user.have_messhall_key)
		
		{
			wait 0.2;
			user iprintln("You unlock the door.");
			wait 1;
			user freezecontrols(true);
			user setClientCvar("hud_enable", "0");
			
			user.d_shdr = newHudElem();
			user.d_shdr.x = 0;
			user.d_shdr.y = 0;
			user.d_shdr.alignX = "left";		
			user.d_shdr.alignY = "top";
			user.d_shdr.alpha = 1;
			user.d_shdr setshader("black", 5000, 5000);

		}

[snip snip]
Why does the shader show up for ALL the players on the server and not just the one who triggered it?

Re: Why is this not just for the person who triggered it?

Posted: May 9th, 2010, 2:04 pm
by Moustache
Shouldn't all "user" parts be "self"?

I don't know I am not good (read freaking noob) @ scripting. But you can give it a try.

Re: Why is this not just for the person who triggered it?

Posted: May 9th, 2010, 2:40 pm
by waywaaaard
Did you precache the shader?

precacheShader("black");

But I guess this isn't the problem.

Re: Why is this not just for the person who triggered it?

Posted: May 9th, 2010, 2:48 pm
by Rezil
Yeah, still doesn't work, all players get the black shader on their screen, not only 1.

Re: Why is this not just for the person who triggered it?

Posted: May 9th, 2010, 3:28 pm
by _DanTheMan_
Rez|l wrote:

Code: Select all

			user.d_shdr = newHudElem();
If you have newHudElem, then you make a hud elem for everyone... shouldn't it be:

Code: Select all

			user.d_shdr = newClientHudElem(user);
?

Re: Why is this not just for the person who triggered it?

Posted: May 9th, 2010, 3:44 pm
by waywaaaard
yep just wanted to post that too :)

newClientHudElem(ent);

edit: btw if you want to have the shader over the whole screen and no wide screen problems use this

Code: Select all

	 user.d_shdr = newHudElem(user);
	 user.d_shdr.x = 0;
         user.d_shdr.y = 0;
   	 user.d_shdr.horzAlign = "fullscreen";
    	 user.d_shdr.vertAlign = "fullscreen";
         user.d_shdr.alignX = "left";      
         user.d_shdr.alignY = "top";
	 user.sort = -2;
         user.d_shdr.alpha = 1;
         user.d_shdr setshader("black", 640, 480);

Re: Why is this not just for the person who triggered it?

Posted: May 9th, 2010, 3:44 pm
by Drofder2004
_DanTheMan_ wrote:

Code: Select all

user.d_shdr = newClientHudElem(user);

Re: Why is this not just for the person who triggered it?

Posted: May 9th, 2010, 6:00 pm
by Rezil
Ahh yeah that's it, I thought by using user.shader it would automatically assign the shader only to the user. Thanks guys!