Hi, FacePunch.
Again I ask at you for help.
It is a script doesn't work correctly.
The player doesn't become transparent.
[CODE]
local function skinalfa( ply )
ply:SetPlayercolor( Color( 0, 17, 255, 100 ):ToVector( ) );
end
hook.Add( "PlayerSetModel", "skinalfa", skinalfa );
[/CODE]
p.s mcd1992 - Dumb
You have to set their render mode, add this to your code:
[lua]
ply:SetRenderMode( RENDERMODE_TRANSALPHA )
[/lua]
As seen here: [URL="http://wiki.garrysmod.com/page/Enums/RENDERMODE"]http://wiki.garrysmod.com/page/Enums/RENDERMODE[/URL]
Also, I think you want to use ply:SetColor instead of ply:SetPlayer[b]C[/b]olor, since the latter doesn't affect transparency.
[CODE]
local function skinalfa( ply )
ply:SetColor( Color( 0, 17, 255, 100 ) );
ply:SetRenderMode( RENDERMODE_TRANSALPHA )
end
hook.Add( "PlayerSetModel", "skinalfa", skinalfa );
[/CODE]
[editline]14th April 2015[/editline]
[QUOTE=Wise One;47525320]You have to set their render mode, add this to your code:
[lua]
ply:SetRenderMode( RENDERMODE_TRANSALPHA )
[/lua]
As seen here: [URL="http://wiki.garrysmod.com/page/Enums/RENDERMODE"]http://wiki.garrysmod.com/page/Enums/RENDERMODE[/URL]
Also, I think you want to use ply:SetColor instead of ply:SetPlayer[b]C[/b]olor, since the latter doesn't affect transparency.[/QUOTE]
Doesnt work. =(
(SetPlayerColor .. not SetPlayercolor) btw
But that is not how SetPlayerColor works (I think).
SetPlayercolor sets the mask color of the player-texture (r,g,b)
SetColor draws the material (r,g,b,a)
So you need todo:[code]
ply:SetRenderMode( RENDERMODE_TRANSALPHA )
ply:SetColor(Color(255,255,255,<Any alpha>))[/code]
[QUOTE=Nak;47525807](SetPlayerColor .. not SetPlayercolor) btw
But that is not how SetPlayerColor works (I think).
SetPlayercolor sets the mask color of the player-texture (r,g,b)
SetColor draws the material (r,g,b,a)
So you need todo:[code]
ply:SetRenderMode( RENDERMODE_TRANSALPHA )
ply:SetColor(Color(255,255,255,<Any alpha>))[/code][/QUOTE]
It doesn't work
[CODE]
local function skinalfa( ply )
ply:SetRenderMode( RENDERMODE_TRANSALPHA )
ply:SetColor(Color(255,255,255,50))
end
hook.Add( "PlayerSetModel", "skinalfa", skinalfa );
[/CODE]
[QUOTE=godred2;47525877]It doesn't work
[CODE]
local function skinalfa( ply )
ply:SetRenderMode( RENDERMODE_TRANSALPHA )
ply:SetColor(Color(255,255,255,50))
end
hook.Add( "PlayerSetModel", "skinalfa", skinalfa );
[/CODE][/QUOTE]
Works for me. Run it server side.
[QUOTE=James xX;47525888]Works for me. Run it server side.[/QUOTE]
It and so Run server side
[editline]14th April 2015[/editline]
[QUOTE=James xX;47525888]Works for me. Run it server side.[/QUOTE]
I found a problem: The matter is that it works in the SandBox mode. A in the ZombieSurvival mode - doesn't work. How to correct?
[QUOTE=godred2;47526006]It and so Run server side
[editline]14th April 2015[/editline]
I found a problem: The matter is that it works in the SandBox mode. A in the ZombieSurvival mode - doesn't work. How to correct?[/QUOTE]
Something in ZombieSurvival is setting the player's color after you are. Add the code inside the hook into a timer with a really small delay (eg, 0.1 ).
[QUOTE=James xX;47526257]Something in ZombieSurvival is setting the player's color after you are. Add the code inside the hook into a timer with a really small delay (eg, 0.1 ).[/QUOTE]
[CODE]
local _time = "0.1"; --Protection in seconds for the human
local function skinalfa( ply )
timer.Simple( _time, function()
ply:PS_Notify( "Защита выключена!" )
ply:PS_Notify( "Защита выключена!" )
ply:SetRenderMode( RENDERMODE_TRANSALPHA )
ply:SetColor(Color(255,255,255,50))
end)
end
hook.Add( "PlayerSetModel", "skinalfa", skinalfa );
[/CODE]
Doesn't work in ZombieSurvial
timer.Simple doesn't take a string as the first argument.
[QUOTE=Greetings;47526448]timer.Simple doesn't take a string as the first argument.[/QUOTE]
I tried it and with digit
[QUOTE=godred2;47526500]I tried it and with digit[/QUOTE]
What's the error?
[QUOTE=James xX;47526509]What's the error?[/QUOTE]
There are no errors
[QUOTE=godred2;47526519]There are no errors[/QUOTE]
Have you tried increasing the delay?
[QUOTE=James xX;47526536]Have you tried increasing the delay?[/QUOTE]
Yes
[QUOTE=godred2;47526562]Yes[/QUOTE]
It's possible that ZombieSurvival is setting the playercolor in a think hook. If you send me the source code I can look through the code and tell you what you need to change.
[code]
local alpha = 50 -- 0-255
hook.Add("PrePlayerDraw","Potatos",function(ply)
render.SetBlend(alpha/255) -- 0-1
end)
hook.Add("PostPlayerDraw","PotatosPost",function(ply)
render.SetBlend(1)
end)
[/code]
If that doesn't work .. then idk what will.
[QUOTE=James xX;47526865]It's possible that ZombieSurvival is setting the playercolor in a think hook. If you send me the source code I can look through the code and tell you what you need to change.[/QUOTE]
You very much will help me.
[url]http://facepunch.com/showthread.php?t=1160198[/url]
[QUOTE=godred2;47527737]You very much will help me.
[url]http://facepunch.com/showthread.php?t=1160198[/url][/QUOTE]
Have you tried the post above's solution first?
Have you tried not using [B];[/B] in [B]gLua[/B]
[QUOTE=VortexZ;47531325]Have you tried not using [B];[/B] in [B]gLua[/B][/QUOTE]
Semi-colons don't do anything in gLua apart from separate statements. To explain the dumb rating: You bolded gLua as if it was obvious that semi-colons cause errors, which isn't the case.
[QUOTE=godred2;47531696]Doesn't work
[CODE]local alpha = 50 -- 0-255
hook.Add("PrePlayerDraw","Potatos",function(ply)
render.SetBlend(alpha/255) -- 0-1
end)
hook.Add("PostPlayerDraw","PotatosPost",function(ply)
render.SetBlend(1)
end)[/CODE][/QUOTE]
Because the gamemode overrides it
[code]1358: function GM:_PrePlayerDraw(pl)[/code]
You have to edit the zombiesurvival/gamemode/cl_init.lua to mess with the blend/alpha
Sorry, you need to Log In to post a reply to this thread.