Raised This Month: $ Target: $400
 0% 

pev_owner gets server name?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
hlstriker
Green Gaben
Join Date: Mar 2006
Location: OH-IO!
Old 07-13-2007 , 12:45   pev_owner gets server name?
Reply With Quote #1

I'm trying to display the owners name of their weapon type on Team Fortress Classic. Some reason out of the 3 weapons below only the concussion grenade will display the real owner. The other 2 will display the servers host name. Does anyone know why this is and how to fix it?

PHP Code:
public hook_SetModel(entmodel[])
{
    
// THIS WILL GET THE REAL OWNERS NAME
    
if(equali(model"models/conc_grenade.mdl"))
    {
        new 
id pev(entpev_owner);
        
        new 
name[33];
        
get_user_name(idname32);
        
client_print(0print_chat"%s used a conc."name);
        
        
concsUsed[id] += 1;
    }
    
    
// THIS GETS THE SERVERS NAME
    
if(equali(model"models/pipebomb.mdl"))
    {
        new 
id pev(entpev_owner);
        
        new 
name[33];
        
get_user_name(idname32);
        
client_print(0print_chat"%s used a pipe."name);
        
        
pipesUsed[id] += 1;
    }
    
    
// THIS GETS THE SERVERS NAME
    
if(equali(model"models/rpgrocket.mdl"))
    {
        new 
id pev(entpev_owner);
        
        new 
name[33];
        
get_user_name(idname32);
        
client_print(0print_chat"%s used a rocket."name);
        
        
rocketsUsed[id] += 1;
    }
    
    return 
FMRES_HANDLED;

hlstriker is offline
Greenberet
AMX Mod X Beta Tester
Join Date: Apr 2004
Location: Vienna
Old 07-13-2007 , 13:13   Re: pev_owner gets server name?
Reply With Quote #2

get_user_name will return the hostname if id is lower then 1 or bigger then MaxClients
__________________
Greenberet is offline
Send a message via ICQ to Greenberet Send a message via MSN to Greenberet
hlstriker
Green Gaben
Join Date: Mar 2006
Location: OH-IO!
Old 07-13-2007 , 14:01   Re: pev_owner gets server name?
Reply With Quote #3

Would the players id be stored somewhere with pdata in the rocket/pipe ent itself?
hlstriker is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 07-13-2007 , 14:06   Re: pev_owner gets server name?
Reply With Quote #4

Not sure. Try to add this.

Code:
new g_max_clients; public plugin_init() {     [...]         g_max_clients   = global_get( glb_maxClients ); } public hook_SetModel(ent, model[]) {     if( ent <= g_max_clients )         return FMRES_IGNORED;         [...]
__________________
Arkshine is offline
hlstriker
Green Gaben
Join Date: Mar 2006
Location: OH-IO!
Old 07-13-2007 , 14:26   Re: pev_owner gets server name?
Reply With Quote #5

Does the exact same thing with adding that.
hlstriker is offline
kp_uparrow
Penalized Member
Join Date: Jun 2006
Location: 192.168.0.1
Old 07-13-2007 , 14:46   Re: pev_owner gets server name?
Reply With Quote #6

are u on listen server?
__________________
I USED A SECOND ACCOUNT TO DO MORE KARMA UPS AND DOWNS UNTIL GREENTRYST CAUGHT ME
kp_uparrow is offline
hlstriker
Green Gaben
Join Date: Mar 2006
Location: OH-IO!
Old 07-13-2007 , 14:48   Re: pev_owner gets server name?
Reply With Quote #7

Yes, but that shouldn't effect this problem since it can get the right name on 1 entity, but not the other 2?
hlstriker is offline
Ownage
BANNED
Join Date: Jul 2007
Location: I don't know
Old 07-13-2007 , 15:11   Re: pev_owner gets server name?
Reply With Quote #8

try using a dedicated server
Ownage is offline
hlstriker
Green Gaben
Join Date: Mar 2006
Location: OH-IO!
Old 07-13-2007 , 15:31   Re: pev_owner gets server name?
Reply With Quote #9

Tried and it still didn't work : /

I'm thinking about using 'EngFunc_FindEntityInSphere' to see if the pipe or rocket starts near the player that shot it.

Think using that would be to unoptimized :O?
hlstriker is offline
Wilson [29th ID]
Veteran Member
Join Date: Nov 2005
Location: London
Old 07-17-2007 , 19:47   Re: pev_owner gets server name?
Reply With Quote #10

Maybe I'm overlooking something here because it seems so simple.

Each weapon should have a corresponding entity "weaponbox" -- the pev_owner of that entity should be what you're looking for.
__________________

Day of Defeat AMXX Community

FakeMeta Research . Voice Proximity . Advanced Deploy . Technician
Wilson [29th ID] is offline
Send a message via ICQ to Wilson [29th ID] Send a message via AIM to Wilson [29th ID] Send a message via MSN to Wilson [29th ID] Send a message via Yahoo to Wilson [29th ID]
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 21:29.


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