Raised This Month: $51 Target: $400
 12% 

Showing sprites above players head


Post New Thread Reply   
 
Thread Tools Display Modes
CodeMonkey
Junior Member
Join Date: Dec 2009
Old 01-18-2011 , 20:05   Re: Showing sprites above players head
Reply With Quote #31

Ok so to understand my problem here, what I need to do in order for SetTransmit to be called is to make my sprite parent to a networked entity. then the sprite will call the SetTransmit method and all is good.

Is there a reason as to why, whenever I parent a sprite to anything it just doesn't display?
CodeMonkey is offline
Luke Penny
Senior Member
Join Date: Jan 2010
Location: Canada
Old 01-18-2011 , 21:59   Re: Showing sprites above players head
Reply With Quote #32

I believe env_sprite can not be parented (or rather should not) - it simply will not display if you parent it to anything. Use env_sprite_oriented instead, and it should properly move with the parent object and display fine (if you're using env_sprite currently).

Edit: This thread may also be of interest, may need to send an entity input to turn them on? You might also want to try using the entity input SetParent after the sprite is spawned.

Last edited by Luke Penny; 01-18-2011 at 22:05.
Luke Penny is offline
CodeMonkey
Junior Member
Join Date: Dec 2009
Old 01-18-2011 , 22:02   Re: Showing sprites above players head
Reply With Quote #33

I am using env_sprite_oriented, just check my code a few pages back.
CodeMonkey is offline
Luke Penny
Senior Member
Join Date: Jan 2010
Location: Canada
Old 01-18-2011 , 22:29   Re: Showing sprites above players head
Reply With Quote #34

Hmm...The Admin ESP plugin for CS:S accomplished roughly this, however i'm not sure if the differences between the two games prevent using the same method - however it seems to have SetTransmit working with parented sprites using a similar method.
Luke Penny is offline
CodeMonkey
Junior Member
Join Date: Dec 2009
Old 01-18-2011 , 22:53   Re: Showing sprites above players head
Reply With Quote #35

Just tried the code from that, and it would appear as if I have the same problem. As soon as I parent the sprite to anything it disappears whether I use env_sprite or env_sprite_oriented
CodeMonkey is offline
Luke Penny
Senior Member
Join Date: Jan 2010
Location: Canada
Old 01-18-2011 , 23:23   Re: Showing sprites above players head
Reply With Quote #36

When you say anything, do you also mean non-player entities that have no parent? If so then I'd think the problem is the sprite entity itself.

Otherwise, in TF2 anything parented to a player (and also all of it's children) are invisible, and I believe this applies to all entities (not just models). This concept of using a "middle man" entity as mentioned earlier wont work because of this.

You'd have to use OnGameFrame such as the donator plugin used, or use attachables somehow, parenting the sprite to attached model, and then SetTransmit on the sprite.
Luke Penny is offline
CodeMonkey
Junior Member
Join Date: Dec 2009
Old 01-18-2011 , 23:29   Re: Showing sprites above players head
Reply With Quote #37

Yes I have been using ongameframe to reposition the sprite.

I can get the sprite to display and follow people using the ongameframe method, however I am still having issues with the SetTransmit.
CodeMonkey is offline
Luke Penny
Senior Member
Join Date: Jan 2010
Location: Canada
Old 01-18-2011 , 23:41   Re: Showing sprites above players head
Reply With Quote #38

What issues exactly?
PHP Code:
//This after creating the sprite
SDKHook(entSDKHook_SetTransmitSetTransmit);

//Return Plugin_Handled for clients who shouldn't see it
public Action:SetTransmit(entityclient
{
    if (
client == somepeople)
        return 
Plugin_Handled
        
    return 
Plugin_Continue;
    

Luke Penny is offline
CodeMonkey
Junior Member
Join Date: Dec 2009
Old 01-18-2011 , 23:44   Re: Showing sprites above players head
Reply With Quote #39

SetTransmit is not being called.
CodeMonkey is offline
CodeMonkey
Junior Member
Join Date: Dec 2009
Old 01-19-2011 , 00:39   Re: Showing sprites above players head
Reply With Quote #40

Thanks to some much welcomed help from Luke via steam chat I finally figured it out.

I needed to create a prop_dynamic and place it then parent the sprite to it then in my ongameframe move the prop_dynamic up to the player. Then it all works great. Heres my code I use a tf2 model with no polys and then one of my friends from my gaming community showed me some parameters I could set to lighten server strain

PHP Code:
stock CreateSprite(iClientString:sprite[], Float:offset)
{
    
//new String:strClient[64]; 
    //Format(strClient, sizeof(strClient), "client%i", iClient);
    //DispatchKeyValue(iClient, "targetname", strClient);
    
    
    
new String:strParent[64];
    
Format(strParentsizeof(strParent), "prop%i"iClient);
    new 
parent CreateEntityByName("prop_dynamic");
    
DispatchKeyValue(parent"targetname"strParent);
    
//DispatchKeyValue(parent, "parentname", strClient);
    
    //Special values given by couch do reduce strain on server
    
    
DispatchKeyValue(parent,"renderfx","0");
    
DispatchKeyValue(parent,"damagetoenablemotion","0");
    
DispatchKeyValue(parent,"forcetoenablemotion","0");
    
DispatchKeyValue(parent,"Damagetype","0");
    
DispatchKeyValue(parent,"disablereceiveshadows","1");
    
DispatchKeyValue(parent,"massScale","0");
    
DispatchKeyValue(parent,"nodamageforces","0");
    
DispatchKeyValue(parent,"shadowcastdist","0");
    
DispatchKeyValue(parent,"disableshadows","1");
    
DispatchKeyValue(parent,"spawnflags","1670");
    
DispatchKeyValue(parent,"model","models/player/medic_animations.mdl");
    
DispatchKeyValue(parent,"PerformanceMode","1");
    
DispatchKeyValue(parent,"rendermode","10");
    
DispatchKeyValue(parent,"physdamagescale","0");
    
DispatchKeyValue(parent,"physicsmode","2");
    
    
    
DispatchSpawn(parent);
    
    
//SetVariantString(strClient);
    //AcceptEntityInput(parent, "SetParent",parent, parent, 0);

    
    
g_EntParentList[iClient] = parent;
    




    new 
Float:vOrigin[3];
    
GetClientAbsOrigin(iClientvOrigin);
    
vOrigin[2] += offset;
    new 
ent CreateEntityByName("env_sprite");
    
    if (
ent)
    {
        new 
String:StrEntityName[64]; Format(StrEntityNamesizeof(StrEntityName), "ent_sprite_oriented_%i"ent);
        
DispatchKeyValue(ent"model"sprite);
        
        
DispatchKeyValue(ent"classname""env_sprite");
        
DispatchKeyValue(ent"spawnflags""1");
        
DispatchKeyValue(ent"scale""0.1");
        
DispatchKeyValue(ent"rendermode""1");
        
DispatchKeyValue(ent"rendercolor""255 255 255");        
        
DispatchKeyValue(ent"targetname"StrEntityName);        
        
DispatchKeyValue(ent"parentname"strParent);
        
        
        
DispatchSpawn(ent);
        
        
        
//TeleportEntity(ent, vOrigin, NULL_VECTOR, NULL_VECTOR);
        
g_EntList[iClient] = ent;
        
        
        
SetVariantString(strParent);
        
AcceptEntityInput(ent"SetParent");

        
SDKHook(entSDKHook_SetTransmitSetTransmit);
    }


Heres my OnGameFrame

PHP Code:
public OnGameFrame()
{
    new 
entFloat:vOrigin[3], Float:vVelocity[3];
    
    for(new 
1<= MaxClientsi++)
    {
        if (!
IsClientInGame(i)) continue;
        if ((
ent g_EntParentList[i]) > 0)
        {
            if (!
IsValidEntity(ent))
                
g_EntParentList[i] = 0;
            else
                if ((
ent EntRefToEntIndex(ent)) > 0)
                {
                    
GetClientEyePosition(ivOrigin);
                    
vOrigin[2] += 25.0;
                    
GetEntDataVector(igVelocityOffsetvVelocity);
                    
TeleportEntity(entvOriginNULL_VECTORvVelocity);
                }
        }
    }

Thank you all so much for your help this will be an awesome addition to my drinking game plugin.
CodeMonkey is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 01:56.


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