AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   DoD Custom Player Models (https://forums.alliedmods.net/showthread.php?t=153079)

Rirre 03-18-2011 09:12

DoD Custom Player Models
 
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



fysiks 03-18-2011 18:31

Re: DoD Custom Player Models
 
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


ConnorMcLeod 03-18-2011 18:43

Re: DoD Custom Player Models
 
Quote:

Originally Posted by fysiks (Post 1435544)
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.

fysiks 03-18-2011 18:48

Re: DoD Custom Player Models
 
Quote:

Originally Posted by ConnorMcLeod (Post 1435549)
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.

ConnorMcLeod 03-19-2011 07:12

Re: DoD Custom Player Models
 
Yes you do, that's not specific to players models, any model can have such extensions.

Rirre 04-03-2011 13:29

Re: DoD Custom Player Models
 
*Bump*

Arkshine 04-03-2011 13:35

Re: DoD Custom Player Models
 
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.

ConnorMcLeod 04-03-2011 14:12

Re: DoD Custom Player Models
 
- Rires -

Rirre 04-03-2011 18:19

Re: DoD Custom Player Models
 
Quote:

Originally Posted by Arkshine (Post 1443874)
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!


All times are GMT -4. The time now is 14:38.

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