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

Add Terror too in Plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Godofwar
AlliedModders Donor
Join Date: Dec 2015
Location: Germany
Old 05-22-2018 , 05:14   Add Terror too in Plugin
Reply With Quote #1

Hello, can anyone add Terrorist too in this Plugin please?

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 plugin_precache() {         
    precache_model("models/player/vipp/vipp.mdl") 
    precache_model("models/player/admin/admin.mdl") 
    precache_model("models/player/super_admin/super_admin.mdl") 
    precache_model("models/player/owner/owner.mdl") 

        return PLUGIN_CONTINUE 
} 

public resetModel(id, level, cid) { 
    new CsTeams:userTeam = cs_get_user_team(id) 
     
    // VIPS 
        if (get_user_flags(id) & ADMIN_LEVEL_H) { 
                if(userTeam == CS_TEAM_CT) { 
                        cs_set_user_model(id, "vipp") 
                } 
                else { 
                        cs_reset_user_model(id) 
                } 
        } 
    // Admins 
        else if (get_user_flags(id) & ADMIN_KICK) { 
                if(userTeam == CS_TEAM_CT) { 
                        cs_set_user_model(id, "admin") 
                } 
                else { 
                        cs_reset_user_model(id) 
                } 
        } 
    // Super Admins 
        else if (get_user_flags(id) & ADMIN_LEVEL_D) { 
                if(userTeam == CS_TEAM_CT) { 
                        cs_set_user_model(id, "super_admin") 
                } 
                else { 
                        cs_reset_user_model(id) 
                } 
        } 
    // Owners 
        else if (get_user_flags(id) & ADMIN_LEVEL_C) { 
                if(userTeam == CS_TEAM_CT) { 
                        cs_set_user_model(id, "owner") 
                } 
                else { 
                        cs_reset_user_model(id) 
                } 
        } 

        return PLUGIN_CONTINUE 
}
Godofwar is offline
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 05-22-2018 , 08:38   Re: Add Terror too in Plugin
Reply With Quote #2

I don't understand why there's return PLUGIN_CONTINUE in every public function but okay... anyways here you go, should work

Code:
#include <amxmodx> #include <cstrike> public plugin_init() {     register_plugin("AMX Admin Model", "1.1.1", "whitemike")     register_event("ResetHUD", "resetModel", "b") } public plugin_precache() {              precache_model("models/player/vipp/vipp.mdl")     precache_model("models/player/admin/admin.mdl")     precache_model("models/player/super_admin/super_admin.mdl")     precache_model("models/player/owner/owner.mdl") } public resetModel(id) {         // VIPS     if (get_user_flags(id) & ADMIN_LEVEL_H) {         cs_set_user_model(id, "vipp")     }     // Admins     else if (get_user_flags(id) & ADMIN_KICK) {         cs_set_user_model(id, "admin")     }     // Super Admins     else if (get_user_flags(id) & ADMIN_LEVEL_D) {         cs_set_user_model(id, "super_admin")     }     // Owners     else if (get_user_flags(id) & ADMIN_LEVEL_C) {         cs_set_user_model(id, "owner")     } }
__________________

Last edited by Napoleon_be; 05-22-2018 at 12:40.
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
D3XT3R
AlliedModders Donor
Join Date: Nov 2016
Location: Lithuania, Bomb A (Kauna
Old 05-22-2018 , 11:15   Re: Add Terror too in Plugin
Reply With Quote #3

Quote:
Originally Posted by Napoleon_be View Post
I don't understand why there's return PLUGIN_CONTINUE in every public function but okay... anyways here you go, should work

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 plugin_precache() {              precache_model("models/player/vipp/vipp.mdl")     precache_model("models/player/admin/admin.mdl")     precache_model("models/player/super_admin/super_admin.mdl")     precache_model("models/player/owner/owner.mdl")         return PLUGIN_CONTINUE } public resetModel(id, level, cid) {         // VIPS     if (get_user_flags(id) & ADMIN_LEVEL_H) {         cs_set_user_model(id, "vipp")     }     // Admins     else if (get_user_flags(id) & ADMIN_KICK) {         cs_set_user_model(id, "admin")     }     // Super Admins     else if (get_user_flags(id) & ADMIN_LEVEL_D) {         cs_set_user_model(id, "super_admin")     }     // Owners     else if (get_user_flags(id) & ADMIN_LEVEL_C) {         cs_set_user_model(id, "owner")     }     return PLUGIN_CONTINUE }

could be optimized using switch(). Also, only using id at resethud would be enough.

Code:
#include <amxmodx> #include <amxmisc> #include <cstrike> public plugin_init() {     register_plugin("AMX Admin Model", "1.1.1", "whitemike")     register_event("ResetHUD", "resetModel", "b") } public plugin_precache() {              precache_model("models/player/vipp/vipp.mdl")     precache_model("models/player/admin/admin.mdl")     precache_model("models/player/super_admin/super_admin.mdl")     precache_model("models/player/owner/owner.mdl") } public resetModel(id) {     switch(get_user_flags(id)) {         case ADMIN_LEVEL_H:     cs_set_user_model(id, "vipp") // VIPS         case ADMIN_KICK:    cs_set_user_model(id, "admin") // Admins         case ADMIN_LEVEL_D: cs_set_user_model(id, "super_admin") // Super Admins         case ADMIN_LEVEL_C: cs_set_user_model(id, "owner")  // Owners     } }

Correct me if i'm wrong though.
just i want ask you .... what you do, you just optimazed the code, the request is to add the terror...
__________________
D3XT3R is offline
Send a message via Skype™ to D3XT3R
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 05-22-2018 , 12:04   Re: Add Terror too in Plugin
Reply With Quote #4

Mate, if you would know just SOMETHING about scripting, you would see that the first code has been changed to his needs and should work for both teams now. The second code was just an optimization suggestion which does the exact same as his request. So both codes should work for both teams, second code is just optimized. Snappie?
__________________

Last edited by Napoleon_be; 05-22-2018 at 12:06.
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
Natsheh
Veteran Member
Join Date: Sep 2012
Old 05-22-2018 , 12:23   Re: Add Terror too in Plugin
Reply With Quote #5

There is only 1 parameter in resetHUD(id) event so remove the 2, 3 param.

Napoleon_be your switch method is incorrect since the get user flag return a bitsum value so you are checking if it equals instead of contains
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !


Last edited by Natsheh; 05-22-2018 at 12:29.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 05-22-2018 , 12:39   Re: Add Terror too in Plugin
Reply With Quote #6

Quote:
Originally Posted by Natsheh View Post
There is only 1 parameter in resetHUD(id) event so remove the 2, 3 param.

Napoleon_be your switch method is incorrect since the get user flag return a bitsum value so you are checking if it equals instead of contains
That's the thing i wasn't sure about, customized my post, thanks for the feedback.
__________________
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
Godofwar
AlliedModders Donor
Join Date: Dec 2015
Location: Germany
Old 05-22-2018 , 14:09   Re: Add Terror too in Plugin
Reply With Quote #7

Thx Napoleon will try.
Godofwar 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:42.


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