Raised This Month: $12 Target: $400
 3% 

Models questions


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Unkolix
Veteran Member
Join Date: Sep 2012
Old 10-06-2012 , 03:12   Models questions
Reply With Quote #1

I want a script that would make VIP have a random model (Bender1, 2,3 or 4)
But I only know how to change the model:
PHP Code:
public resetModel(idlevelcid
{
    if (
get_user_flags(id) & ADMIN_LEVEL_H
    {
        
cs_set_user_model(id"Random")
    }
    return 
PLUGIN_CONTINUE

And I want to know how to change knife model, pistol model, hands model and sleeves models.

Last edited by Unkolix; 10-06-2012 at 05:31.
Unkolix is offline
Bos93
Veteran Member
Join Date: Jul 2010
Old 10-06-2012 , 06:26   Re: Models questions
Reply With Quote #2

use Ham_Spawn,for change player model and Ham_Deploy - weapon models
__________________
Bos93 is offline
Send a message via ICQ to Bos93 Send a message via Skype™ to Bos93
Unkolix
Veteran Member
Join Date: Sep 2012
Old 10-06-2012 , 07:23   Re: Models questions
Reply With Quote #3

Ok, thanks but how to make it be random between these models: Bender1,Bender2,Bender3,Bender4?
Unkolix is offline
Bos93
Veteran Member
Join Date: Jul 2010
Old 10-06-2012 , 07:25   Re: Models questions
Reply With Quote #4

PHP Code:
switch( random_num) )
{
     case 
1cs_set_user_model(id"bender1")
     case 
2cs_set_user_model(id"bender2")
     case 
3cs_set_user_model(id"bender3")
     case 
4cs_set_user_model(id"bender4")

__________________

Last edited by Bos93; 10-06-2012 at 07:26.
Bos93 is offline
Send a message via ICQ to Bos93 Send a message via Skype™ to Bos93
Unkolix
Veteran Member
Join Date: Sep 2012
Old 10-06-2012 , 07:46   Re: Models questions
Reply With Quote #5

Do I have to precashe all those models? BTW it doesn't work for me.

Last edited by Unkolix; 10-06-2012 at 07:51.
Unkolix is offline
Bos93
Veteran Member
Join Date: Jul 2010
Old 10-06-2012 , 08:25   Re: Models questions
Reply With Quote #6

precache - yes

show code
__________________
Bos93 is offline
Send a message via ICQ to Bos93 Send a message via Skype™ to Bos93
.Dare Devil.
Veteran Member
Join Date: Sep 2010
Old 10-06-2012 , 10:41   Re: Models questions
Reply With Quote #7

PHP Code:
new bender[8], random_num1)
formatbendercharsmax(bender), "bender%d")
cs_set_user_model(idbender
.Dare Devil. is offline
Unkolix
Veteran Member
Join Date: Sep 2012
Old 10-06-2012 , 11:55   Re: Models questions
Reply With Quote #8

Code I use:
PHP Code:
new const g_ModelNames[][] =
{
    
"Bender1""Bender2""Bender3""Bender4"
}
...
public 
plugin_precache()
{
    
precache_model("models/player/DeathRunVip/Bender1.mdl")
    
precache_model("models/player/DeathRunVip/Bender2.mdl")
    
precache_model("models/player/DeathRunVip/Bender3.mdl")
    
precache_model("models/player/DeathRunVip/Bender4.mdl")
}
...
public 
plugin_init()
{
        ...
        
register_event("ResetHUD""resetModel""b")
        ...
}
...
public 
resetModel(idlevelcid
{
    if (
get_user_flags(id) & ADMIN_LEVEL_H
    {
        
cs_set_user_modelidg_ModelNamesrandomsizeofg_ModelNames ) ) ] )
    }
    return 
PLUGIN_CONTINUE


Last edited by Unkolix; 10-06-2012 at 11:58.
Unkolix is offline
guipatinador
SourceMod Donner Party
Join Date: Oct 2009
Location: Poortugal
Old 10-06-2012 , 12:09   Re: Models questions
Reply With Quote #9

PHP Code:
precache_model("models/player/DeathRunVip/Bender1.mdl"
You can't do that. The path should be models/player/ABC/ABC.mdl (ABC is just an example).

Use this,

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

static PLUGIN[ ] = "New Plug-In"
static VERSION[ ] = "1.0.0"
static AUTHOR[ ] = "author"

#define VIP_FLAG ADMIN_LEVEL_H

new bool:is_vip33 ]

new const 
g_ModelNames[ ][ ] = {
    
"Bender1",
    
"Bender2",
    
"Bender3",
    
"Bender4"
}

public 
plugin_precache( )
{
    new 
szModelPath128 ]
    new 
i
    
for( 0sizeof g_ModelNamesi++ )
    {
        
formatexszModelPathcharsmaxszModelPath ), "models/player/%s/%s.mdl"g_ModelNames] )
        
precache_modelszModelPath )
    }
}

public 
plugin_init( )
{
    
register_pluginPLUGINVERSIONAUTHOR )
    
    
RegisterHamHam_Spawn"player""FwdPlayerSpawnPost")
}

public 
client_authorizedid )
{
    if( 
get_user_flagsid ) & VIP_FLAG )
        
is_vipid ] = true
    
    
else
        
is_vipid ] = false
}

public 
FwdPlayerSpawnPostid )
{
    if( 
is_user_aliveid ) && is_vipid ] )
    {
        new 
iNum randomsizeof g_ModelNames )
        
cs_set_user_modelidg_ModelNamesiNum ] )
    }


Last edited by guipatinador; 10-06-2012 at 12:22.
guipatinador is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 10-06-2012 , 12:12   Re: Models questions
Reply With Quote #10

To make your code easier to modify, I suggest you use a loop when precaching using your g_ModelNames array. This way, when you add or remove a model, the only thing you have to do is change this one array.
__________________
fysiks 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:21.


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