AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   pev_owner gets server name? (https://forums.alliedmods.net/showthread.php?t=57884)

hlstriker 07-13-2007 12:45

pev_owner gets server name?
 
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;



Greenberet 07-13-2007 13:13

Re: pev_owner gets server name?
 
get_user_name will return the hostname if id is lower then 1 or bigger then MaxClients

hlstriker 07-13-2007 14:01

Re: pev_owner gets server name?
 
Would the players id be stored somewhere with pdata in the rocket/pipe ent itself?

Arkshine 07-13-2007 14:06

Re: pev_owner gets server name?
 
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;         [...]

hlstriker 07-13-2007 14:26

Re: pev_owner gets server name?
 
Does the exact same thing with adding that.

kp_uparrow 07-13-2007 14:46

Re: pev_owner gets server name?
 
are u on listen server?

hlstriker 07-13-2007 14:48

Re: pev_owner gets server name?
 
Yes, but that shouldn't effect this problem since it can get the right name on 1 entity, but not the other 2?

Ownage 07-13-2007 15:11

Re: pev_owner gets server name?
 
try using a dedicated server

hlstriker 07-13-2007 15:31

Re: pev_owner gets server name?
 
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?

Wilson [29th ID] 07-17-2007 19:47

Re: pev_owner gets server name?
 
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.


All times are GMT -4. The time now is 21:29.

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