AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Model isn't changing (https://forums.alliedmods.net/showthread.php?t=95467)

owned 06-23-2009 21:55

Model isn't changing
 
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.

DruGzOG 06-23-2009 21:57

Re: Model isn't changing
 
are you trying to make it work for yourself or for admins?

owned 06-23-2009 21:59

Re: Model isn't changing
 
for ALL counter terrorists

DruGzOG 06-23-2009 22:03

Re: Model isn't changing
 
Why not just use this?

http://forums.alliedmods.net/showthr...t=player+model

owned 06-23-2009 22:04

Re: Model isn't changing
 
that requires more work, the ini file :x and plus that doesn't help me learn what's wrong with my code

DruGzOG 06-23-2009 22:14

Re: Model isn't changing
 
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

owned 06-23-2009 22:17

Re: Model isn't changing
 
worked :) thank you!

DruGzOG 06-23-2009 22:20

Re: Model isn't changing
 
Quote:

Originally Posted by owned (Post 855566)
worked :) thank you!


You Welcome :)

Exolent[jNr] 06-23-2009 22:50

Re: Model isn't changing
 
Quote:

Originally Posted by DruGzOG (Post 855565)
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.

owned 06-23-2009 23:38

Re: Model isn't changing
 
still not working. Drugzog's code worked for a single counter-terrorist, and Exolent's code appeared not to work at all.


All times are GMT -4. The time now is 15:33.

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