Raised This Month: $ Target: $400
 0% 

Why my model didn`t change ?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
epic .
Senior Member
Join Date: Oct 2009
Location: China
Old 06-21-2010 , 04:57   Why my model didn`t change ?
Reply With Quote #1

Code:
public plugin_init()
{
    register_plugin(PLUGIN, VERSION, AUTHOR)
    register_cvar("Savior_version", VERSION, FCVAR_SERVER|FCVAR_SPONLY)
    register_event("DeathMsg", "death_event", "a") 
}
public plugin_precache()
{
    if( get_pcvar_num(qigong_enable) == 1 ) 
    {
        precache_model("models/player/goku/goku.mdl")
    }
}
public death_event() 
{
    new cts[32], ts[32], ctsnum = 0, tsnum = 0
    new iPlayers[32], iNum, id, playername[32];
    new origin[3], srco[3];
    get_players(iPlayers, iNum);
    for (new i = 0; i < iNum; i++) 
    {
        id = iPlayers[i];
        if (!is_user_connected(id) || !is_user_alive(id))
            continue
        g_UsingPower[id] = false;
        switch (cs_get_user_team(id)) 
        {
            case TEAM_T: ts[tsnum++] = id
            case TEAM_CT: cts[ctsnum++] = id
            default: 
            {
                return PLUGIN_CONTINUE
            }
        }
        if (tsnum > 1 || ctsnum > 1) 
        {
            return PLUGIN_CONTINUE
        }
    }
    if (ctsnum != 1 || tsnum != 1) 
    {
        return PLUGIN_CONTINUE
    }
    g_Savior = cts[0]
 
 
    if( get_pcvar_num(model_enable) == 1 )    
    {
       cs_set_user_model(g_Savior, "goku");
    }
    client_print(0, print_chat, "model changed");
 
    }
    else 
    {
        g_Savior = 0
        return PLUGIN_CONTINUE
    }
    return PLUGIN_CONTINUE
}
When I was the last CT, and I kill a T, the client_print worked, but my model didn`t change. I want to change my model to goku when I kill someone
Thanks
__________________
Quote:
Destinies in my AWP sight are all alike;
Destinies out of my AWP sight in its own way.
epic . is offline
Send a message via ICQ to epic .
grimvh2
Veteran Member
Join Date: Nov 2007
Location: Fishdot Nation
Old 06-21-2010 , 05:04   Re: Why my model didn`t change ?
Reply With Quote #2

i Doubt this is right

PHP Code:
if( get_pcvar_num(qigong_enable) == 
Because this aint a pcvar

PHP Code:
 register_cvar("Savior_version"VERSIONFCVAR_SERVER|FCVAR_SPONLY
and I think

PHP Code:
ts[tsnum++] = id
cts
[ctsnum++] = id 
Does'nt actually add something to tsnum and ctsnum
__________________
I am out of order!
grimvh2 is offline
epic .
Senior Member
Join Date: Oct 2009
Location: China
Old 06-21-2010 , 05:05   Re: Why my model didn`t change ?
Reply With Quote #3

Quote:
Originally Posted by grimvh2 View Post
i Doubt this is right

PHP Code:
if( get_pcvar_num(qigong_enable) == 
Because this aint a pcvar

PHP Code:
 register_cvar("Savior_version"VERSIONFCVAR_SERVER|FCVAR_SPONLY
Really thanks!!!
__________________
Quote:
Destinies in my AWP sight are all alike;
Destinies out of my AWP sight in its own way.
epic . is offline
Send a message via ICQ to epic .
RedRobster
Veteran Member
Join Date: Apr 2010
Location: Your Closet
Old 06-21-2010 , 05:17   Re: Why my model didn`t change ?
Reply With Quote #4

And, I think it takes a round before your model will switch. I don't think it switches right away. Atleast my experiences with cs_set_user_model() have led me to believe that.
RedRobster is offline
grimvh2
Veteran Member
Join Date: Nov 2007
Location: Fishdot Nation
Old 06-21-2010 , 06:35   Re: Why my model didn`t change ?
Reply With Quote #5

Quote:
Originally Posted by RedRobster View Post
And, I think it takes a round before your model will switch. I don't think it switches right away. Atleast my experiences with cs_set_user_model() have led me to believe that.
Depends on ur code.

Is it working epic?
__________________
I am out of order!
grimvh2 is offline
RedRobster
Veteran Member
Join Date: Apr 2010
Location: Your Closet
Old 06-21-2010 , 12:52   Re: Why my model didn`t change ?
Reply With Quote #6

Quote:
Originally Posted by grimvh2 View Post
Depends on ur code.
Could you give me an example of what would make it change right away?
RedRobster is offline
epic .
Senior Member
Join Date: Oct 2009
Location: China
Old 06-22-2010 , 07:52   Re: Why my model didn`t change ?
Reply With Quote #7

Quote:
Originally Posted by grimvh2 View Post
Is it working epic?
I have tested it, it seems
Code:
register_cvar("Savior_version", VERSION, FCVAR_SERVER|FCVAR_SPONLY)  
doesn`t anti a pcvar
__________________
Quote:
Destinies in my AWP sight are all alike;
Destinies out of my AWP sight in its own way.
epic . is offline
Send a message via ICQ to epic .
epic .
Senior Member
Join Date: Oct 2009
Location: China
Old 06-22-2010 , 07:57   Re: Why my model didn`t change ?
Reply With Quote #8

Quote:
Originally Posted by RedRobster View Post
And, I think it takes a round before your model will switch. I don't think it switches right away. Atleast my experiences with cs_set_user_model() have led me to believe that.
more code is :
Code:
public plugin_init()
{
    register_plugin(PLUGIN, VERSION, AUTHOR)
    register_cvar("Savior_version", VERSION, FCVAR_SERVER|FCVAR_SPONLY)
    register_event("DeathMsg", "death_event", "a") 
    register_logevent("RoundStart", 2, "1=Round_Start")
    register_logevent("RoundEnd", 2, "0=World triggered", "1=Round_End")
}
public plugin_precache()
{
    if( get_pcvar_num(qigong_enable) == 1 ) 
    {
        precache_model("models/player/goku/goku.mdl")
    }
}
public death_event() 
{
    new cts[32], ts[32], ctsnum = 0, tsnum = 0
    new iPlayers[32], iNum, id, playername[32];
    new origin[3], srco[3];
    get_players(iPlayers, iNum);
    for (new i = 0; i < iNum; i++) 
    {
        id = iPlayers[i];
        if (!is_user_connected(id) || !is_user_alive(id))
            continue
        g_UsingPower[id] = false;
        switch (cs_get_user_team(id)) 
        {
            case TEAM_T: ts[tsnum++] = id
            case TEAM_CT: cts[ctsnum++] = id
            default: 
            {
                return PLUGIN_CONTINUE
            }
        }
        if (tsnum > 1 || ctsnum > 1) 
        {
            return PLUGIN_CONTINUE
        }
    }
    if (ctsnum != 1 || tsnum != 1) 
    {
        return PLUGIN_CONTINUE
    }
    g_Savior = cts[0]
 
 
    if( get_pcvar_num(model_enable) == 1 )    
    {
    cs_set_user_model(g_Savior, "goku");
    }
    client_print(0, print_chat, "model changed");
 
    }
    else 
    {
        g_Savior = 0
        return PLUGIN_CONTINUE
    }
    return PLUGIN_CONTINUE
}
 
public RoundStart()
{
    if (!g_round)
        g_round = true
} 
public RoundEnd()
{
    g_round = false
    if( is_user_connected(g_Savior) && g_Savior != 0 && get_pcvar_num(model_enable) == 1 )    
    {
        cs_reset_user_model(g_Savior)
    }
    g_Savior = 0
}
__________________
Quote:
Destinies in my AWP sight are all alike;
Destinies out of my AWP sight in its own way.

Last edited by epic .; 06-22-2010 at 07:59.
epic . is offline
Send a message via ICQ to epic .
grimvh2
Veteran Member
Join Date: Nov 2007
Location: Fishdot Nation
Old 06-22-2010 , 08:49   Re: Why my model didn`t change ?
Reply With Quote #9

qigong_enable doesnt exists as a pcvar?
__________________
I am out of order!
grimvh2 is offline
Kreation
Veteran Member
Join Date: Jan 2010
Location: Illinois
Old 06-22-2010 , 09:00   Re: Why my model didn`t change ?
Reply With Quote #10

PHP Code:
new qigong_enable;

public 
plugin_init()
{
     
qigong_enable register_cvar("Your Cvar""Your value");

win.
__________________
Hi.
Kreation 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 21:31.


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