AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Player model changes. (https://forums.alliedmods.net/showthread.php?t=154278)

egbertjan 04-05-2011 12:25

Player model changes.
 
Hello I got a diablo mod server and I wanted to give assassins their own player model. When I added this to the script it compiled without any trouble, but when I picked the assassin race the server crashes. Does anyone see anything wrong or any improvements?

PHP Code:

        if(player_class[id] == Assassin && cs_get_user_team(id) == CS_TEAM_CT
        {
          
cs_set_user_model(id"models/diablomod/dbo/AssassinCT.mdl")
        }

        if(
player_class[id] == Assassin && cs_get_user_team(id) == CS_TEAM_T
        {
          
cs_set_user_model(id"models/diablomod/dbo/AssassinT.mdl")
        } 

P.S. The precache also works just fine.

Arkshine 04-05-2011 12:51

Re: Player model changes.
 
It should be "AssassinCT" and "AssassinT"

ConnorMcLeod 04-05-2011 13:39

Re: Player model changes.
 
Also, folder has to be named with the same name as model, and has to be put directly in player folder.

models/player/MODELNAME/MODELNAME.mdl

And don't forget to precache models.

egbertjan 04-05-2011 15:02

Re: Player model changes.
 
Thanks for the quick replies. When I have followed your reactions I come with a compilation error that says it's losing it's identation. From the beginning of the "if(player_class[id] == Assassin && cs_get_user_team(id) == CS_TEAM_CT)"
to the last bracket of the "
if(player_class[id] == Assassin && cs_get_user_team(id) == CS_TEAM_T)"
Would there be any reason for this?

padilha007 04-05-2011 15:25

Re: Player model changes.
 
post your code hear, it's more easy to help you.

egbertjan 04-05-2011 16:00

Re: Player model changes.
 
It's quite some big script so I will just post the essential things:
PHP Code:

new ASSASSINT[]  = "models/player/AsassinT/AssassinT.mdl"
new ASSASSINCT[]  = "models/player/AsassinCT/AssassinCT.mdl" 

PHP Code:

public plugin_precache()

    
precache_model("ASSASSINCT")
    
precache_model("ASSASSINT")


PHP Code:

//more script parts here. but would make it look messy so I will just post 
//the model part here

if (is_user_connected(id))
    {
        if(
player_class[id] == Assassin && cs_get_user_team(id) == CS_TEAM_CT
        {
          
cs_set_user_model(id"ASSASSINCT")
        }

        if(
player_class[id] == Assassin && cs_get_user_team(id) == CS_TEAM_T
        {
          
cs_set_user_model(id"ASSASSINT")
        } 
     } 


Arkshine 04-05-2011 16:01

Re: Player model changes.
 
cs_set_user_model(id, "ASSASSINCT") -> AssassinT

"models/player/MyModel/MyModel.mdl ; cs_set_user_model needs MyModel.

egbertjan 04-05-2011 16:09

Re: Player model changes.
 
Sorry I didn't quite understand the last sentance, Right now I got the following:

PHP Code:

new AssassinT[]  = "models/player/AssassinT/AssassinT.mdl"
new AssassinCT[]  = "models/player/AssassinCT/AssassinCT.mdl"


    
precache_model(AssassinCT)
    
precache_model(AssassinT)

  if(
player_class[id] == Assassin && cs_get_user_team(id) == CS_TEAM_CT
        {
          
cs_set_user_model(id"AssassinCT")
        }

        if(
player_class[id] == Assassin && cs_get_user_team(id) == CS_TEAM_T
        {
          
cs_set_user_model(id"AssassinT")
        } 


I have changed ASSASSIN to Assassin because it looks better, but I think I fixed that through the script now.

egbertjan 04-06-2011 10:50

Re: Player model changes.
 
But still I got 1 compile error with the loose identation.

Edit: It does work, but I still have these loose identations, it won't affect the script?

Arkshine 04-06-2011 11:15

Re: Player model changes.
 
No, it won't affect. It means just your code is not indented properly. You can see well that's not well aligned.


All times are GMT -4. The time now is 19:45.

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