Sign in to follow this  
saloxa

Anticamp icon. Need help

Recommended Posts

Hi guys! 
I need help.
I have a code for the camp icon.There is a problem.
The icon is visible to all players.I want only the enemy to see her.Maybe have an idea how to do it

 

MarkCamper()
{

    self spawnMarker( "marker_"+self getEntityNumber(), self.origin, (0,0,0) );
    
    marker = getEnt( "marker_"+self getEntityNumber(), "targetname" );
    marker.camper_waypoint.alpha = .7;
    marker.camper_waypoint setwaypoint( true, "waypoint_kill" );
    
    while( isAlive( self ) && self.isCamping && self.pers["team"] != "spectator" )
    {
        new_origin = self.origin;
        marker.origin = new_origin;
        
        marker.camper_waypoint.x = marker.origin[0];
        marker.camper_waypoint.y = marker.origin[1];
        marker.camper_waypoint.z = marker.origin[2]+self GetOffset();
        
        wait 0.05;
    }
    
    if( isdefined( marker.camper_waypoint ) ) marker.camper_waypoint destroy();
    if( isdefined( marker ) ) marker delete();
}

spawnMarker( name, origin, angles )
{
    ent = spawn( "script_origin", origin );
    ent.targetname = name;
    ent.angles = angles;
    ent.waypointshader = "waypoint_camper";
    ent createWaypoint();
}

createWaypoint()
{
    self endon ("end_game");
    self endon ("disconnect");
    
    if( isdefined( self.camper_waypoint ) ) self.camper_waypoint destroy();
    
    self.camper_waypoint = newHudElem();
    self.camper_waypoint.x = self.origin[0];
    self.camper_waypoint.y = self.origin[1];
    self.camper_waypoint.z = self.origin[2];
    self.camper_waypoint.alpha = 0;
    self.camper_waypoint.archived = true;
    self.camper_waypoint setShader( "waypoint_kill", 100, 100 );
    self.camper_waypoint setwaypoint( false );

}

GetOffset()
{
    offset = undefined;
    
    switch( self getstance() )
    {
        case "stand":
            offset = 75;
            break;
            
        case "crouch":
            offset = 50;
            break;
        
        case "prone":
            offset = 25;
            break;
    }
    
    return offset;
}

Screenshot_2.png

Screenshot_3.png

Share this post


Link to post
Share on other sites
1 hour ago, Viking said:

use newTeamHudElem( team ); instead of newHudElem();

It crashes the server.

 

createWaypoint()
{
    self endon ("end_game");
    self endon ("disconnect");
    
    if( isdefined( self.camper_waypoint ) ) self.camper_waypoint destroy();

    self.camper_waypoint = newTeamHudElem( team );    
    self.camper_waypoint.x = self.origin[0];
    self.camper_waypoint.y = self.origin[1];
    self.camper_waypoint.z = self.origin[2];
    self.camper_waypoint.alpha = 0;
    self.camper_waypoint.archived = true;
    self.camper_waypoint setShader( "killiconheadshot", 100, 100 );
    self.camper_waypoint setwaypoint( false );

}

^1Error: uninitialised variable 'team':

Share this post


Link to post
Share on other sites

well, team should obviously be defined as the team that should see the icons.

in your case the opposite team of the camper.

Share this post


Link to post
Share on other sites
3 hours ago, Viking said:

well, team should obviously be defined as the team that should see the icons.

in your case the opposite team of the camper.

I will be very grateful to you if you show this with my example.

Share this post


Link to post
Share on other sites
Posted (edited)
On 1/7/2022 at 2:19 PM, saloxa said:

MarkCamper()

{

    marker = self spawnMarker();
    marker.camper_waypoint.alpha = .7;
    marker.camper_waypoint setwaypoint( true, "waypoint_kill" );
    
    while( isAlive( self ) && self.isCamping && self.pers["team"] != "spectator" )
    {
        new_origin = self.origin;
        marker.origin = new_origin;
        
        marker.camper_waypoint.x = marker.origin[0];
        marker.camper_waypoint.y = marker.origin[1];
        marker.camper_waypoint.z = marker.origin[2]+self GetOffset();
        
        wait 0.05;
    }
    
    if( isdefined( marker.camper_waypoint ) ) marker.camper_waypoint destroy();
    if( isdefined( marker ) ) marker delete();
}

spawnMarker( )
{

self endon("disconnect");

self endon("death");


    ent = spawn( "script_origin", self.origin );
    ent.targetname = "marker_" +self getEntityNumber()
    ent.angles = (0,0,0);
    ent.waypointshader = "waypoint_camper";

ent.visibleTo = "allies";

if(self.pers["team"] == ent.visibleTo)

ent.visibleTo = "axis";


    ent createWaypoint();

return ent;
}

createWaypoint()
{
    self endon ("end_game");
    self endon ("disconnect");
    
    if( isdefined( self.camper_waypoint ) ) self.camper_waypoint destroy();
    
    self.camper_waypoint = newTeamHudElem(self.visibleTo);
    self.camper_waypoint.x = self.origin[0];
    self.camper_waypoint.y = self.origin[1];
    self.camper_waypoint.z = self.origin[2];
    self.camper_waypoint.alpha = 0;
    self.camper_waypoint.archived = true;
    self.camper_waypoint setShader( "waypoint_kill", 100, 100 );
    self.camper_waypoint setwaypoint( false );

}

GetOffset()
{
    offset = undefined;
    
    switch( self getstance() )
    {
        case "stand":
            offset = 75;
            break;
            
        case "crouch":
            offset = 50;
            break;
        
        case "prone":
            offset = 25;
            break;
    }
    
    return offset;
}

 

Edited by Viking

Share this post


Link to post
Share on other sites
8 hours ago, Viking said:

 

Hi Viking! Thanks very much!!! Script works great. Super. Thanks again for your work 👏👍

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this