Raised This Month: $ Target: $400
 0% 

eror logs .


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Splot
Junior Member
Join Date: Nov 2011
Old 11-21-2011 , 15:49   eror logs .
Reply With Quote #1

hello .
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>

#define PLUGIN "Team Models"
#define VERSION "1.0"
#define AUTHOR "?"

public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)    
    
register_event("ResetHUD""playermodel""b")    
    return 
PLUGIN_CONTINUE
}

public 
plugin_precache()
{        
    
precache_model("models/player/CTplayer.mdl")    

    return 
PLUGIN_CONTINUE
}

public 
playermodel(idlevelcid)
{
    if(
is_user_connected(id) && get_user_team(id) == 2)
    {    
        
cs_set_user_model(id"CTplayer.mdl")
    }    
    else
    {
        
cs_reset_user_model(id)
    }    

eror logs :
Quote:
L 11/21/2011 - 21:11:42: Info (map "de_dust") (file "addons/amxmodx/logs/error_20111121.log")
L 11/21/2011 - 21:11:42: [CSTRIKE] Invalid player 4
L 11/21/2011 - 21:11:42: [AMXX] Displaying debug trace (plugin "teamskin.amxx")
L 11/21/2011 - 21:11:42: [AMXX] Run time error 10: native error (native "cs_reset_user_model")
L 11/21/2011 - 21:11:42: [AMXX] [0] teamskin.sma::resetModel (line 22)
L 11/21/2011 - 21:11:42: [CSTRIKE] Invalid player 7
L 11/21/2011 - 21:11:42: [AMXX] Displaying debug trace (plugin "teamskin.amxx")
L 11/21/2011 - 21:11:42: [AMXX] Run time error 10: native error (native "cs_reset_user_model")
L 11/21/2011 - 21:11:42: [AMXX] [0] teamskin.sma::resetModel (line 22)
L 11/21/2011 - 21:11:42: [CSTRIKE] Invalid player 8
what wrong here ?

Last edited by Splot; 11-21-2011 at 15:58.
Splot is offline
Xellath
Veteran Member
Join Date: Dec 2007
Location: Sweden
Old 11-21-2011 , 15:58   Re: eror logs .
Reply With Quote #2

Invalid player indicates the player is indeed invalid. Adding an alive check would solve this problem. Also, using ResetHud is not a reliable way to hook spawn - use Ham_Spawn instead.
__________________
Achievements API - a simple way for you to create your OWN custom achievements!
Xellath is offline
Splot
Junior Member
Join Date: Nov 2011
Old 11-21-2011 , 16:13   Re: eror logs .
Reply With Quote #3

You mean like this?

PHP Code:

#include <amxmodx>
#include <cstrike>
#include <hamsandwich> 

#define PLUGIN "Team Models"
#define VERSION "1.0"
#define AUTHOR "?"

public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR
    
    
RegisterHam(Ham_Spawn"player""player_spawn"1)        
}

public 
plugin_precache()
{        
    
precache_model("models/player/CTplayer.mdl")    

    return 
PLUGIN_CONTINUE
}

public 
player_spawn(id)
{
    if (
is_user_alive(id) && is_user_connected(id) && get_user_team(id) == 2)
    {    
        
cs_set_user_model(id"CTplayer.mdl")
    }    
    else
    {
        
cs_reset_user_model(id)
    }    


Last edited by Splot; 11-21-2011 at 16:14.
Splot is offline
Korxu
Senior Member
Join Date: Sep 2010
Old 11-21-2011 , 16:23   Re: eror logs .
Reply With Quote #4

Alive already check if the user is connected...
Korxu is offline
e12harry
Member
Join Date: Apr 2010
Old 11-21-2011 , 17:27   Re: eror logs .
Reply With Quote #5

Propably Splots way is good. But if is_user_alive can return false on player_spawn this woult be better:

PHP Code:
#include <amxmodx>
#include <cstrike>
#include <hamsandwich> 

#define PLUGIN "Team Models"
#define VERSION "1.0"
#define AUTHOR "?"

public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR
    
    
RegisterHam(Ham_Spawn"player""player_spawn"1)        
}

public 
plugin_precache()
{        
    
precache_model("models/player/CTplayer.mdl")    

    return 
PLUGIN_CONTINUE
}

public 
player_spawn(id)
{
    if (
is_user_alive(id) )
    {    
        if(
get_user_team(id) == 2
        {
            
cs_set_user_model(id"CTplayer.mdl")
        }
        else
        {
            
cs_reset_user_model(id)
        }    
    }


</span></span>
e12harry is offline
Devil259
Veteran Member
Join Date: Dec 2009
Location: France (59)
Old 11-22-2011 , 06:33   Re: eror logs .
Reply With Quote #6

Code:
#define PLUGIN "Team Models" #define VERSION "1.0" #define AUTHOR "?" public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)         RegisterHam(Ham_Spawn, "player", "player_spawn", 1)         } public plugin_precache() {             precache_model("models/player/CTplayer/CTplayer.mdl")         return PLUGIN_CONTINUE } public player_spawn(id) {     if (is_user_alive(id) )     {             if(get_user_team(id) == 2)         {             cs_set_user_model(id, "CTplayer")         }         else         {             cs_reset_user_model(id)         }         } }
Devil259 is offline
Xellath
Veteran Member
Join Date: Dec 2007
Location: Sweden
Old 11-22-2011 , 08:07   Re: eror logs .
Reply With Quote #7

Might as well use cs_get_user_team (since it's more reliable than get_user_team) when you're using other cstrike natives.

Code:
#include <amxmodx> #include <hamsandwich> #include <cstrike> public plugin_init() {     register_plugin("Team Models", "1.0", "?")         RegisterHam(Ham_Spawn, "player", "player_spawn", 1)         } public plugin_precache() {             precache_model("models/player/CTplayer/CTplayer.mdl") } public player_spawn(id) {     if(is_user_alive(id))     {             if(cs_get_user_team(id) == CS_TEAM_CT)         {             cs_set_user_model(id, "CTplayer")         }         else         {             cs_reset_user_model(id)         }         } }
__________________
Achievements API - a simple way for you to create your OWN custom achievements!
Xellath is offline
Splot
Junior Member
Join Date: Nov 2011
Old 11-22-2011 , 12:10   Re: eror logs .
Reply With Quote #8

thx , but the errors keep coming:
Quote:
L 11/22/2011 - 18:53:41: [CSTRIKE] Invalid player 20
L 11/22/2011 - 18:53:41: [AMXX] Displaying debug trace (plugin "teammodels.amxx")
L 11/22/2011 - 18:53:41: [AMXX] Run time error 10: native error (native "cs_reset_user_model")
L 11/22/2011 - 18:53:41: [AMXX] [0] teammodels.sma::player_spawn (line 27)

PHP Code:
#include <amxmodx>
#include <hamsandwich>
#include <cstrike>

public plugin_init() 
{
    
register_plugin("Team Models""1.0""?"
    
    
RegisterHam(Ham_Spawn"player""player_spawn"1)        
}

public 
plugin_precache()
{        
    
precache_model("models/player/CTplayer/CTplayer.mdl")
}

public 
player_spawn(id)
{
    if(
is_user_alive(id))
    {    
        if(
cs_get_user_team(id) == CS_TEAM_CT
        {
            
cs_set_user_model(id"CTplayer")
        }
        else
        {
            
cs_reset_user_model(id)
        }    
    }

Splot is offline
Korxu
Senior Member
Join Date: Sep 2010
Old 11-22-2011 , 12:32   Re: eror logs .
Reply With Quote #9

I think that you are doing a reset in T players that have the normal skin and it gives you an error.

Make a boolean a reset the user model only if you change it after.
Korxu is offline
Splot
Junior Member
Join Date: Nov 2011
Old 11-22-2011 , 13:25   Re: eror logs .
Reply With Quote #10

I did not understand what you mean ..
Can you show me?

Last edited by Splot; 11-22-2011 at 15:48.
Splot is offline
Reply


Thread Tools
Display Modes

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 08:30.


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