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

use an ini file to...


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
scriptyboy
BANNED
Join Date: Sep 2005
Old 09-28-2005 , 12:10   use an ini file to...
Reply With Quote #1

Hi i was wondering if someone could help me link this plugin to a .ini file to set a certain model to a steam id

Code:
#include <amxmodx>  #include <amxmisc>  #include <cstrike>  public plugin_init() {          register_plugin("CHICKEN SUIT", "0.1", "boadmin")          register_event("ResetHUD", "resetModel", "b")          return PLUGIN_CONTINUE  }  public plugin_precache() {          precache_model("models/player/chickensuit/chickensuit.mdl")          return PLUGIN_CONTINUE  }  public resetModel(id, level, cid) {          new authid[50]            get_user_authid(id,authid,49)            if(equali(authid,"STEAM_0:0:123456")) {                    new CsTeams:userTeam = cs_get_user_team(id)                  if (userTeam == CS_TEAM_T) {                          cs_set_user_model(id, "chickensuit")                  }                  else if(userTeam == CS_TEAM_CT) {                          cs_set_user_model(id, "chickensuit")                  }                  else {                          cs_reset_user_model(id)                  }          }          return PLUGIN_CONTINUE  }
scriptyboy is offline
Xanimos
Veteran Member
Join Date: Apr 2005
Location: Florida
Old 09-28-2005 , 13:34  
Reply With Quote #2

Using my idea?
Code:
#include <amxmodx> #include <amxmisc> #define MAX_STUFF  64 /* / How it works g_szInfo[i][0] = AuthID g_szInfo[i][1] = Model / */ new g_szInfo[MAX_STUFF][2][65] new g_iCount = 0 public plugin_init() {     ReadFile() //... } public ReadFile() {     new szFile[66]     get_configsdir( szFile , 65 )     format(szFile , 65 , "%s/models.ini",szFile)     if(!file_exists(szFile))     {         log_amx("[ChickenSuit] File ^"%s^" doestn exist. Please insure its there.")         return PLUGIN_HANDLED     }     new szLine[101] , line = 0, len = 0     while(read_file(szFile, line++ , szLine , 100 , len) && (g_iCount < MAX_STUFF) )     {         if(szLine[0] == ';' || !len) continue         strbreak(szLine, g_szInfo[g_iCount][0] , 63 , g_szInfo[g_iCount][1] , 63)         g_iCount++     }     return } //Your code revised public plugin_precache() {      for(new i = 0; i < g_iCount; i++)     {        precache_model(g_szInfo[i][1])   //I think this should work.        //If it doesnt work try adding "g_szInfo[i][1] =  " before precache_model     } }    public resetModel(id, level, cid) {          new authid[50]            get_user_authid(id,authid,49)            for(new i = 0; i <g_iCount; i++)         {              if(equali(authid,g_szInfo[i][0])) {                        new CsTeams:userTeam = cs_get_user_team(id)                      if (userTeam == CS_TEAM_T) {                              cs_set_user_model(id, g_szInfo[i][1])                     }                     else if(userTeam == CS_TEAM_CT) {                             cs_set_user_model(id, g_szInfo[i][1])                     }                     else {                              cs_reset_user_model(id)                     }                }         }          return PLUGIN_CONTINUE  }
Xanimos is offline
Send a message via AIM to Xanimos Send a message via MSN to Xanimos
{NM}Jason
AMX Mod X Beta Tester
Join Date: Mar 2004
Location: Texas
Old 09-28-2005 , 15:23  
Reply With Quote #3

Quote:
Originally Posted by Suicid3
Using my idea?
Code:
#include <amxmodx> #include <amxmisc> #define MAX_STUFF  64 /* / How it works g_szInfo[i][0] = AuthID g_szInfo[i][1] = Model / */ new g_szInfo[MAX_STUFF][2][65] new g_iCount = 0 public plugin_init() {     ReadFile() //... } public ReadFile() {     new szFile[66]     get_configsdir( szFile , 65 )     format(szFile , 65 , "%s/models.ini",szFile)     if(!file_exists(szFile))     {         log_amx("[ChickenSuit] File ^"%s^" doestn exist. Please insure its there.")         return PLUGIN_HANDLED     }     new szLine[101] , line = 0, len = 0     while(read_file(szFile, line++ , szLine , 100 , len) && (g_iCount < MAX_STUFF) )     {         if(szLine[0] == ';' || !len) continue         strbreak(szLine, g_szInfo[g_iCount][0] , 63 , g_szInfo[g_iCount][1] , 63)         g_iCount++     }     return } //Your code revised public plugin_precache() {      for(new i = 0; i < g_iCount; i++)     {        precache_model(g_szInfo[i][1])   //I think this should work.        //If it doesnt work try adding "g_szInfo[i][1] =  " before precache_model     } }    public resetModel(id, level, cid) {          new authid[50]            get_user_authid(id,authid,49)            for(new i = 0; i <g_iCount; i++)         {              if(equali(authid,g_szInfo[i][0])) {                        new CsTeams:userTeam = cs_get_user_team(id)                      if (userTeam == CS_TEAM_T) {                              cs_set_user_model(id, g_szInfo[i][1])                     }                     else if(userTeam == CS_TEAM_CT) {                             cs_set_user_model(id, g_szInfo[i][1])                     }                     else {                              cs_reset_user_model(id)                     }                }         }          return PLUGIN_CONTINUE  }
hey that was my idea :-( .. the hole ini thing that is :-(
__________________
http://forums.alliedmods.net/showthr...396#post451396
Quote:
Originally Posted by BAILOPAN View Post
Shortly after posting that image, Jason crushed the truck into a ball with his hands, and tossed it over his shoulder.
{NM}Jason is offline
Send a message via ICQ to {NM}Jason Send a message via AIM to {NM}Jason Send a message via MSN to {NM}Jason Send a message via Yahoo to {NM}Jason
smallwimpyboy
Senior Member
Join Date: Aug 2005
Location: United States
Old 09-28-2005 , 15:26  
Reply With Quote #4

Lol i think im the one who got him to Use it tho i pmed him
smallwimpyboy is offline
Send a message via AIM to smallwimpyboy Send a message via MSN to smallwimpyboy
{NM}Jason
AMX Mod X Beta Tester
Join Date: Mar 2004
Location: Texas
Old 09-28-2005 , 15:30  
Reply With Quote #5

good otherwise the plugin would have been useless, unless he can hook the users.ini and check for admin flags or make a completely diffrent add on fly user system that in game console he types add_mdl_user <name> <mdl> and it add's it to the ini .. very simple
__________________
http://forums.alliedmods.net/showthr...396#post451396
Quote:
Originally Posted by BAILOPAN View Post
Shortly after posting that image, Jason crushed the truck into a ball with his hands, and tossed it over his shoulder.
{NM}Jason is offline
Send a message via ICQ to {NM}Jason Send a message via AIM to {NM}Jason Send a message via MSN to {NM}Jason Send a message via Yahoo to {NM}Jason
smallwimpyboy
Senior Member
Join Date: Aug 2005
Location: United States
Old 09-28-2005 , 15:35  
Reply With Quote #6

Ya it is
smallwimpyboy is offline
Send a message via AIM to smallwimpyboy Send a message via MSN to smallwimpyboy
scriptyboy
BANNED
Join Date: Sep 2005
Old 09-28-2005 , 16:28  
Reply With Quote #7

got these errors compiling locally:

Code:
// C:\WINDOWS\DESKTOP\SCRIPTING\chickensuit.sma(40) : warning 209: function "Rea
dFile" should return a value
// C:\WINDOWS\DESKTOP\SCRIPTING\chickensuit.sma(57) : error 017: undefined symbo
l "cs_get_user_team"
// C:\WINDOWS\DESKTOP\SCRIPTING\chickensuit.sma(58) : warning 213: tag mismatch
// C:\WINDOWS\DESKTOP\SCRIPTING\chickensuit.sma(58) : error 017: undefined symbo
l "CS_TEAM_T"
// C:\WINDOWS\DESKTOP\SCRIPTING\chickensuit.sma(59) : error 017: undefined symbo
l "cs_set_user_model"
// C:\WINDOWS\DESKTOP\SCRIPTING\chickensuit.sma(61) : warning 217: loose indenta
tion
// C:\WINDOWS\DESKTOP\SCRIPTING\chickensuit.sma(61) : error 017: undefined symbo
l "CS_TEAM_CT"
// C:\WINDOWS\DESKTOP\SCRIPTING\chickensuit.sma(62) : error 017: undefined symbo
l "cs_set_user_model"
// C:\WINDOWS\DESKTOP\SCRIPTING\chickensuit.sma(65) : error 017: undefined symbo
l "cs_reset_user_model"
//
// 6 Errors.
// Could not locate output file compiled\chickensuit.amx (compile failed).
//
// Compilation Time: 1.1 sec
// ----------------------------------------
scriptyboy is offline
smallwimpyboy
Senior Member
Join Date: Aug 2005
Location: United States
Old 09-28-2005 , 16:42  
Reply With Quote #8

Code:
#include <cstrike>
smallwimpyboy is offline
Send a message via AIM to smallwimpyboy Send a message via MSN to smallwimpyboy
scriptyboy
BANNED
Join Date: Sep 2005
Old 09-28-2005 , 16:48  
Reply With Quote #9

Ok thanks to the cstrike include we are now down to this.

Code:
// C:\WINDOWS\DESKTOP\SCRIPTING\chickensuit.sma(41) : warning 209: function "ReadFile" should return a value
// C:\WINDOWS\DESKTOP\SCRIPTING\chickensuit.sma(62) : warning 217: loose indentation
scriptyboy is offline
smallwimpyboy
Senior Member
Join Date: Aug 2005
Location: United States
Old 09-28-2005 , 16:49  
Reply With Quote #10

Send me your current code
smallwimpyboy is offline
Send a message via AIM to smallwimpyboy Send a message via MSN to smallwimpyboy
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 07:19.


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