Try this :
Source world.cpp HLSDK :
PHP Code:
enum _:playerTasks ( += 33 )
{
TASK_PLR_FIX_LIGHTSTYLE,
}
public plugin_init()
{
EF_LightStyle(12, "m");
}
public client_putinserver(id)
{
set_task(0.1, "Task_Fix_LightStyle", id + TASK_PLR_FIX_LIGHTSTYLE);
}
public Task_Fix_LightStyle( id )
{
id %= TASK_PLR_FIX_LIGHTSTYLE;
if( is_user_connected(id) )
{
EF_LightStyle(12, "m");
}
}
Also, from ian.camarata climb plugin, you can do in client_PreThink :
PHP Code:
//Prevent drowning
// waterlevel 0 - not in water
// waterlevel 1 - feet in water
// waterlevel 2 - waist in water
// waterlevel 3 - head in water
if( pev( id, pev_waterlevel ) == 3 ) set_pev( id, pev_waterlevel, 2 )
Would be more correct to set CD_WaterLevel in update_clientdata though.
PHP Code:
enum _:playerTasks ( += 33 )
{
TASK_PLR_FIX_LIGHTSTYLE,
}
public plugin_init()
{
register_forward(FM_UpdateClientData, "OnUpdateClientData_Post", true);
EF_LightStyle(12, "m");
}
public client_putinserver(id)
{
set_task(0.1, "Task_Fix_LightStyle", id + TASK_PLR_FIX_LIGHTSTYLE);
}
public OnUpdateClientData_Post(ent, senweapons, cd)
{
if( get_cd(cd, CD_WaterLevel) == 3 )
{
set_cd(cd, CD_WaterLevel, 2);
}
}
public Task_Fix_LightStyle( id )
{
id %= TASK_PLR_FIX_LIGHTSTYLE;
if( is_user_connected(id) )
{
EF_LightStyle(12, "m");
}
}
__________________