stock..
#1

pawn Код:
public OnGameModeInit()
{
  UpdateConfig();
  return 1;
}
pawn Код:
stock UpdateConfig()
{
    new file[256], File:file2, string[100]; format(file,sizeof(file),"ladmin/config/Config.ini");
    ForbiddenWordCount = 0;
    BadNameCount = 0;
    BadPartNameCount = 0;

    if(!dini_Exists("ladmin/config/aka.txt")) dini_Create("ladmin/config/aka.txt");

    if(!dini_Exists(file))
    {
        dini_Create(file);
        print("\n >Configuration File Successfully Created");
    }

    if(!dini_Isset(file,"MaxPing")) dini_IntSet(file,"MaxPing",1200);
    if(!dini_Isset(file,"ReadPms")) dini_IntSet(file,"ReadPMs",1);
    if(!dini_Isset(file,"ReadCmds")) dini_IntSet(file,"ReadCmds",1);
    if(!dini_Isset(file,"MaxAdminLevel")) dini_IntSet(file,"MaxAdminLevel",5);
    if(!dini_Isset(file,"AdminOnlySkins")) dini_IntSet(file,"AdminOnlySkins",0);
    if(!dini_Isset(file,"AdminSkin")) dini_IntSet(file,"AdminSkin",217);
    if(!dini_Isset(file,"AdminSkin2")) dini_IntSet(file,"AdminSkin2",214);
    if(!dini_Isset(file,"AntiBot")) dini_IntSet(file,"AntiBot",1);
    if(!dini_Isset(file,"AntiSpam")) dini_IntSet(file,"AntiSpam",1);
    if(!dini_Isset(file,"AntiSwear")) dini_IntSet(file,"AntiSwear",1);
    if(!dini_Isset(file,"NameKick")) dini_IntSet(file,"NameKick",1);
    if(!dini_Isset(file,"PartNameKick")) dini_IntSet(file,"PartNameKick",1);
    if(!dini_Isset(file,"NoCaps")) dini_IntSet(file,"NoCaps",0);
    if(!dini_Isset(file,"Locked")) dini_IntSet(file,"Locked",0);
    if(!dini_Isset(file,"SaveWeap")) dini_IntSet(file,"SaveWeap",1);
    if(!dini_Isset(file,"SaveMoney")) dini_IntSet(file,"SaveMoney",1);
    if(!dini_Isset(file,"ConnectMessages")) dini_IntSet(file,"ConnectMessages",1);
    if(!dini_Isset(file,"AdminCmdMessages")) dini_IntSet(file,"AdminCmdMessages",1);
    if(!dini_Isset(file,"AutoLogin")) dini_IntSet(file,"AutoLogin",1);
    if(!dini_Isset(file,"MaxMuteWarnings")) dini_IntSet(file,"MaxMuteWarnings",4);
    if(!dini_Isset(file,"MustLogin")) dini_IntSet(file,"MustLogin",0);
    if(!dini_Isset(file,"MustRegister")) dini_IntSet(file,"MustRegister",0);

    if(dini_Exists(file))
    {
        ServerInfo[MaxPing] = dini_Int(file,"MaxPing");
        ServerInfo[ReadPMs] = dini_Int(file,"ReadPMs");
        ServerInfo[ReadCmds] = dini_Int(file,"ReadCmds");
        ServerInfo[MaxAdminLevel] = dini_Int(file,"MaxAdminLevel");
        ServerInfo[AdminOnlySkins] = dini_Int(file,"AdminOnlySkins");
        ServerInfo[AdminSkin] = dini_Int(file,"AdminSkin");
        ServerInfo[AdminSkin2] = dini_Int(file,"AdminSkin2");
        ServerInfo[AntiBot] = dini_Int(file,"AntiBot");
        ServerInfo[AntiSpam] = dini_Int(file,"AntiSpam");
        ServerInfo[AntiSwear] = dini_Int(file,"AntiSwear");
        ServerInfo[NameKick] = dini_Int(file,"NameKick");
        ServerInfo[PartNameKick] = dini_Int(file,"PartNameKick");
        ServerInfo[NoCaps] = dini_Int(file,"NoCaps");
        ServerInfo[Locked] = dini_Int(file,"Locked");
        ServerInfo[GiveWeap] = dini_Int(file,"SaveWeap");
        ServerInfo[GiveMoney] = dini_Int(file,"SaveMoney");
        ServerInfo[ConnectMessages] = dini_Int(file,"ConnectMessages");
        ServerInfo[AdminCmdMsg] = dini_Int(file,"AdminCmdMessages");
        ServerInfo[AutoLogin] = dini_Int(file,"AutoLogin");
        ServerInfo[MaxMuteWarnings] = dini_Int(file,"MaxMuteWarnings");
        ServerInfo[MustLogin] = dini_Int(file,"MustLogin");
        ServerInfo[MustRegister] = dini_Int(file,"MustRegister");
        print("\n -Configuration Settings Loaded");
    }

    //forbidden names
    if((file2 = fopen("ladmin/config/ForbiddenNames.cfg",io_read)))
    {
        while(fread(file2,string))
        {
            for(new i = 0, j = strlen(string); i < j; i++) if(string[i] == '\n' || string[i] == '\r') string[i] = '\0';
            BadNames[BadNameCount] = string;
            BadNameCount++;
        }
        fclose(file2)printf(" -%d Forbidden Names Loaded", BadNameCount);
    }

    //forbidden part of names
    if((file2 = fopen("ladmin/config/ForbiddenPartNames.cfg",io_read)))
    {
        while(fread(file2,string))
        {
            for(new i = 0, j = strlen(string); i < j; i++) if(string[i] == '\n' || string[i] == '\r') string[i] = '\0';
            BadPartNames[BadPartNameCount] = string;
            BadPartNameCount++;
        }
        fclose(file2)printf(" -%d Forbidden Tags Loaded", BadPartNameCount);
    }

    //forbidden words
    if((file2 = fopen("ladmin/config/ForbiddenWords.cfg",io_read)))
    {
        while(fread(file2,string))
        {
            for(new i = 0, j = strlen(string); i < j; i++) if(string[i] == '\n' || string[i] == '\r') string[i] = '\0';
            ForbiddenWords[ForbiddenWordCount] = string;
            ForbiddenWordCount++;
        }
        fclose(file2)printf(" -%d Forbidden Words Loaded", ForbiddenWordCount);
    }
}
Код:
undefined symbol "UpdateConfig"
Reply
#2

Try without stock, and if it will not work, try to transform the function into a callback
Reply
#3

i have no idea what are you talking about.
but i've tried to make it without stock same error.
Reply
#4

Try this:
pawn Код:
forward UpdateConfig();
public UpdateConfig()
{
    new file[256], File:file2, string[100]; format(file,sizeof(file),"ladmin/config/Config.ini");
    ForbiddenWordCount = 0;
    BadNameCount = 0;
    BadPartNameCount = 0;

    if(!dini_Exists("ladmin/config/aka.txt")) dini_Create("ladmin/config/aka.txt");

    if(!dini_Exists(file))
    {
        dini_Create(file);
        print("\n >Configuration File Successfully Created");
    }

    if(!dini_Isset(file,"MaxPing")) dini_IntSet(file,"MaxPing",1200);
    if(!dini_Isset(file,"ReadPms")) dini_IntSet(file,"ReadPMs",1);
    if(!dini_Isset(file,"ReadCmds")) dini_IntSet(file,"ReadCmds",1);
    if(!dini_Isset(file,"MaxAdminLevel")) dini_IntSet(file,"MaxAdminLevel",5);
    if(!dini_Isset(file,"AdminOnlySkins")) dini_IntSet(file,"AdminOnlySkins",0);
    if(!dini_Isset(file,"AdminSkin")) dini_IntSet(file,"AdminSkin",217);
    if(!dini_Isset(file,"AdminSkin2")) dini_IntSet(file,"AdminSkin2",214);
    if(!dini_Isset(file,"AntiBot")) dini_IntSet(file,"AntiBot",1);
    if(!dini_Isset(file,"AntiSpam")) dini_IntSet(file,"AntiSpam",1);
    if(!dini_Isset(file,"AntiSwear")) dini_IntSet(file,"AntiSwear",1);
    if(!dini_Isset(file,"NameKick")) dini_IntSet(file,"NameKick",1);
    if(!dini_Isset(file,"PartNameKick")) dini_IntSet(file,"PartNameKick",1);
    if(!dini_Isset(file,"NoCaps")) dini_IntSet(file,"NoCaps",0);
    if(!dini_Isset(file,"Locked")) dini_IntSet(file,"Locked",0);
    if(!dini_Isset(file,"SaveWeap")) dini_IntSet(file,"SaveWeap",1);
    if(!dini_Isset(file,"SaveMoney")) dini_IntSet(file,"SaveMoney",1);
    if(!dini_Isset(file,"ConnectMessages")) dini_IntSet(file,"ConnectMessages",1);
    if(!dini_Isset(file,"AdminCmdMessages")) dini_IntSet(file,"AdminCmdMessages",1);
    if(!dini_Isset(file,"AutoLogin")) dini_IntSet(file,"AutoLogin",1);
    if(!dini_Isset(file,"MaxMuteWarnings")) dini_IntSet(file,"MaxMuteWarnings",4);
    if(!dini_Isset(file,"MustLogin")) dini_IntSet(file,"MustLogin",0);
    if(!dini_Isset(file,"MustRegister")) dini_IntSet(file,"MustRegister",0);

    if(dini_Exists(file))
    {
        ServerInfo[MaxPing] = dini_Int(file,"MaxPing");
        ServerInfo[ReadPMs] = dini_Int(file,"ReadPMs");
        ServerInfo[ReadCmds] = dini_Int(file,"ReadCmds");
        ServerInfo[MaxAdminLevel] = dini_Int(file,"MaxAdminLevel");
        ServerInfo[AdminOnlySkins] = dini_Int(file,"AdminOnlySkins");
        ServerInfo[AdminSkin] = dini_Int(file,"AdminSkin");
        ServerInfo[AdminSkin2] = dini_Int(file,"AdminSkin2");
        ServerInfo[AntiBot] = dini_Int(file,"AntiBot");
        ServerInfo[AntiSpam] = dini_Int(file,"AntiSpam");
        ServerInfo[AntiSwear] = dini_Int(file,"AntiSwear");
        ServerInfo[NameKick] = dini_Int(file,"NameKick");
        ServerInfo[PartNameKick] = dini_Int(file,"PartNameKick");
        ServerInfo[NoCaps] = dini_Int(file,"NoCaps");
        ServerInfo[Locked] = dini_Int(file,"Locked");
        ServerInfo[GiveWeap] = dini_Int(file,"SaveWeap");
        ServerInfo[GiveMoney] = dini_Int(file,"SaveMoney");
        ServerInfo[ConnectMessages] = dini_Int(file,"ConnectMessages");
        ServerInfo[AdminCmdMsg] = dini_Int(file,"AdminCmdMessages");
        ServerInfo[AutoLogin] = dini_Int(file,"AutoLogin");
        ServerInfo[MaxMuteWarnings] = dini_Int(file,"MaxMuteWarnings");
        ServerInfo[MustLogin] = dini_Int(file,"MustLogin");
        ServerInfo[MustRegister] = dini_Int(file,"MustRegister");
        print("\n -Configuration Settings Loaded");
    }

    //forbidden names
    if((file2 = fopen("ladmin/config/ForbiddenNames.cfg",io_read)))
    {
        while(fread(file2,string))
        {
            for(new i = 0, j = strlen(string); i < j; i++) if(string[i] == '\n' || string[i] == '\r') string[i] = '\0';
            BadNames[BadNameCount] = string;
            BadNameCount++;
        }
        fclose(file2);  printf(" -%d Forbidden Names Loaded", BadNameCount);
    }

    //forbidden part of names
    if((file2 = fopen("ladmin/config/ForbiddenPartNames.cfg",io_read)))
    {
        while(fread(file2,string))
        {
            for(new i = 0, j = strlen(string); i < j; i++) if(string[i] == '\n' || string[i] == '\r') string[i] = '\0';
            BadPartNames[BadPartNameCount] = string;
            BadPartNameCount++;
        }
        fclose(file2);  printf(" -%d Forbidden Tags Loaded", BadPartNameCount);
    }

    //forbidden words
    if((file2 = fopen("ladmin/config/ForbiddenWords.cfg",io_read)))
    {
        while(fread(file2,string))
        {
            for(new i = 0, j = strlen(string); i < j; i++) if(string[i] == '\n' || string[i] == '\r') string[i] = '\0';
            ForbiddenWords[ForbiddenWordCount] = string;
            ForbiddenWordCount++;
        }
        fclose(file2);  printf(" -%d Forbidden Words Loaded", ForbiddenWordCount);
    }
    return 1;
}
Reply
#5

still same errors .
Reply
#6

If your stock is at the bottom of your script, try putting it at the top of your script, under the includes and #define lines if possible. Try placing it before OnGameModeInit, otherwise, try doing it the other way and vice versa.
Reply
#7

I know this problem, happened to me earlier. You have this stock function top of your script, you should move it to bottom of the script.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)