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

fix my plugin...crashes server. PLEASE!


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
scriptyboy
BANNED
Join Date: Sep 2005
Old 10-13-2005 , 08:59   fix my plugin...crashes server. PLEASE!
Reply With Quote #1

Ok...i have tried alot of things, but my plugin seems to still crash the server...Heres the code.

Code:
#include <amxmodx>      #include <amxmisc>      #include <cstrike>      #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()      {          register_plugin("playermodel", "0.2", "scriptyboy")            register_event("ResetHUD", "resetModel", "b")            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^" does not exist.",szFile)              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 PLUGIN_CONTINUE      }      public plugin_precache() {            for(new i = 0; i < g_iCount; i++)          {             precache_model(g_szInfo[i][1])     }      }          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, "model" )                    }                           else if(userTeam == CS_TEAM_CT) {                                   cs_set_user_model(id, "model" )                    }                           else {                                   cs_reset_user_model(id)                           }                      }              }                return PLUGIN_CONTINUE        }
scriptyboy is offline
scriptyboy
BANNED
Join Date: Sep 2005
Old 10-13-2005 , 12:55  
Reply With Quote #2

BUMP
scriptyboy is offline
Zenith77
Veteran Member
Join Date: Aug 2005
Old 10-13-2005 , 13:12  
Reply With Quote #3

Code:
cs_set_user_model(id, "model" )

Probably because your trying to change it to a model that doesnt exist.


Code:
cs_set_user_model(id, g_szInfo[id][0] )


p.s. system looks screwed up to me.
__________________
Quote:
Originally Posted by phorelyph View Post
your retatred
Zenith77 is offline
[ --<-@ ] Black Rose
ANNIHILATED
Join Date: Sep 2005
Location: Stockholm, Sweden.
Old 10-13-2005 , 13:54  
Reply With Quote #4

it IS
[ --<-@ ] Black Rose is offline
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 10-13-2005 , 15:20  
Reply With Quote #5

a) You set the model to "model" as previously pointed out.

b) plugin_precache is called before plugin_init, so the g_szInfo array will be empty and nothing will get precached. try putting ReadFile() at the start of plugin_precache instead of the end of plugin_init?

c) it's possible that there could be something wrong with your while() statement that reads the file which is causing an infinite loop, but I'm not sure, only try messing with that if nothing else works.
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
scriptyboy
BANNED
Join Date: Sep 2005
Old 10-14-2005 , 12:22  
Reply With Quote #6

Does this look right and can someone test it for me??

Code:
#include <amxmodx>        #include <amxmisc>        #include <cstrike>      #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()        {            register_plugin("playermodel", "0.2", "scriptyboy")            register_event("ResetHUD", "resetModel", "b")      }        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^" does not exist.",szFile)              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 PLUGIN_CONTINUE        }      public plugin_precache() {              ReadFile()     for(new i = 0; i < g_iCount; i++)            {               precache_model(g_szInfo[i][1])     }        }          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[id][0] )                     }                             else if(userTeam == CS_TEAM_CT) {                                     cs_set_user_model(id, g_szInfo[id][0] )                     }                             else {                                     cs_reset_user_model(id)                             }                        }                }                  return PLUGIN_CONTINUE          }
Attached Files
File Type: zip playermodel.zip (6.0 KB, 72 views)
File Type: sma Get Plugin or Get Source (playermodel.sma - 877 views - 2.2 KB)
scriptyboy is offline
scriptyboy
BANNED
Join Date: Sep 2005
Old 10-18-2005 , 12:30  
Reply With Quote #7

oh...another thing...is there a way to make it load the model on thie first round instead of it loading after the first round ends?
scriptyboy 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 06:08.


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