Raised This Month: $ Target: $400
 0% 

[SOLVED] Using only 2 models in the game


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
GalegO
Member
Join Date: May 2010
Location: Brazil
Old 10-08-2010 , 01:19   [SOLVED] Using only 2 models in the game
Reply With Quote #1

Hi Guys!

I'm trying to make my first plugin. And one thing I want is to use only one skin for each team ("urban" and "terror"). I've tried to adapt the various codes that I found in the forum but nothing worked. Could anyone help me?

PS: Plugin for Condition Zero

Thanks

EDIT: Now it's works Thanks!

Last edited by GalegO; 10-26-2010 at 11:12.
GalegO is offline
hornet
AMX Mod X Plugin Approver
Join Date: Mar 2010
Location: Australia
Old 10-08-2010 , 01:37   Re: Using only 2 models in the game
Reply With Quote #2

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

new mdlTs[]="terror";
new 
mdlCTs[]="urban";

public 
plugin_init() 
{
    
register_plugin("Team Models","1.0","hornet");
    
    
RegisterHam(Ham_Spawn,"player","PlayerSpawn");
}

public 
PlayerSpawn(id)
{
    if( 
cs_get_user_team(id) == CS_TEAM_CT )
    
cs_set_user_model(id,mdlCTs);
    else if( 
cs_get_user_team(id) == CS_TEAM_T)
    
cs_set_user_model(id,mdlTs);

Those player models don't need to be precached because the game does that automatically. But if you ever want to use custom models, then you'll need to precache them:

PHP Code:
public plugin_precache()
{
    
precache_model("models/player/customT/customT.mdl");
    
precache_model("models/player/customCT/customCT.mdl");


Last edited by hornet; 10-08-2010 at 01:39.
hornet is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 10-08-2010 , 02:08   Re: Using only 2 models in the game
Reply With Quote #3

Use a switch for cs_get_user_team(id).
__________________
fysiks is offline
GalegO
Member
Join Date: May 2010
Location: Brazil
Old 10-08-2010 , 13:09   Re: Using only 2 models in the game
Reply With Quote #4

Thanks guys! This is correct use of switch?

PHP Code:
        switch(cs_get_user_team(id))
        {
            case 
1: (CS_TEAM_CT):
            {
                
cs_set_user_model(id,mdlCTs)
            }
            case 
2: (CS_TEAM_T):
            {
                
cs_set_user_model(id,mdlTs)
            }
        } 
PS: @fysiks, Give to you 5 stars in your thread about the User Lang for notepad++. Very Useful GOOD JOB MAN!!l

Last edited by GalegO; 10-08-2010 at 13:25. Reason: PS
GalegO is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 10-08-2010 , 13:21   Re: Using only 2 models in the game
Reply With Quote #5

No.

Also, use rather this plugin : http://forums.alliedmods.net/showthread.php?p=958925

And sets .ini file like :


Code:
"leet" "terror"
"arctic" "terror"
"gsg9" "urban"
"gign" "urban"
"sas" "urban"
"guerilla" "terror"
"militia" "terror"
"spetsnaz" "urban"
About your switch question :
PHP Code:
        switch(cs_get_user_team(id))
        {
            case 
CS_TEAM_T:
            {
                
cs_set_user_model(id,mdlTs)
            }
            case 
CS_TEAM_CT:
            {
                
cs_set_user_model(id,mdlCTs)
            }

        } 
But you would need tp register ham forward as post and not pre.
Anyway, use the linked plugin.
__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 10-08-2010 at 13:23.
ConnorMcLeod is offline
Old 10-08-2010, 13:21
YamiKaitou
This message has been deleted by YamiKaitou. Reason: nvm
Zezima14
Member
Join Date: Feb 2010
Old 10-08-2010 , 13:29   Re: Using only 2 models in the game
Reply With Quote #6

Quote:
Originally Posted by hornet View Post
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <hamsandwich>

new mdlTs[]="terror";
new 
mdlCTs[]="urban";

public 
plugin_init() 
{
    
register_plugin("Team Models","1.0","hornet");
    
    
RegisterHam(Ham_Spawn,"player","PlayerSpawn");
}

public 
PlayerSpawn(id)
{
    if( 
cs_get_user_team(id) == CS_TEAM_CT )
    
cs_set_user_model(id,mdlCTs);
    else if( 
cs_get_user_team(id) == CS_TEAM_T)
    
cs_set_user_model(id,mdlTs);

Those player models don't need to be precached because the game does that automatically. But if you ever want to use custom models, then you'll need to precache them:

PHP Code:
public plugin_precache()
{
    
precache_model("models/player/customT/customT.mdl");
    
precache_model("models/player/customCT/customCT.mdl");

Change all in playerspawn for
PHP Code:
cs_set_user_modelid, (cs_get_user_team(id)==CS_TEAM_T) ? mdlTs mdlCTs 
Zezima14 is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 10-08-2010 , 13:36   Re: Using only 2 models in the game
Reply With Quote #7

Quote:
Originally Posted by Zezima14 View Post
Change all in playerspawn for
PHP Code:
cs_set_user_modelid, (cs_get_user_team(id)==CS_TEAM_T) ? mdlTs mdlCTs 
And if they are on CS_TEAM_SPEC?
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
GalegO
Member
Join Date: May 2010
Location: Brazil
Old 10-08-2010 , 13:44   Re: Using only 2 models in the game
Reply With Quote #8

Quote:
Originally Posted by ConnorMcLeod View Post
No.

Also, use rather this plugin : http://forums.alliedmods.net/showthread.php?p=958925

And sets .ini file like :


Code:
"leet" "terror"
"arctic" "terror"
"gsg9" "urban"
"gign" "urban"
"sas" "urban"
"guerilla" "terror"
"militia" "terror"
"spetsnaz" "urban"
About your switch question :
PHP Code:
        switch(cs_get_user_team(id))
        {
            case 
CS_TEAM_T:
            {
                
cs_set_user_model(id,mdlTs)
            }
            case 
CS_TEAM_CT:
            {
                
cs_set_user_model(id,mdlCTs)
            }

        } 
But you would need tp register ham forward as post and not pre.
Anyway, use the linked plugin.
Thanks, but I don't want use one plugin for this step of my plugin, becouse this step only works if my plugin is desactive, That's because I've found a bug and this part resolve this.

Quote:
Originally Posted by Zezima14 View Post
Change all in playerspawn for
PHP Code:
cs_set_user_modelid, (cs_get_user_team(id)==CS_TEAM_T) ? mdlTs mdlCTs 
Like this?

PHP Code:
public player_spawn(id)
{    
    if(
get_cvar_num("sv_thpop") != 1
    {
        new 
players[32],count
        get_players
(playerscount)
        
        
set_user_godmode(id)
        
set_user_hitzones(0id255)
        
set_user_maxspeed(id1.0)
        
set_user_gravity(id1.0)
        
give_item(id"weapon_knife")
        
set_user_rendering(id,kRenderFxNone,0,0,0,kRenderTransAlpha,255)
        
        
cs_set_user_modelid, (cs_get_user_team(id)==CS_TEAM_T) ? model_TR model_CT )
        
    }
    return 
PLUGIN_CONTINUE

GalegO is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 10-08-2010 , 13:58   Re: Using only 2 models in the game
Reply With Quote #9

DO NOT use Zezima14's suggestion.
__________________
fysiks is offline
GalegO
Member
Join Date: May 2010
Location: Brazil
Old 10-08-2010 , 14:00   Re: Using only 2 models in the game
Reply With Quote #10

My "script" of switch is correct to use?
GalegO 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 10:22.


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