Raised This Month: $32 Target: $400
 8% 

Changing Player Skin with command


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Copper
Senior Member
Join Date: Feb 2012
Location: California
Old 04-26-2017 , 04:02   Changing Player Skin with command
Reply With Quote #1

Hello Alliedmodders,

How can I change my player skin if I type /example. I don't need a menu but I just want to be able to have 1 skin for CT and 1 skin for T. I would also like to have a check so that only 1 person per team can have the skin but if the player with the skin leaves, then someone else can say the command and they will get the skin.

Example:

If I say /skin and if I am a CT then I would get a Cop Model but if I am a T then I would get a Robber Model using the same command. And there could only be 1 player with the Cop model and 1 player with the Robber model at a time.

Thank you.

Last edited by Copper; 04-26-2017 at 04:08.
Copper is offline
5STAR
Senior Member
Join Date: Apr 2017
Old 04-28-2017 , 12:18   Re: Changing Player Skin with command
Reply With Quote #2

i don't now if a plugin like is in use
5STAR is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 04-28-2017 , 13:24   Re: Changing Player Skin with command
Reply With Quote #3

Quote:
Originally Posted by 5STAR View Post
i don't now if a plugin like is in use
If you don't know, save your keyboard for a time when you will know. It's called the "requests" section for a reason.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
EFFx
Veteran Member
Join Date: Feb 2016
Location: São Paulo, Brasil
Old 04-28-2017 , 13:46   Re: Changing Player Skin with command
Reply With Quote #4

Didn't tested

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

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "author"

#define isNotSpec(%1)    (CS_TEAM_T <= cs_get_user_team(%1) <= CS_TEAM_CT)

enum _:pPlayersModels
{
    
pTerrorModel,
    
pCTModel
}

new const 
g_mPlayersModels[pPlayersModels][] =
{
    
"guerilla",
    
"urban"
}

new 
bool:g_bAlreadyIsUsing[pPlayersModels], g_iIsUsingTheModel[pPlayersModels], szOwnerName[pPlayersModels][32]

public 
plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
RegisterHam(Ham_Spawn"player""ham_PlayerSpawn_Post"1)
    
    
register_clcmd("say /skin""cmdSkin")
}

public 
plugin_precache()
{
    
precache_model(g_mPlayersModels[pTerrorModel])
    
precache_model(g_mPlayersModels[pCTModel])
}

public 
client_disconnect(id)
{
    if(
isNotSpec(id))
    {
        new 
pModelType get_user_team(id) == pTerrorModel pCTModel
        
if(g_iIsUsingTheModel[pModelType] == id)
        {
            
g_bAlreadyIsUsing[pModelType] = false
            g_iIsUsingTheModel
[pModelType] = 0
        
}
    }
}

public 
ham_PlayerSpawn_Post(id)
{
    if(
is_user_alive(id))
    {
        new 
pModelType get_user_team(id) == pTerrorModel pCTModel
        
if(g_iIsUsingTheModel[pModelType] == id)
        {
            
cs_set_user_model(idg_mPlayersModels[pModelType])
        }
    }
}

public 
cmdSkin(id)
{
    new 
pModelType get_user_team(id) == pTerrorModel pCTModel
    
switch(get_user_team(id))
    {
        case 
1:
        {
            if(
g_bAlreadyIsUsing[pTerrorModel])
            {
                
client_print(idprint_chat"[AMXX]: The player '%s' already is using the Terror model"szOwnerName[pTerrorModel])
            }
            else
            {
                
g_iIsUsingTheModel[pTerrorModel] = id
                g_bAlreadyIsUsing
[pTerrorModel] = true
                
                
if(is_user_alive(id))
                {
                    
cs_set_user_model(idg_mPlayersModels[pModelType])
                }
                
                
get_user_info(id"name"szOwnerName[pTerrorModel], charsmax(szOwnerName[]))
                
client_print(0print_chat"[AMXX]: The player '%s' got the Terror model!"szOwnerName[pTerrorModel])
            }
        }
        case 
2:
        {
            if(
g_bAlreadyIsUsing[pCTModel])
            {
                
client_print(idprint_chat"[AMXX]: The player '%s' already is using the CT model"szOwnerName[pCTModel])
            }
            else
            {
                
g_iIsUsingTheModel[pCTModel] = id
                g_bAlreadyIsUsing
[pCTModel] = true
                
                
if(is_user_alive(id))
                {
                    
cs_set_user_model(idg_mPlayersModels[pModelType])
                }
                
                
get_user_info(id"name"szOwnerName[pCTModel], charsmax(szOwnerName[]))
                
client_print(0print_chat"[AMXX]: The player '%s' got the CT model!"szOwnerName[pCTModel])
            }
        }
        default:
        {
            
client_print(idprint_chat"[AMXX]: Only CTs or Terrorists can use that command!")
        }
    }
    return 
PLUGIN_HANDLED

__________________
• Ranking System • AutoMix 5vs5 System
• Web Ban System • Plugins for free

____________________________________________
For private works:
• Discord: EFFEXo#8850 • Steam: EFFEXo

Last edited by EFFx; 04-28-2017 at 16:14.
EFFx is offline
Copper
Senior Member
Join Date: Feb 2012
Location: California
Old 05-08-2017 , 23:43   Re: Changing Player Skin with command
Reply With Quote #5

Quote:
Originally Posted by EFFx View Post
Didn't tested

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

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "author"

#define isNotSpec(%1)    (CS_TEAM_T <= cs_get_user_team(%1) <= CS_TEAM_CT)

enum _:pPlayersModels
{
    
pTerrorModel,
    
pCTModel
}

new const 
g_mPlayersModels[pPlayersModels][] =
{
    
"guerilla",
    
"urban"
}

new 
bool:g_bAlreadyIsUsing[pPlayersModels], g_iIsUsingTheModel[pPlayersModels], szOwnerName[pPlayersModels][32]

public 
plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
RegisterHam(Ham_Spawn"player""ham_PlayerSpawn_Post"1)
    
    
register_clcmd("say /skin""cmdSkin")
}

public 
plugin_precache()
{
    
precache_model(g_mPlayersModels[pTerrorModel])
    
precache_model(g_mPlayersModels[pCTModel])
}

public 
client_disconnect(id)
{
    if(
isNotSpec(id))
    {
        new 
pModelType get_user_team(id) == pTerrorModel pCTModel
        
if(g_iIsUsingTheModel[pModelType] == id)
        {
            
g_bAlreadyIsUsing[pModelType] = false
            g_iIsUsingTheModel
[pModelType] = 0
        
}
    }
}

public 
ham_PlayerSpawn_Post(id)
{
    if(
is_user_alive(id))
    {
        new 
pModelType get_user_team(id) == pTerrorModel pCTModel
        
if(g_iIsUsingTheModel[pModelType] == id)
        {
            
cs_set_user_model(idg_mPlayersModels[pModelType])
        }
    }
}

public 
cmdSkin(id)
{
    new 
pModelType get_user_team(id) == pTerrorModel pCTModel
    
switch(get_user_team(id))
    {
        case 
1:
        {
            if(
g_bAlreadyIsUsing[pTerrorModel])
            {
                
client_print(idprint_chat"[AMXX]: The player '%s' already is using the Terror model"szOwnerName[pTerrorModel])
            }
            else
            {
                
g_iIsUsingTheModel[pTerrorModel] = id
                g_bAlreadyIsUsing
[pTerrorModel] = true
                
                
if(is_user_alive(id))
                {
                    
cs_set_user_model(idg_mPlayersModels[pModelType])
                }
                
                
get_user_info(id"name"szOwnerName[pTerrorModel], charsmax(szOwnerName[]))
                
client_print(0print_chat"[AMXX]: The player '%s' got the Terror model!"szOwnerName[pTerrorModel])
            }
        }
        case 
2:
        {
            if(
g_bAlreadyIsUsing[pCTModel])
            {
                
client_print(idprint_chat"[AMXX]: The player '%s' already is using the CT model"szOwnerName[pCTModel])
            }
            else
            {
                
g_iIsUsingTheModel[pCTModel] = id
                g_bAlreadyIsUsing
[pCTModel] = true
                
                
if(is_user_alive(id))
                {
                    
cs_set_user_model(idg_mPlayersModels[pModelType])
                }
                
                
get_user_info(id"name"szOwnerName[pCTModel], charsmax(szOwnerName[]))
                
client_print(0print_chat"[AMXX]: The player '%s' got the CT model!"szOwnerName[pCTModel])
            }
        }
        default:
        {
            
client_print(idprint_chat"[AMXX]: Only CTs or Terrorists can use that command!")
        }
    }
    return 
PLUGIN_HANDLED

What if I want to add my own 2 models?
Copper is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 05-09-2017 , 08:35   Re: Changing Player Skin with command
Reply With Quote #6

https://forums.alliedmods.net/showthread.php?p=958925
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
Copper
Senior Member
Join Date: Feb 2012
Location: California
Old 05-09-2017 , 15:07   Re: Changing Player Skin with command
Reply With Quote #7

Quote:
Originally Posted by Natsheh View Post
Did you not read what the whole thread was about? Don't be posting links that have nothing to do what I want or what I need.
Copper is offline
EFFx
Veteran Member
Join Date: Feb 2016
Location: São Paulo, Brasil
Old 05-09-2017 , 15:15   Re: Changing Player Skin with command
Reply With Quote #8

PHP Code:
new const g_mPlayersModels[pPlayersModels][] = 

    
"guerilla"
    
"urban" 

There's where you add the TModel or CTModel. Tell me if you want .ini file.
__________________
• Ranking System • AutoMix 5vs5 System
• Web Ban System • Plugins for free

____________________________________________
For private works:
• Discord: EFFEXo#8850 • Steam: EFFEXo
EFFx is offline
Copper
Senior Member
Join Date: Feb 2012
Location: California
Old 05-09-2017 , 15:37   Re: Changing Player Skin with command
Reply With Quote #9

Quote:
Originally Posted by EFFx View Post
PHP Code:
new const g_mPlayersModels[pPlayersModels][] = 

    
"guerilla"
    
"urban" 

There's where you add the TModel or CTModel. Tell me if you want .ini file.
I tried adding my own 2 models but when I said /skin the server crashed.
Copper is offline
EFFx
Veteran Member
Join Date: Feb 2016
Location: São Paulo, Brasil
Old 05-09-2017 , 16:27   Re: Changing Player Skin with command
Reply With Quote #10

This only happened when you added you own or with my default code the server crashs too?
__________________
• Ranking System • AutoMix 5vs5 System
• Web Ban System • Plugins for free

____________________________________________
For private works:
• Discord: EFFEXo#8850 • Steam: EFFEXo
EFFx 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 04:58.


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