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

[Request] Plugin skin admin (ON FLAG)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
wizzkidon
Senior Member
Join Date: Jan 2017
Old 02-27-2017 , 08:18   [Request] Plugin skin admin (ON FLAG)
Reply With Quote #1

Hi. I want a plugin who offer skins only admins on. But, i want on flag.
Ex: Admin with flag "K" have skin (only 1 flag)

-- Admin CT (1 skin)
-- Admin T (1 skin)
wizzkidon is offline
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 02-27-2017 , 08:51   Re: [Request] Plugin skin admin (ON FLAG)
Reply With Quote #2

Code:
#include <amxmodx> #include <hamsandwich> #include <fakemeta> #define ADMIN_FLAG ADMIN_PASSWORD new const CT_MODEL[] = "ct_vip" new const T_MODEL[] = "t_vip" new team; public plugin_init() {     register_plugin("Admin Skin", "1.0", "DoNii")     RegisterHam(Ham_Spawn, "player", "fw_HamSpawnPost", 1)     register_forward(FM_SetClientKeyValue, "SetClientKeyValue") } public plugin_precache() {     new ct_model[22], t_model[22];     formatex(ct_model, 21, "models/player/%s/%s.mdl", CT_MODEL);     formatex(t_model, 21, "models/player/%s/%s.mdl", T_MODEL);     precache_model(ct_model);     precache_model(t_model); } public fw_HamSpawnPost(id) {     if(!is_user_alive(id))     return HAM_IGNORED;     if(!(get_user_flags(id) & ADMIN_FLAG))     return HAM_IGNORED;         team = get_user_team(id)         switch(team) {             case 1: {             set_user_info(id, "model", T_MODEL)         }             case 2: {             set_user_info(id, "model", CT_MODEL)         }             }     return HAM_IGNORED; } public SetClientKeyValue(const id, const szInfoBuffer[], const szKey[], const szValue[]) {     if(equal(szKey, "model")) {         if(get_user_flags(id) & ADMIN_FLAG) {             team = get_user_team(id)                         switch(team) {             case 1: {                     if(!equal(szValue, T_MODEL))                     set_user_info(id, "model", T_MODEL)                                         return FMRES_SUPERCEDE;                 }             case 2: {                     if(!equal(szValue, CT_MODEL))                     set_user_info(id, "model", CT_MODEL)                                         return FMRES_SUPERCEDE;                 }             }         }                 return FMRES_SUPERCEDE;     }         return FMRES_IGNORED; }
__________________

Last edited by edon1337; 02-27-2017 at 09:08.
edon1337 is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 02-27-2017 , 08:55   Re: [Request] Plugin skin admin (ON FLAG)
Reply With Quote #3

What about precache?
What's the purpose of the "team" variable?
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 02-27-2017 , 09:10   Re: [Request] Plugin skin admin (ON FLAG)
Reply With Quote #4

Quote:
Originally Posted by OciXCrom View Post
What about precache?
Sorry, I forgot it. Fixed.

Quote:
Originally Posted by OciXCrom View Post
What's the purpose of the "team" variable?
1) To cache the value of get_user_team.
2) It's global so no need to create var 'team' 2 times (fw_HamSpawnPost, SetClientKeyValue).
__________________
edon1337 is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 02-27-2017 , 09:12   Re: [Request] Plugin skin admin (ON FLAG)
Reply With Quote #5

Caching is used when you're using the function more than once. Right now you're creating a redundant variable that has no purpose of being there. You can directly do switch(get_user_team(id)).
__________________

Last edited by OciXCrom; 02-27-2017 at 09:13.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 02-27-2017 , 09:15   Re: [Request] Plugin skin admin (ON FLAG)
Reply With Quote #6

Quote:
Originally Posted by OciXCrom View Post
Caching is used when you're using the function more than once. Right now you're creating a redundant variable that has no purpose of being there. You can directly do switch(get_user_team(id)).
It's ok like this too
__________________
edon1337 is offline
wizzkidon
Senior Member
Join Date: Jan 2017
Old 02-27-2017 , 09:17   Re: [Request] Plugin skin admin (ON FLAG)
Reply With Quote #7

I need with flag "K" for exemple. Only 1 flag. (because i have another plugin for owner skins with: abcdefgijlmnopqrstu
And "k" for normal admins if you understand me

Or.. If you want, make me another plugin, 2 in 1.

Last edited by wizzkidon; 02-27-2017 at 09:18.
wizzkidon is offline
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 02-27-2017 , 09:18   Re: [Request] Plugin skin admin (ON FLAG)
Reply With Quote #8

.... how about you try it first?
__________________
edon1337 is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 02-27-2017 , 09:21   Re: [Request] Plugin skin admin (ON FLAG)
Reply With Quote #9

Quote:
Originally Posted by edon1337 View Post
It's ok like this too
It's ok, but it's not correct. You should know this for future creations.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 02-27-2017 , 09:22   Re: [Request] Plugin skin admin (ON FLAG)
Reply With Quote #10

Quote:
Originally Posted by OciXCrom View Post
It's ok, but it's not correct. You should know this for future creations.
I will, thanks.
__________________
edon1337 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 03:22.


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