AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   get_user_name ? (https://forums.alliedmods.net/showthread.php?t=161989)

hackking 07-13-2011 15:32

get_user_name ?
 
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..

SpeeDeeR 07-13-2011 15:41

Re: get_user_name ?
 
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)



hackking 07-13-2011 16:05

Re: get_user_name ?
 
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
}


bibu 07-13-2011 16:15

Re: get_user_name ?
 
WTF?!

Artifact 07-13-2011 17:57

Re: get_user_name ?
 
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



Doc-Holiday 07-13-2011 17:58

Re: get_user_name ?
 
Why by name??

Crab???

bibu 07-13-2011 17:59

Re: get_user_name ?
 
Btw, "client_authorized" is too early. Hook at least spawn and check if the user is alive and then set the model.

hackking 07-13-2011 21:40

Re: get_user_name ?
 
@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..

Kreation 07-13-2011 23:20

Re: get_user_name ?
 
Why not use FM_SetModel?

fysiks 07-14-2011 00:04

Re: get_user_name ?
 
Quote:

Originally Posted by Kreation (Post 1510230)
Why not use FM_SetModel?

Are you saying that cs_set_user_model() doesn't work?


All times are GMT -4. The time now is 00:57.

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