Raised This Month: $ Target: $400
 0% 

Multiple Models


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Gasior
Member
Join Date: Mar 2012
Old 08-11-2013 , 14:35   Multiple Models
Reply With Quote #1

Hi,
I am trying to do a multiple models plugin. The way it will work is by saying /madmin you get model of admin etc. So I tried lots of combination and any of them don't work correctly. My sma so far looks like that
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fun>
#include <hamsandwich>

#define ADMIN_FLAG_X (1<<23)

new model1[33]
new 
model2[33]
new 
model3[33]

public 
plugin_init() {
        
register_plugin("Modele VIP""1.0""Gasior")
        
register_event("ResetHUD""resetModel""b")
        
register_clcmd("say /modele1""modelevip")
        
register_clcmd("say /modele2""modele2vip")
        
register_clcmd("say /modele3""modele3vip")
        return 
PLUGIN_CONTINUE
}

public 
plugin_precache() {
        
precache_model("models/player/admin_ct/admin_ct.mdl")
        
precache_model("models/player/admin_te/admin_te.mdl")

        return 
PLUGIN_CONTINUE
}

public 
client_authorized(id)
{
model1[id] = false;
model3[id] = false;
model2[id] = false;
}

public 
modelevip(id)
{
        if(
get_user_flags(id) & ADMIN_FLAG_X) {
    
model1[id] = true;
    
model2[id] = false;
    
model3[id] = false;
}
}

public 
modele2vip(id)
{
        if(
get_user_flags(id) & ADMIN_FLAG_X) {
    
model1[id] = false;
    
model2[id] = true;
    
model3[id] = false;
}
}

public 
modele3vip(id)
{
        if(
get_user_flags(id) & ADMIN_FLAG_X) {
    
model1[id] = false;
    
model2[id] = false;
    
model3[id] = true;
}
}

public 
resetModel(idlevelcid) {
        new 
CsTeams:userTeam cs_get_user_team(id)
        if (
model1[id]) {
                if (
userTeam == CS_TEAM_T) {
                        
cs_set_user_model(id"admin_te")
                }
                else if(
userTeam == CS_TEAM_CT) {
                        
cs_set_user_model(id"admin_ct")
                }
                else {
                        
cs_reset_user_model(id)
                }
    }
        if (
model2[id]) {
                if (
userTeam == CS_TEAM_T) {
                        
cs_set_user_model(id"admin_te")
                }
                else if(
userTeam == CS_TEAM_CT) {
                        
cs_set_user_model(id"admin_ct")
                }
                else {
                        
cs_reset_user_model(id)
                }
    }
        if (
model3[id]) {
                if (
userTeam == CS_TEAM_T) {
                        
cs_set_user_model(id"admin_te")
                }
                else if(
userTeam == CS_TEAM_CT) {
                        
cs_set_user_model(id"admin_ct")
                }
                else {
                        
cs_reset_user_model(id)
                }
    }
    return 
PLUGIN_CONTINUE

I'll be thankful for any help or suggestion.
Gasior is offline
Black Rose
Veteran Member
Join Date: Feb 2011
Location: Stockholm, Sweden
Old 08-11-2013 , 21:03   Re: Multiple Models
Reply With Quote #2

It looks fine, what's the problem?

Just some suggestions
All you have to change with this code is modelfiles[][] = { ... }
Use whatever you want.
Code:
#include <amxmodx> #include <cstrike> #define ADMIN_FLAG_X (1<<23) #define ctod(%0) %0-48 new model[33]; new modelfiles[][][] = {     {"admin_te", "admin_ct"},     {"admin_te", "admin_ct"},     {"admin_te", "admin_ct"} } public plugin_init() {     register_plugin("Modele VIP", "1.0", "Gasior");         register_event("ResetHUD", "resetModel", "b");         register_clcmd("say /modele1", "modelevip");     register_clcmd("say /modele2", "modelevip");     register_clcmd("say /modele3", "modelevip");         return PLUGIN_CONTINUE; } public plugin_precache() {     new tempfile[128];         for ( new i = 0 ; i < sizeof modelfiles ; i++ ) {         for ( new j = 0 ; j < 2 ; j++ ) {             formatex(tempfile, 127, "models/player/%s/%s.mdl", modelfiles[i][j], modelfiles[i][j]);             precache_model(tempfile);         }     }         return PLUGIN_CONTINUE; } public client_authorized(id) {     model[id] = 0; } public modelevip(id) {     if ( ! ( get_user_flags(id) & ADMIN_FLAG_X ) )         return;         new arg[32];     read_argv(1, arg, 31);         model[id] = clamp(ctod(arg[7]), 0, sizeof modelfiles); } public resetModel(id) {     new userTeam2, CsTeams:userTeam = cs_get_user_team(id);         switch ( userTeam ) {         case CS_TEAM_T: userTeam2 = 1;         case CS_TEAM_CT: userTeam2 = 2;     }     if ( model[id] && userTeam2 )         cs_set_user_model(id, modelfiles[model[id] - 1][userTeam2 - 1]);     else         cs_reset_user_model(id); }
__________________

Last edited by Black Rose; 08-12-2013 at 21:20. Reason: Sorry...
Black Rose is offline
Gasior
Member
Join Date: Mar 2012
Old 08-12-2013 , 03:48   Re: Multiple Models
Reply With Quote #3

The problem was that server crashed.

Now your plugin is running but doesn't work :/ .

I even added client_print while changing model but it also doesn't work. Are you sure it's correct?
Gasior is offline
Black Rose
Veteran Member
Join Date: Feb 2011
Location: Stockholm, Sweden
Old 08-12-2013 , 13:49   Re: Multiple Models
Reply With Quote #4

Sorry i forgot this line:
Code:
precache_model(tempfile);
It should work now.
__________________
Black Rose is offline
Gasior
Member
Join Date: Mar 2012
Old 08-12-2013 , 14:47   Re: Multiple Models
Reply With Quote #5

It would be perfect if it run a properly name of model. First I got this
Code:
FATAL ERROR (shutting down): Mod_NumForName: models/player/dmin_te/dmin_te.mdl not found
So I changed name of models at dmin_te and dmin_ct and then it showed
Code:
FATAL ERROR (shutting down): Mod_NumForName: models/player/admin_te/admin_te.mdl not found
Strange :/ .
Gasior is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 08-12-2013 , 15:06   Re: Multiple Models
Reply With Quote #6

Does the file exist on the server?
__________________
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
Gasior
Member
Join Date: Mar 2012
Old 08-12-2013 , 15:50   Re: Multiple Models
Reply With Quote #7

I mean, the problem isn't nonexistent file but the fact that first it says "Where the heck is dmin_te.mdl" and then "I'd like admin_te.mdl back".
Like, it requires 2 pairs of models dmin_te, dmin_ct and admin_te, admin_ct.

Last edited by Gasior; 08-12-2013 at 15:52.
Gasior is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 08-12-2013 , 15:57   Re: Multiple Models
Reply With Quote #8

new modelfiles[][]

->

new modelfiles[][][]
__________________
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
Black Rose
Veteran Member
Join Date: Feb 2011
Location: Stockholm, Sweden
Old 08-12-2013 , 20:13   Re: Multiple Models
Reply With Quote #9

Quote:
Originally Posted by YamiKaitou View Post
new modelfiles[][]

->

new modelfiles[][][]
Why does it even compile with this awful mistake?
__________________
Black Rose is offline
Gasior
Member
Join Date: Mar 2012
Old 08-12-2013 , 17:34   Re: Multiple Models
Reply With Quote #10

Thank you very much guys, you're awesome.

I've also added /mreset, which allow you to come back to your basic model.

Last edited by Gasior; 08-12-2013 at 17:37.
Gasior 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:53.


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