AlliedModders

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

asd13 09-29-2009 14:02

Player model Change
 
Would this code work?

Code:

#include <amxmodx>
#include <cstrike>
#include <amxmisc>

#define PLUGIN_NAME "vipas"
#define PLUGIN_AUTHOR "Kukulis"
#define PLUGIN_VERSION "0.1"

public plugin_init()
{
register_plugin(PLUGIN_NAME, PLUGIN_AUTHOR, PLUGIN_VERSION);

return PLUGIN_CONTINUE

}

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

return PLUGIN_CONTINUE
}

public resetModel(id, level, cid) {
if (get_user_flags(id) & ADMIN_CVAR) {
new CsTeams:userTeam = cs_get_user_team(id)
if (userTeam == CS_TEAM_T) {
cs_set_user_model(id, "smith")
}
else if(userTeam == CS_TEAM_CT) {
cs_set_user_model(id, "smith")
}
else {
cs_reset_user_model(id)
}
}

return PLUGIN_CONTINUE
}

I took this piece of code from
http://forums.alliedmods.net/showthr...light=vip+skin
And deleted not needed stuff what i did not need.

Arkshine 09-29-2009 14:05

Re: Player model Change
 
No, it would not.

asd13 09-29-2009 14:08

Re: Player model Change
 
Why not? Please can you or someone correct this code then.

Arkshine 09-29-2009 14:10

Re: Player model Change
 
resetModel is never called.

asd13 09-29-2009 14:27

Re: Player model Change
 
If i would remove
Code:

}
else {
cs_reset_user_model(id)

It would work?

Arkshine 09-29-2009 14:37

Re: Player model Change
 
I mean the function resetModel() is not called from any others functions or forward/command etc.

asd13 09-30-2009 10:45

Re: Player model Change
 
Now this changes the model but after round restart :(
How can can it be so that model is changed instandly without of needing restartround

Code:

#include <amxmodx>
#include <cstrike>
 
enum
{
    TEAM_UNASSIGNED,
    TEAM_T,
    TEAM_CT,
    TEAM_SPECTATOR
};

public plugin_precache() {
    precache_model("models/player/smith/smith.mdl")
    precache_model("models/player/smith/smith.mdl")
}
 
public plugin_init() {
    register_plugin("Vip Model", "1.0", "Author");
    register_event("ResetHUD", "ResetHUD", "be");
}

public ResetHUD(Client) {
    if (!is_user_alive(Client))
            return;

    new CsTeams:Team = cs_get_user_team(Client);

    switch (Team)
    {
        case TEAM_T:
        {
                if (get_user_flags(Client) & ADMIN_BAN) cs_set_user_model(Client, "smith");
                else cs_reset_user_model(Client);
        }
        case TEAM_CT:
        {
                if (get_user_flags(Client) & ADMIN_BAN) cs_set_user_model(Client, "smith");
                else cs_reset_user_model(Client);
        }
    }
}



All times are GMT -4. The time now is 22:32.

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