Can't load any FilterScripts (Server.cfg)
#1

I've been trying for days, but ever since I got 0.3d server, I can't load any filterscripts through the Server.cfg. Here's what I get whenever I run the samp-server:


----------
Loaded log file: "server_log.txt".
----------

SA-MP Dedicated Server
----------------------
v0.3d RC4, ©2005-2011 SA-MP Team

[11:39:48]
[11:39:48] Server Plugins
[11:39:48] --------------
[11:39:48] Loaded 0 plugins.

[11:39:49]
[11:39:49] Filterscripts
[11:39:49] ---------------
[11:39:49] Loading filterscript 'logreg.amx'...

And this is not an example, this is the exact stuff straight from the server_log. Please help, this has been happening ever since I got 0.3d and I want to take advantage of the current stuff so don't say go back to 0.3c.
Reply
#2

Show us your server.cfg.
Reply
#3

echo Executing Server Config...
lanmode 0
rcon_password rcon1234
maxplayers 20
port 7777
hostname San Andreas Roleplayas
gamemode0 team_dm2 1
announce 1
query 1
weburl www.sa-mp.com
onfoot_rate 40
incar_rate 40
weapon_rate 40
stream_distance 300.0
stream_rate 1000
maxnpc 1
logtimeformat [%H:%M:%S]
timestamp 1
filterscripts logreg
Reply
#4

You should re-compile your scripts with 0.3d includes.
Reply
#5

Okay. With the filterscript "logreg", these are its includes:
#include <a_samp>
#include <dini>
#include <dudb>
#include <dutils>

What do I replace these with?
Reply
#6

Simply press F5 in pawno will compile that and it will work fine.
Reply
#7

But it still has problems D:
It's still doing the same thing, it says loading but never does load D:
Reply
#8

Show "logreg.pwn" to check if it compiles right!
Reply
#9

Before I post, note: the file is now called "logreg_system" (temporary)(Also, I tried my best to remove all the excess callbacks):

pawn Код:
// This is a comment
// uncomment the line below if you want to write a filterscript
#define FILTERSCRIPT

#include <a_samp>
#include <dini>
#include <dudb>
#include <dutils>

#pragma unused ret_memcpy

new IsLogged[MAX_PLAYERS];
new LoginAttempts[MAX_PLAYERS];

enum pInfo
{
    AdminLevel,
    Cash,
}
new PlayerInfo[MAX_PLAYERS][pInfo];
public OnFilterScriptInit()
{
    new x=0;
    while(x<MAX_PLAYERS)
    {
        LoginAttempts[x]=0;
    }
    return 1;
}
public OnPlayerConnect(playerid)
{
    SendClientMessage(playerid,0xCC0033AA,"Haven't signed up? /register [password]");
    SendClientMessage(playerid,0x006633AA,"Have signed up? /login [password]");
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    LoginAttempts[playerid]=0;
    return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
    new cmd[256],idx,file[128],tmp[256];
    cmd=strtok(cmdtext,idx);
    if(strcmp(cmd, "/register", true) == 0)
    {
      new name[MAX_PLAYER_NAME];
      tmp = strtok(cmdtext, idx);
      GetPlayerName(playerid, name, sizeof(name));
      if(!strlen(tmp)) return SendClientMessage(playerid, 0xFFFFFFFF, "USAGE: /register [password]");
      format(file,sizeof(file),"%s.ini",name);
      if(!fexist(file))
            {
              dini_Create(file);
              dini_IntSet(file, "Password", udb_hash(tmp));
              dini_IntSet(file,"AdminLevel", 0);
              dini_IntSet(file,"Cash", 0);
              SendClientMessage(playerid, 0x006633AA, "[System]: Account Created!");
              GetPlayerName(playerid, name, sizeof(name));
              printf("%s has registered a account!", name);
            }
            else
            {
              SendClientMessage(playerid, 0xCC0033AA, " Account Already Found In Database");
            }
      return 1;
    }
    if(strcmp(cmd, "/login", true) == 0)
    {
      new PlayerName[24];
      tmp = strtok(cmdtext, idx);
      new tmp2[256];
      new name[MAX_PLAYER_NAME];
      if(!strlen(tmp)) return SendClientMessage(playerid, 0xFFFFFFFF, "USAGE: /login [password]");
      if(IsLogged[playerid] == 1)
        {
            SendClientMessage(playerid, 0xCC0033AA, "You already are logged in!");
            return 1;
        }
        else
        {
            GetPlayerName(playerid, name, sizeof(name));
            format(file,sizeof(file),"%s.ini",name);
            if(fexist(file))
            {
                tmp2 = dini_Get(file, "Password");
                if(udb_hash(tmp) != strval(tmp2))
                {
                  SendClientMessage(playerid, 0xCC0033AA, "Login Failed!");
                  GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
                  printf("%s has failed to login", name);
                }
                else
                {
                    IsLogged[playerid] = 1;
                    SetPlayerMoney(playerid, dini_Int(file, "Cash"));
                    PlayerInfo[playerid][AdminLevel] = dini_Int(file, "AdminLevel");
                    SendClientMessage(playerid, 0xCC0033AA, "[System]: Account Logged into!");
                }
            }
        }
      return 1;
    }
    return 0;
}
public OnPlayerRequestSpawn(playerid)
{
    if(IsLogged[playerid] == 0)
    {
        SendClientMessage(playerid, 0xCC0033AA, "SERVER: You have not logged in yet.");
        if(LoginAttempts[playerid]<2)
        {
        Kick(playerid);
        }
        return 1;
    }
    return 1;
}
Reply
#10

He really did crash, but I made some corrections and it is working perfectly now!

pawn Код:
// This is a comment
// uncomment the line below if you want to write a filterscript
#define FILTERSCRIPT

#include <a_samp>
#include <dini>
#include <dudb>
#include <dutils>

#pragma unused ret_memcpy

new IsLogged[MAX_PLAYERS];
new LoginAttempts[MAX_PLAYERS];

enum pInfo
{
    AdminLevel,
    Cash,
}
new PlayerInfo[MAX_PLAYERS][pInfo];
public OnFilterScriptInit()
{
    return 1;
}
public OnPlayerConnect(playerid)
{
    LoginAttempts[playerid] = 0;
    SendClientMessage(playerid,0xCC0033AA,"Haven't signed up? /register [password]");
    SendClientMessage(playerid,0x006633AA,"Have signed up? /login [password]");
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    LoginAttempts[playerid]=0;
    return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
    new cmd[256],idx,file[128],tmp[256];
    cmd=strtok(cmdtext,idx);
    if(strcmp(cmd, "/register", true) == 0)
    {
      new name[MAX_PLAYER_NAME];
      tmp = strtok(cmdtext, idx);
      GetPlayerName(playerid, name, sizeof(name));
      if(!strlen(tmp)) return SendClientMessage(playerid, 0xFFFFFFFF, "USAGE: /register [password]");
      format(file,sizeof(file),"%s.ini",name);
      if(!fexist(file))
            {
              dini_Create(file);
              dini_IntSet(file, "Password", udb_hash(tmp));
              dini_IntSet(file,"AdminLevel", 0);
              dini_IntSet(file,"Cash", 0);
              SendClientMessage(playerid, 0x006633AA, "[System]: Account Created!");
              GetPlayerName(playerid, name, sizeof(name));
              printf("%s has registered a account!", name);
            }
            else
            {
              SendClientMessage(playerid, 0xCC0033AA, " Account Already Found In Database");
            }
      return 1;
    }
    if(strcmp(cmd, "/login", true) == 0)
    {
      new PlayerName[24];
      tmp = strtok(cmdtext, idx);
      new tmp2[256];
      new name[MAX_PLAYER_NAME];
      if(!strlen(tmp)) return SendClientMessage(playerid, 0xFFFFFFFF, "USAGE: /login [password]");
      if(IsLogged[playerid] == 1)
        {
            SendClientMessage(playerid, 0xCC0033AA, "You already are logged in!");
            return 1;
        }
        else
        {
            GetPlayerName(playerid, name, sizeof(name));
            format(file,sizeof(file),"%s.ini",name);
            if(fexist(file))
            {
                tmp2 = dini_Get(file, "Password");
                if(udb_hash(tmp) != strval(tmp2))
                {
                  SendClientMessage(playerid, 0xCC0033AA, "Login Failed!");
                  GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
                  printf("%s has failed to login", name);
                }
                else
                {
                    IsLogged[playerid] = 1;
                    SetPlayerMoney(playerid, dini_Int(file, "Cash"));
                    PlayerInfo[playerid][AdminLevel] = dini_Int(file, "AdminLevel");
                    SendClientMessage(playerid, 0xCC0033AA, "[System]: Account Logged into!");
                }
            }
        }
      return 1;
    }
    return 0;
}
public OnPlayerRequestSpawn(playerid)
{
    if(IsLogged[playerid] == 0)
    {
        SendClientMessage(playerid, 0xCC0033AA, "SERVER: You have not logged in yet.");
        if(LoginAttempts[playerid]<2)
        {
        Kick(playerid);
        }
        return 1;
    }
    return 1;
}
strtok(const string[], &index)
{
    new length = strlen(string);
    while ((index < length) && (string[index] <= ' '))
    {
        index++;
    }

    new offset = index;
    new result[20];
    while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
    {
        result[index - offset] = string[index];
        index++;
    }
    result[index - offset] = EOS;
    return result;
}
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)