Raised This Month: $ Target: $400
 0% 

DoD Custom Player Models


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Rirre
Veteran Member
Join Date: Nov 2006
Old 03-18-2011 , 09:12   DoD Custom Player Models
Reply With Quote #1

Compiles fine, but it do not set the player model.
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <engine>
#include <fakemeta>
#include <dodx>

new AUTHOR[] = "Rirre"
new PLUGIN_NAME[] = "DoD Custom Player Models"
new VERSION[] = "0.1b"

#define MODELS 4

new models[MODELS][128] =
{
    
"models/player/test/test.mdl",
    
"models/player/test/testT.mdl",
    
"models/player/coats/coats.mdl",
    
"models/player/coats/coatsT.mdl"
}

new 
models_type[2][32] =
{
    
"test",
    
"coats"
}

new 
body_number[33] = { 0, ...}

public 
plugin_init() 
{
    
// Register this plugin
    
register_plugin(PLUGIN_NAMEVERSIONAUTHOR)
 
    
// Register the Forwards
    
register_forward(FM_PrecacheModel"fw_precache"
    
register_forward(FM_PrecacheSound"fw_precache"
    
register_forward(FM_PrecacheGeneric"fw_precache")
}

public 
plugin_precache()
{
    for(new 
0MODELSx++)
    {
        if(!
file_exists(models[x]))
        {
            
log_amx("File: %s Does not Exist!"models[x])

            return 
PLUGIN_CONTINUE
        
}
    
        
precache_model(models[x])
        
enforce(models[x])
    }

    
precache_model("models/rpgrocket.mdl")
    
    return 
PLUGIN_CONTINUE
}

public 
client_putinserver(id)
{
    if(!
is_user_connected(id))
        
body_number[id] = 12
    
    
return PLUGIN_CONTINUE
}

public 
dod_client_changeteam(idteamoldteam)
{
    if(!
is_user_connected(id))
    {
        if(
team == ALLIES || team == AXIS)
            
dod_set_model(idmodels_type[team-1])
    }
        
    return 
PLUGIN_CONTINUE
}

public 
dod_client_changeclass(id, class, oldclass)
{
    if(!
is_user_connected(id))
    {
        
// Here you can play with some bodys to see the number of them and determine what body for what class
        
dod_set_body_number(idbody_number[id])
    }
        
    return 
PLUGIN_CONTINUE
}

public 
dod_client_spawn(id)
{
    if(!
is_user_connected(id))
    {
        
// Here you can play with some bodys to see the number of them and determine what body for what class
        
dod_set_body_number(idbody_number[id])
    }
        
    return 
PLUGIN_CONTINUE
}

public 
fw_precache(const file[]) 
{
    
enforce(file)
    return 
FMRES_IGNORED
}  

public 
enforce(const file[])
{
    
force_unmodified(force_exactfile, {0,0,0}, {0,0,0}, file)
}

public 
inconsistent_file(id, const filename[], reason[64])
{
    
format(reason63"Delete %s and reconnect to get proper file!"filename)
    return 
PLUGIN_CONTINUE

Rirre is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 03-18-2011 , 18:31   Re: DoD Custom Player Models
Reply With Quote #2

Any errors? Have you tried to debug it? The first thing that I notice is that:

Code:
models/player/test/testT.mdl
models/player/coats/coatsT.mdl
don't meet the requirements for a player model filepath.

They should be:

Code:
models/player/testT/testT.mdl
models/player/coatsT/coatsT.mdl
__________________
fysiks is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 03-18-2011 , 18:43   Re: DoD Custom Player Models
Reply With Quote #3

Quote:
Originally Posted by fysiks View Post
Any errors? Have you tried to debug it? The first thing that I notice is that:

Code:
models/player/test/testT.mdl
models/player/coats/coatsT.mdl
don't meet the requirements for a player model filepath.

They should be:

Code:
models/player/testT/testT.mdl
models/player/coatsT/coatsT.mdl
No, xxxxT.mdl are just extensions for xxxx.mdl, you can easily decompile and recompile into 1 single file.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 03-18-2011 , 18:48   Re: DoD Custom Player Models
Reply With Quote #4

Quote:
Originally Posted by ConnorMcLeod View Post
No, xxxxT.mdl are just extensions for xxxx.mdl, you can easily decompile and recompile into 1 single file.
Umm . . . ok. I guess I don't totally understand player models then.
__________________
fysiks is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 03-19-2011 , 07:12   Re: DoD Custom Player Models
Reply With Quote #5

Yes you do, that's not specific to players models, any model can have such extensions.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Rirre
Veteran Member
Join Date: Nov 2006
Old 04-03-2011 , 13:29   Re: DoD Custom Player Models
Reply With Quote #6

*Bump*
Rirre is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 04-03-2011 , 13:35   Re: DoD Custom Player Models
Reply With Quote #7

if(!is_user_connected(id))
{

}

So you understand what means '!' ? The check means : "If player with id as index is not connected".
You use that everywhere and of course it can't work because you do things only when player is disconnected.
__________________

Last edited by Arkshine; 04-03-2011 at 13:38.
Arkshine is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 04-03-2011 , 14:12   Re: DoD Custom Player Models
Reply With Quote #8

- Rires -
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Rirre
Veteran Member
Join Date: Nov 2006
Old 04-03-2011 , 18:19   Re: DoD Custom Player Models
Reply With Quote #9

Quote:
Originally Posted by Arkshine View Post
if(!is_user_connected(id))
{

}

So you understand what means '!' ? The check means : "If player with id as index is not connected".
You use that everywhere and of course it can't work because you do things only when player is disconnected.
Thanks!
Just copied "if(!is_user_connected(id))" from another plugin source and didn't notice "!" in front of it.
Now it works Thanks!
Rirre is offline
Reply


Thread Tools
Display Modes

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 14:38.


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