Raised This Month: $ Target: $400
 0% 

get_user_name ?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
hackking
New Member
Join Date: Aug 2008
Old 07-13-2011 , 15:32   get_user_name ?
Reply With Quote #1

Hi, What should I change as I set get_user_ for names?



I found a similar pattern here, but is for steam..
https://forums.alliedmods.net/showthread.php?t=19562

Code:
        if (get_user_name(id) & name) {
                new CsTeams:userTeam = cs_get_user_team(id)
                if (userTeam == CS_TEAM_T) {
                        cs_set_user_model(id, "test.mdl")
                }
                else if(userTeam == CS_TEAM_CT) {
                        cs_set_user_model(id, "test2.mdl")
                }
                else {
                        cs_reset_user_model(id)
                }
        }
it does not work..

I want to customize a model in a name
I tried with this plugin:
https://forums.alliedmods.net/showth...ght=adminmodel

Sorry for my bad english..
Please help me..
hackking is offline
Old 07-13-2011, 15:39
Artifact
This message has been deleted by Artifact.
SpeeDeeR
Veteran Member
Join Date: Mar 2010
Location: Bulgaria
Old 07-13-2011 , 15:41   Re: get_user_name ?
Reply With Quote #3

PHP Code:
new szname[32]
get_user_name(id,szname,31)

if(
equal(szname,name)) // is the gotten user name the same as the 'name' variable that you posted
switch(cs_get_user_team(id))
{
case 
CS_TEAM_Tcs_set_user_model(id"test.mdl")
case 
CS_TEAM_CT:cs_set_user_model(id"test2.mdl")
default:
cs_reset_user_model(id)

SpeeDeeR is offline
hackking
New Member
Join Date: Aug 2008
Old 07-13-2011 , 16:05   Re: get_user_name ?
Reply With Quote #4

I tried it, and fail:
Code:
#include <amxmodx>
#include <amxmisc>
#include <fun>
#include <cstrike>

public plugin_init() {
    register_plugin("Jake's Plugin", "1.0", "Fire")
    register_cvar("jakes_plugin", "1")
}

public client_authorized(id) {
    
    if(get_cvar_num("jakes_plugin") == 0) {
        return PLUGIN_HANDLED
    }

new szname[32]
get_user_name(id,szname,31)

if(equal(szname,name))
switch(cs_get_user_team(id))
{
case CS_TEAM_T: cs_set_user_model(id, "test.mdl")
case CS_TEAM_CT:cs_set_user_model(id, "test2.mdl")
default:cs_reset_user_model(id)
}  
    return PLUGIN_HANDLED
}
hackking is offline
bibu
Veteran Member
Join Date: Sep 2010
Old 07-13-2011 , 16:15   Re: get_user_name ?
Reply With Quote #5

WTF?!
__________________
Selling tons of my own private works.
Accepting paid work for clans and communities.
Don't hesitate to contact me.
bibu is offline
Artifact
Veteran Member
Join Date: Jul 2010
Old 07-13-2011 , 17:57   Re: get_user_name ?
Reply With Quote #6

Try this:
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <fun>
#include <cstrike>

#define name test

public plugin_init() {
    
register_plugin("Jake's Plugin""1.0""Fire")
    
register_cvar("jakes_plugin""1")
}

public 
client_authorized(id) {
    
    if(
get_cvar_num("jakes_plugin") == 0) {
        return 
PLUGIN_HANDLED
    
}
    
    new 
szname[32]
    
get_user_name(id,szname,31)
    
    if(
equal(szname,"name"))
        switch(
cs_get_user_team(id))
    {
        case 
CS_TEAM_Tcs_set_user_model(id"test.mdl")
            case 
CS_TEAM_CT:cs_set_user_model(id"test2.mdl")
            default:
cs_reset_user_model(id)
    }  
    return 
PLUGIN_HANDLED

__________________
Artifact is offline
Doc-Holiday
AlliedModders Donor
Join Date: Jul 2007
Old 07-13-2011 , 17:58   Re: get_user_name ?
Reply With Quote #7

Why by name??

Crab???
Doc-Holiday is offline
bibu
Veteran Member
Join Date: Sep 2010
Old 07-13-2011 , 17:59   Re: get_user_name ?
Reply With Quote #8

Btw, "client_authorized" is too early. Hook at least spawn and check if the user is alive and then set the model.
__________________
Selling tons of my own private works.
Accepting paid work for clans and communities.
Don't hesitate to contact me.
bibu is offline
hackking
New Member
Join Date: Aug 2008
Old 07-13-2011 , 21:40   Re: get_user_name ?
Reply With Quote #9

@Artifact
I can compile the plugin but not check the models..

Code:
#include <amxmodx>
#include <amxmisc>
#include <fun>
#include <cstrike>

#define name blaaablaaa

public plugin_init() {
    register_plugin("Jake's Plugin", "1.0", "Fire")
    register_cvar("jakes_plugin", "1")
}

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

        return PLUGIN_CONTINUE
}

public client_authorized(id) {
    
    if(get_cvar_num("jakes_plugin") == 0) {
        return PLUGIN_HANDLED
    }
    
    new szname[32]
    get_user_name(id,szname,31)
    
    if(equal(szname,"name"))
        switch(cs_get_user_team(id))
    {
        case CS_TEAM_T: cs_set_user_model(id, "ritsuka")
            case CS_TEAM_CT:cs_set_user_model(id, "ritsuka2")
            default:cs_reset_user_model(id)
    }  
    return PLUGIN_HANDLED
}
I added public plugin_precache, but nothing..
hackking is offline
Kreation
Veteran Member
Join Date: Jan 2010
Location: Illinois
Old 07-13-2011 , 23:20   Re: get_user_name ?
Reply With Quote #10

Why not use FM_SetModel?
__________________
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 00:57.


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