AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Blocking TE_BEAMFOLLOW (https://forums.alliedmods.net/showthread.php?t=213674)

mottzi 04-17-2013 13:29

Blocking TE_BEAMFOLLOW
 
Hi Guys,

I need you help. I attatch a sprite on a player with TE_BEAMFOLLOW like this:

PHP Code:

addtrail(id) {
    
message_begin(MSG_BROADCASTSVC_TEMPENTITY)
    
write_byte(22)    // TE_BEAMFOLLOW
    
write_short(id)
    
write_short(gl_sprite)
    
write_byte(20)
    
write_byte(5)
    
write_byte(255)
    
write_byte(0)
    
write_byte(0)
    
write_byte(100)
    
message_end()


Like that, EVERYONE can see the Trail...

My question is: is there a possiblility to Block the rendering of the trail for a spesific player?

My goal is: show the trail to players who want to see it, and block it for those who dont.

I thnink I have to do this with addToFullPack, but I need a little push into the right direction.



Ty, mottzi

EpicMonkey 04-17-2013 13:57

Re: Blocking TE_BEAMFOLLOW
 
message_begin params:

PHP Code:

message_begin(dest msg_type, const origin[3], player


mottzi 04-17-2013 14:01

Re: Blocking TE_BEAMFOLLOW
 
Go on please? Can you be a bit more precise?

ConnorMcLeod 04-17-2013 14:50

Re: Blocking TE_BEAMFOLLOW
 
Try this :

PHP Code:

new bool:g_bSeeTrails[33]
new 
bool:g_bHasTrail[33]

public 
plugin_init()
{
    
register_clcmd("say /seetrail""ClCmd_ToggleTrails")
}

public 
ClCmd_ToggleTrailsid )
{
    new 
players[32], numplayer
    get_players
(playersnum"a")
    if( (
g_bSeeTrails[id] = !g_bSeeTrails[id]) )
    {
        for(--
numnum>=0num--)
        {
            
player players[num]
            if( 
g_bHasTrail[player] )
            {
                
Util_TE_BEAMFOLLOW(idplayergl_sprite20525500100)
            }
        }
    }
    else
    {
        for(--
numnum>=0num--)
        {
            
player players[num]
            if( 
g_bHasTrail[player] )
            {
                
Util_TE_KILLBEAM(idplayer)
            }
        }
    }
}

set_trail(idbool:bTrailStatus)
{
    if( 
bTrailStatus == g_bHasTrail[id] )
    {
        return 
0
    
}

    
g_bHasTrail[id] = bTrailStatus

    
new players[32], numplayer
    get_players
(playersnum"ch")
    for(--
numnum>=0num--)
    {
        
player players[i]
        if( 
g_bSeeTrails[player] )
        {
            if( 
bTrailStatus )
            {
                
Util_TE_BEAMFOLLOW(playeridgl_sprite20525500100)
            }
            else
            {
                
Util_TE_KILLBEAM(playerid)
            }
        }
    }
}

Util_TE_BEAMFOLLOW(identityspritelifewidthredgreenbluebrightness)
{
    
message_begin(id MSG_ONE MSG_ALLSVC_TEMPENTITY_id);
    
write_byte(TE_BEAMFOLLOW);
    
write_short(entity);
    
write_short(sprite);
    
write_byte(life); // life in 0.1's
    
write_byte(width); // line width in 0.1's
    
write_byte(red);
    
write_byte(green);
    
write_byte(blue);
    
write_byte(brightness);
    
message_end();
}

Util_TE_KILLBEAM(identity)
{
    
message_begin(id MSG_ONE MSG_ALLSVC_TEMPENTITY_id);
    
write_byte(TE_KILLBEAM);
    
write_short(entity);
    
message_end();



mottzi 04-25-2013 17:37

Re: Blocking TE_BEAMFOLLOW
 
Thanks, that helped alot.


All times are GMT -4. The time now is 10:49.

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