AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Hard coding steamid into an amxx plugin (https://forums.alliedmods.net/showthread.php?t=25071)

ltcjohnson 03-07-2006 09:34

Hard coding steamid into an amxx plugin
 
I want to hard code peoples steamid into a plugin because there isnt enough custom admin levels. What would be the best way to go about it?

What would I need to change to have it use steam id instead of the ADMIN_LEVEL_A ect...?

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/admin_ct/admin_male_ct.mdl")     precache_model("models/player/admin_te/admin_male_te.mdl")     precache_model("models/player/admin_ct/admin_girl_ct.mdl")     precache_model("models/player/admin_te/admin_girl_te.mdl") } public resetModel(id, level, cid) {           if (get_user_flags(id) & ADMIN_LEVEL_A) {                   new CsTeams:userTeam = cs_get_user_team(id)                   if (userTeam == CS_TEAM_T) {                           cs_set_user_model(id, "admin_male_te")         }                   else if(userTeam == CS_TEAM_CT) {                           cs_set_user_model(id, "admin_male_ct")         }                   else {             cs_reset_user_model(id)         }     }           if (get_user_flags(id) & ADMIN_LEVEL_B) {                   new CsTeams:userTeam = cs_get_user_team(id)                   if (userTeam == CS_TEAM_T) {                           cs_set_user_model(id, "admin_girl_te")         }                   else if(userTeam == CS_TEAM_CT) {                           cs_set_user_model(id, "admin_girl_ct")         }                   else {                           cs_reset_user_model(id)         }     }     return PLUGIN_CONTINUE }

Rixorster 03-07-2006 09:42

Well, i posted this already, why wont you try this:
Code:
new steamid[32] get_user_authid(id, steamid, 31)
and:
Code:
new authedSteamId[32] authedSteamId = STEAM_ID_HERE if(steamid == authedSteamId) {     //your code }


off-topic:
Also, why have you people given me -5 karma? ;D

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/admin_ct/admin_male_ct.mdl")     precache_model("models/player/admin_te/admin_male_te.mdl")     precache_model("models/player/admin_ct/admin_girl_ct.mdl")     precache_model("models/player/admin_te/admin_girl_te.mdl") } public resetModel(id, level, cid) {     new steamid[32]     get_user_authid(id, steamid, 31)     new authedSteamId[32]     authedSteamId[id] = STEAM_ID_HERE     if(steamid == authedSteamId) {         if (get_user_flags(id) & ADMIN_LEVEL_A) {                       new CsTeams:userTeam = cs_get_user_team(id)                       if (userTeam == CS_TEAM_T) {                               cs_set_user_model(id, "admin_male_te")             }                       else if(userTeam == CS_TEAM_CT) {                               cs_set_user_model(id, "admin_male_ct")             }                       else {                 cs_reset_user_model(id)             }         }               if (get_user_flags(id) & ADMIN_LEVEL_B) {                       new CsTeams:userTeam = cs_get_user_team(id)                       if (userTeam == CS_TEAM_T) {                               cs_set_user_model(id, "admin_girl_te")             }                       else if(userTeam == CS_TEAM_CT) {                               cs_set_user_model(id, "admin_girl_ct")             }                       else {                           cs_reset_user_model(id)             }         }     return PLUGIN_CONTINUE }

organizedKaoS 03-07-2006 14:33

If your trying to set models to different people by steamids, I would suggest this plugin.

http://forums.alliedmods.net/showthread.php?t=1768

It uses a seperate .ini file which stores steamids and models for steamids. Players do not need to be admin to be in this file.(If you wanted to give the number one player in the server a model and he wasnt admin) And you wouldnt have to change the .sma everytime you get or lose an admin. Hope I helped. :lol:


All times are GMT -4. The time now is 20:29.

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