Raised This Month: $ Target: $400
 0% 

Model isn't changing


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
owned
Member
Join Date: Jul 2007
Old 06-23-2009 , 21:55   Model isn't changing
Reply With Quote #1

I'm trying to make a plugin where only the CTs model gets changed to models/player/smith/smith.mdl

here is my code

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

#define PLUGIN "MS CT Mdoels"
#define VERSION "1.0"
#define AUTHOR "owned"


public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_event("ResetHUD""set_players_models""a")
}

public 
plugin_precache(){
    
precache_model("models/player/smith/smith.mdl");
        
    return 
PLUGIN_CONTINUE;
}


public 
set_players_models(){
    
    new 
i;
    new 
players[32], ingame;
    
get_players(players,ingame);
    
    for(
i=1;i<=ingame;i++){
        if(
cs_get_user_team(i) == CS_TEAM_CT){
            
cs_set_user_model(i,"smith");
        }
    }
    
    return 
PLUGIN_CONTINUE;

it doesn't work for me, i've only tried it locally alone.
__________________
MARREC/OWNED = me.
owned is offline
DruGzOG
Veteran Member
Join Date: Nov 2007
Location: Unknown
Old 06-23-2009 , 21:57   Re: Model isn't changing
Reply With Quote #2

are you trying to make it work for yourself or for admins?
__________________
DruGzOG is offline
Send a message via AIM to DruGzOG
owned
Member
Join Date: Jul 2007
Old 06-23-2009 , 21:59   Re: Model isn't changing
Reply With Quote #3

for ALL counter terrorists
__________________
MARREC/OWNED = me.
owned is offline
DruGzOG
Veteran Member
Join Date: Nov 2007
Location: Unknown
Old 06-23-2009 , 22:03   Re: Model isn't changing
Reply With Quote #4

Why not just use this?

http://forums.alliedmods.net/showthr...t=player+model
__________________
DruGzOG is offline
Send a message via AIM to DruGzOG
owned
Member
Join Date: Jul 2007
Old 06-23-2009 , 22:04   Re: Model isn't changing
Reply With Quote #5

that requires more work, the ini file and plus that doesn't help me learn what's wrong with my code
__________________
MARREC/OWNED = me.
owned is offline
DruGzOG
Veteran Member
Join Date: Nov 2007
Location: Unknown
Old 06-23-2009 , 22:14   Re: Model isn't changing
Reply With Quote #6

PHP Code:
#include <amxmodx> 
#include <cstrike> 
#include <hamsandwich> 
public plugin_init() { 
    
register_plugin"Team Model""1.0""LeviN" ); 
     
    
RegisterHamHam_Spawn"player""set_players_models"); 

public 
plugin_precache() { 
    
precache_model("models/player/smith/smith.mdl"); 

public 
set_players_models(){
    
    new 
i;
    new 
players[32], ingame;
    
get_players(players,ingame);
    
    for(
i=1;i<=ingame;i++){
        if(
cs_get_user_team(i) == CS_TEAM_CT){
            
cs_set_user_model(i,"smith");
        }
    }
    
    return 
PLUGIN_CONTINUE;

try that
__________________
DruGzOG is offline
Send a message via AIM to DruGzOG
owned
Member
Join Date: Jul 2007
Old 06-23-2009 , 22:17   Re: Model isn't changing
Reply With Quote #7

worked thank you!
__________________
MARREC/OWNED = me.
owned is offline
DruGzOG
Veteran Member
Join Date: Nov 2007
Location: Unknown
Old 06-23-2009 , 22:20   Re: Model isn't changing
Reply With Quote #8

Quote:
Originally Posted by owned View Post
worked thank you!

You Welcome
__________________
DruGzOG is offline
Send a message via AIM to DruGzOG
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 06-23-2009 , 22:50   Re: Model isn't changing
Reply With Quote #9

Quote:
Originally Posted by DruGzOG View Post
PHP Code:
#include <amxmodx> 
#include <cstrike> 
#include <hamsandwich> 
public plugin_init() { 
    
register_plugin"Team Model""1.0""LeviN" ); 
     
    
RegisterHamHam_Spawn"player""set_players_models"); 

public 
plugin_precache() { 
    
precache_model("models/player/smith/smith.mdl"); 

public 
set_players_models(){
    
    new 
i;
    new 
players[32], ingame;
    
get_players(players,ingame);
    
    for(
i=1;i<=ingame;i++){
        if(
cs_get_user_team(i) == CS_TEAM_CT){
            
cs_set_user_model(i,"smith");
        }
    }
    
    return 
PLUGIN_CONTINUE;

try that
Okay, gross.

Code:
#include <amxmodx> #include <amxmisc> #include <cstrike> #include <hamsandwich> new const g_szModelName[] = "smith"; public plugin_precache() {     new szModelFilename[128];     formatex(szModelFilename, 127, "models/player/%s/%s.mdl",\         g_szModelName, g_szModelName);         precache_model(szModelFilename); } public plugin_init() {     register_plugin("CT Model", "0.1", "Exolent");         RegisterHam(Ham_Spawn, "player", "FwdPlayerSpawn", 1); } public FwdPlayerSpawn(iPlayer) {     if( is_user_alive(iPlayer) )     {         if( cs_get_user_team(iPlayer) == CS_TEAM_CT )         {             cs_set_user_model(iPlayer, g_szModelName);         }     } }

This still isn't the best way.
The best and most efficient way is hooking forwards to block the model from being changed and other complicated stuff.
However, I was lazy and since this is only the CT's, it shouldn't cause SVC_BAD.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!

Last edited by Exolent[jNr]; 06-24-2009 at 19:29.
Exolent[jNr] is offline
owned
Member
Join Date: Jul 2007
Old 06-23-2009 , 23:38   Re: Model isn't changing
Reply With Quote #10

still not working. Drugzog's code worked for a single counter-terrorist, and Exolent's code appeared not to work at all.
__________________
MARREC/OWNED = me.
owned 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 15:33.


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