AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Help: Toggle models (https://forums.alliedmods.net/showthread.php?t=74418)

krededk99 07-18-2008 12:59

Help: Toggle models
 
Hey.

I want the following plugin with a toggle on/off cvar.

Ive had some help with it already, but its not working.

Code:

#include <amxmodx>
#include <amxmisc>
#include <cstrike>
 
public plugin_init() {
        register_plugin("AMX Admin Model", "1.1.1", "whitemike")
        register_event("ResetHUD", "resetModel", "b")
        return PLUGIN_CONTINUE
}
public resetModel(id, level, cid) {
        if (get_user_flags(id) & ADMIN_KICK) {
                new CsTeams:userTeam = cs_get_user_team(id)
                if (userTeam == CS_TEAM_T) {
                        cs_set_user_model(id, "admin_te")
                }
                else if(userTeam == CS_TEAM_CT) {
                        cs_set_user_model(id, "admin_ct")
                }
                else {
                        cs_reset_user_model(id)
                }
        }
        return PLUGIN_CONTINUE
}

So far this plugin who have been written by whitemike gives the admin with the corresponding flag; models. But i dont want them on all the time.

Any suggestions? (Im totally newbie at this)

|PJ| Shorty 07-18-2008 15:30

Re: Help: Toggle models
 
Code:

#include <amxmodx>
#include <amxmisc>
#include <cstrike>
 
new pcvar
 
public plugin_init() {
        register_plugin("AMX Admin Model", "1.1.1", "whitemike")
        pcvar=register_cvar("amx_adminmodel","0")
        register_event("ResetHUD", "resetModel", "b")
        return PLUGIN_CONTINUE
}
public resetModel(id, level, cid) {
        if ((get_user_flags(id) & ADMIN_KICK) && get_pcvar_num(pcvar)) {
                new CsTeams:userTeam = cs_get_user_team(id)
                if (userTeam == CS_TEAM_T) {
                        cs_set_user_model(id, "admin_te")
                }
                else if(userTeam == CS_TEAM_CT) {
                        cs_set_user_model(id, "admin_ct")
                }
                else {
                        cs_reset_user_model(id)
                }
        }
        return PLUGIN_CONTINUE
}


atomen 07-18-2008 15:39

Re: Help: Toggle models
 
Quote:

Originally Posted by |PJ| Shorty (Post 654699)
Code:

#include <amxmodx>
#include <amxmisc>
#include <cstrike>
 
new pcvar
 
public plugin_init() {
        register_plugin("AMX Admin Model", "1.1.1", "whitemike")
        pcvar=register_cvar("amx_adminmodel","0")
        register_event("ResetHUD", "resetModel", "b")
        return PLUGIN_CONTINUE
}
public resetModel(id, level, cid) {
        if ((get_user_flags(id) & ADMIN_KICK) && get_pcvar_num(pcvar)) {
                new CsTeams:userTeam = cs_get_user_team(id)
                if (userTeam == CS_TEAM_T) {
                        cs_set_user_model(id, "admin_te")
                }
                else if(userTeam == CS_TEAM_CT) {
                        cs_set_user_model(id, "admin_ct")
                }
                else {
                        cs_reset_user_model(id)
                }
        }
        return PLUGIN_CONTINUE
}


That script doesn't work in-game.
Though I've already helped him.

|PJ| Shorty 07-18-2008 15:43

Re: Help: Toggle models
 
i havenīt tested it, but why not


All times are GMT -4. The time now is 05:37.

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