Admin FS wont load
#1

Why would this not load? It compiles fine but when I start my server it fails to load, also how to make a player admin with this? Do you know?

pawn Код:
#define FILTERSCRIPT

#include <a_samp>
#include <dudb>
#include <zcmd>
#include <sscanf>

#pragma unused strtok
#pragma unused ret_memcpy
//Colors

new Warns[MAX_PLAYERS];
new AdminMode[MAX_PLAYERS];
new IsFrozen[MAX_PLAYERS];
new IsSpectating[MAX_PLAYERS];
forward SendAdminMessage(msg[]);
forward PlayerName(playerid);
forward BanWeapon(playerid);
forward AntiCheat();

//PlayerFiles
new PLAYERLIST_authed[MAX_PLAYERS];

#define Admin 0x33CCFFAA
#define Player 0xFF9900AA
public OnFilterScriptInit()
{
    print("\n Karagon's Admin Filterscript");
    print(" Use with permission. Leave my name in.");
    print(" Copyright 2011 by Karagon. \n");
    return 1;
}

public OnFilterScriptExit()
{
    print("\n Karagon's Admin Filterscript UNLOADED.");
    print(" FS Unloaded........");
    return 1;
}

//////////////////////////////////////////////////////////////////////

command(adcmds, playerid, params[])
{
    if(IsPlayerAdmin(playerid))
    {
        SendClientMessage(playerid, Admin, "--------(ADMIN COMMANDS)--------");
        SendClientMessage(playerid, Admin, "/adcmds [Show Admin Commands (1)] /adban (playerid) [Bans a player];");
        SendClientMessage(playerid, Admin, "/adkick (playerid) [Kicks a player] /adfreeze (playerid) [Freezes a player];");
        SendClientMessage(playerid, Admin, "/adunfr (playerid) [Unfreezes a Player] /adkill (playerid) [Kills a Player];");
        SendClientMessage(playerid, Admin, "/goto (playerid) [Goes to a Player] /bring (playerid) [Brings you to a Player];");
        SendClientMessage(playerid, Admin, "/admin (message) [Talks with *Admin] /ac (message) [Admin Chat];");
        SendClientMessage(playerid, Admin, "/spec (playerid) [Spectates a Player] /specoff [Turns Spectate OFF];");
        SendClientMessage(playerid, Admin, "/warn (playerid) [Warns a Player] /ann (message) [Announces Something];");
        SendClientMessage(playerid, Admin, "/admode [Goes into Admin Mode with Minigun and Unlimited Health] /adoff [Goes out of Admin Mode];");
        SendClientMessage(playerid, Admin, "/jetpack [Gives you a JetPack] /skininfo [Gives Info on Skins] /myskin (SkinID) [Changes your Skin]");
        SendClientMessage(playerid, Admin, "/credits [Shows Credits (All People)]");
        return 1;
    }
    SendClientMessage(playerid, Admin, "Invalid Command");
    return 1;
}

command(commands, playerid, params[])
{
    SendClientMessage(playerid, Player, "-------(PLAYER COMMANDS)-------");
    SendClientMessage(playerid, Player, "/commands [Shows Player Commands] /message (message) or /me (message) [Message];");
    SendClientMessage(playerid, Player, "/register (password) [Registers for a Player File to save stats] /login (password) [Logs in to a player file]");
    SendClientMessage(playerid, Player, "/credits [Shows Credits]");
    return 1;
 }
command(adban, playerid, params[])
{
    new string[128];
    new ID;
    new pname[128];
    new aname[128];
    GetPlayerName(ID, pname, sizeof(pname));
    GetPlayerName(playerid, aname, sizeof(aname));
    if(IsPlayerAdmin(playerid))
        {
            if(sscanf(params, "i", ID))
            {
                SendClientMessage(playerid, Admin, "Usage: /adban [playerid]");
                return 1;
            }
            if(!IsPlayerConnected(ID))
            {
                SendClientMessage(playerid, Admin, "That player ID is not available.");
                return 1;
            }
            format(string, sizeof(string), "*ADMIN BAN: %s(%d)", pname, ID);
            SendClientMessageToAll(Admin, string);
            format(string, sizeof(string), "Banned by: %s", aname);
            BanEx(ID, string);
            return 1;
        }
    SendClientMessage(playerid, Admin, "Invalid Command");
    return 1;
}

command(adkick, playerid, params[])
{
    new string[128];
    new ID;
    new pname[128];
    GetPlayerName(ID, pname, sizeof(pname));
    if(IsPlayerAdmin(playerid))
    {
        if(sscanf(params, "i", ID))
        {
            SendClientMessage(playerid, Admin, "Usage: /adkick [playerid]");
            return 1;
        }
        if(!IsPlayerConnected(ID))
        {
            SendClientMessage(playerid, Admin, "Invalid Player ID");
            return 1;
        }
        format(string, sizeof(string), "*ADMIN KICK: %s(%d)", pname, ID);
        SendClientMessageToAll(Admin, string);
        Kick(ID);
        return 1;
    }
    SendClientMessage(playerid, Admin, "Invalid Command.");
    return 1;
}

command(adfreeze, playerid, params[])
{
    new string[128];
    new ID;
    new pname[128];
    GetPlayerName(ID, pname, sizeof(pname));
    if(IsPlayerAdmin(playerid))
    {
        if(sscanf(params, "i", ID))
        {
            SendClientMessage(playerid, Admin, "Usage: /adfreeze [playerid]");
            return 1;
        }
        if(!IsPlayerConnected(ID))
        {
            SendClientMessage(playerid, Admin, "Invalid Player ID");
            return 1;
        }
        if(IsFrozen[ID] ==1 )
        {
            SendClientMessage(playerid, Admin, "That player is already frozen.");
            return 1;
        }
        IsFrozen[ID] =1;
        format(string, sizeof(string), "*ADMIN FREEZE: %s(%d)", pname, ID);
        SendClientMessageToAll(Admin, string);
        SendClientMessage(playerid, Admin, "ADMIN FROZEN! YOU CANNOT MOVE!");
        TogglePlayerControllable(ID, 0);
        return 1;
    }
    SendClientMessage(playerid, Admin, "Invalid Command");
    return 1;
}

command(adunfr, playerid, params[])
{
    new string[128];
    new pname[128];
    new ID;
    GetPlayerName(ID, pname, sizeof(pname));
    if(IsPlayerAdmin(playerid))
    {
        if(sscanf(params, "i", ID))
        {
            SendClientMessage(playerid, Admin, "Usage: /adunfr [playerid]");
            return 1;
        }
        if(!IsPlayerConnected(ID))
        {
            SendClientMessage(playerid, Admin, "Invalid Player ID");
            return 1;
        }
        format(string, sizeof(string), "*ADMIN UNFREEZE: %s(%d)", pname, ID);
        SendClientMessageToAll(Admin, string);
        SendClientMessage(playerid, Admin, "ADMIN UNFROZEN! YOU CAN NOW MOVE!");
        TogglePlayerControllable(ID, 1);
        return 1;
    }
    SendClientMessage(playerid, Admin, "Invalid Command.");
    return 1;
}

command(adkill, playerid, params[])
{
    new string[128];
    new pname[128];
    new ID;
    GetPlayerName(ID, pname, sizeof(pname));
    if(IsPlayerAdmin(playerid))
    {
        if(sscanf(params, "i", ID))
        {
            SendClientMessage(playerid, Admin, "Usage: /adkill [playerid]");
            return 1;
        }
        if(!IsPlayerConnected(ID))
        {
            SendClientMessage(playerid, Admin, "Invalid Player ID");
            return 1;
        }
        format(string, sizeof(string), "*ADMIN KILL: %s(%d)", pname, ID);
        SendClientMessageToAll(Admin, string);
        SendClientMessage(playerid, Admin, "ADMIN KILLED! YOU HAVE BEEN ADMIN KILLED!");
        SetPlayerHealth(ID, 0);
        return 1;
    }
    SendClientMessage(playerid, Admin, "Invalid Command");
    return 1;
}

command(goto, playerid, params[])
{
    new string[128];
    new ID;
    new pname[128];
    GetPlayerName(ID, pname, sizeof(pname));
    if(IsPlayerAdmin(playerid))
    {
        if(sscanf(params, "i", ID))
        {
            SendClientMessage(playerid, Admin, "Usage: /goto (playerid)");
            return 1;
        }
        if(!IsPlayerConnected(ID))
        {
            SendClientMessage(playerid, Admin, "That player ID is not connected.");
            return 1;
        }
        new Float:x, Float:y, Float:z;
        GetPlayerPos(ID, x, y, z);
        SetPlayerPos(playerid, x, y, z);
        SetPlayerPos(playerid,x+1,y,z);
        SetPlayerVirtualWorld(playerid,GetPlayerVirtualWorld(ID));
        SetPlayerInterior(playerid,GetPlayerInterior(ID));
        format(string, sizeof(string), "You have teleported to %s(%d)", pname, ID);
        SendClientMessage(playerid, Admin, string);
        return 1;
    }
    SendClientMessage(playerid, Admin, "Invalid Command");
    return 1;
}

command(bring, playerid, params[])
{
    new string[128];
    new ID;
    new pname[128];
    GetPlayerName(ID, pname, sizeof(pname));
    if(IsPlayerAdmin(playerid))
    {
        if(sscanf(params, "i", ID))
        {
            SendClientMessage(playerid, Admin, "Usage: /bring (playerid)");
            return 1;
        }
        if(!IsPlayerConnected(ID))
        {
            SendClientMessage(playerid, Admin, "Invalid Player ID");
            return 1;
        }
        new Float:x, Float:y, Float:z;
        GetPlayerPos(playerid, x, y, z);
       
        SetPlayerPos(ID, x+1, y, z);
        SetPlayerVirtualWorld(ID, GetPlayerVirtualWorld(playerid));
        SetPlayerInterior(ID, GetPlayerInterior(playerid));
        format(string, sizeof(string), "You have brought %s(%d) to you.", pname, ID);
        SendClientMessage(playerid, Admin, string);
        return 1;
    }
    SendClientMessage(playerid, Admin, "Invalid Command");
    return 1;
}

command(admin, playerid, params[])
{
    new string[128];
    if(IsPlayerAdmin(playerid))
    {
        if(!strlen(params))
        {
            SendClientMessage(playerid, Admin, "Usage: /admin (message)");
            return 1;
        }
        format(string, sizeof(string), "*Admin: %s", params);
        SendClientMessageToAll(Admin, string);
        return 1;
    }
    SendClientMessage(playerid, Admin, "Invalid Command");
    return 1;
}

command(ac, playerid, params[])
{
    new string[128];
    new pname[128];
    GetPlayerName(playerid, pname, sizeof(pname));
    if(IsPlayerAdmin(playerid))
    {
        if(!strlen(params))
        {
            SendClientMessage(playerid, Admin, "Usage: /ac (message)");
            return 1;
        }
        format(string, sizeof(string), "*Admin Chat* %s(%d): %s", pname, playerid, params);
        SendAdminMessage(string);
        return 1;
    }
    SendClientMessage(playerid, Admin, "Invalid Command");
    return 1;
}

command(spec, playerid, params[])
{
    new ID;
    new pname[128];
    GetPlayerName(ID, pname, sizeof(pname));
    if(IsPlayerAdmin(playerid))
    {
        if(sscanf(params, "i", ID))
        {
            SendClientMessage(playerid, Admin, "Usage: /spec (playerid)");
            return 1;
        }
        if(!IsPlayerConnected(ID))
        {
            SendClientMessage(playerid, Admin, "Invalid player ID");
            return 1;
        }
        TogglePlayerSpectating(playerid, 1);
        PlayerSpectatePlayer(playerid, ID);
        SetPlayerInterior(playerid, ID);
        SetPlayerInterior(playerid, GetPlayerInterior(ID));
        IsSpectating[playerid] =1;
        return 1;
    }
    SendClientMessage(playerid, Admin, "Invalid Command");
    return 1;
}

command(specoff, playerid, params[])
{
    #pragma unused params
    if(IsSpectating[playerid] == 1)
    {
        TogglePlayerSpectating(playerid, 0);
        IsSpectating[playerid] =0;
        return 1;
    }
    return 1;
}

command(warn, playerid, params[])
{
    new ID;
    new pname[128];
    GetPlayerName(ID, pname, sizeof(pname));
    new string[128];
    if(IsPlayerAdmin(playerid))
    {
        if(sscanf(params, "i", ID))
        {
            SendClientMessage(playerid, Admin, "Usage: /warn (playerid)");
            return 1;
        }
        if(!IsPlayerConnected(ID))
        {
            SendClientMessage(playerid, Admin, "Invalid ID");
            return 1;
        }
        if(Warns[playerid] == 2)
        {
            format(string, sizeof(string), "*Auto Kick* %s(%d) Too many Admin Warnings", pname, ID);
            SendClientMessageToAll(Admin, string);
            SendClientMessage(ID, Admin, "You have been kicked for too many Admin Warnings. Please follow the rules!");
            return 1;
        }
        if(Warns[playerid] == 1)
        {
            format(string, sizeof(string), "*Admin Warn* %s(%d) has been warned by an Admin to follow the rules.", pname, ID);
            SendClientMessageToAll(Admin, string);
            SendClientMessage(ID, Admin, "You have been warned to abide by the rules! Please do so! This is your Second Warning. One more and it's a kick.");
            Warns[playerid] +=1;
            return 1;
        }
        if(Warns[playerid] == 0)
        {
            format(string, sizeof(string), "*Admin Warn* %s(%d) has been warned by an Admin to follow the rules.", pname, ID);
            SendClientMessageToAll(Admin, string);
            SendClientMessage(ID, Admin, "You have been warned by an Admin to follow the rules. Please do so now. This is your First Warning.");
            Warns[playerid] +=1;
            return 1;
        }
    }
    SendClientMessage(playerid, Admin, "Invalid Command");
    return 1;
}

command(ann, playerid, params[])
{
    new string[128];
    if(IsPlayerAdmin(playerid))
    {
        if(!strlen(params))
        {
            SendClientMessage(playerid, Admin, "Usage: /ann (message)");
            return 1;
        }
        format(string, sizeof(string), "%s", params);
        GameTextForAll(string, 5000, 0);
        return 1;
    }
    SendClientMessage(playerid, Admin, "Invalid Command");
    return 1;
}

command(admode, playerid, params[])
{
    #pragma unused params
    if(IsPlayerAdmin(playerid))
    {
        AdminMode[playerid] =1;
        SetPlayerHealth(playerid, 9999.99);
        SetPlayerArmour(playerid, 9999.99);
        GivePlayerWeapon(playerid, 38, 9999999);
        SendClientMessage(playerid, Admin, "*Admin Mode* You are now in Admin Mode.");
        return 1;
    }
    SendClientMessage(playerid, Admin, "Invalid Command");
    return 1;
}

command(adoff, playerid, params[])
{
    #pragma unused params
    if(IsPlayerAdmin(playerid))
    {
        if(AdminMode[playerid] == 1)
        {
        SetPlayerHealth(playerid, 100);
        SetPlayerArmour(playerid, 100);
        ResetPlayerWeapons(playerid);
        SendClientMessage(playerid, Admin, "*Admin Mode Off* You are now out of Admin Mode.");
        return 1;
        }
        SendClientMessage(playerid, Admin, "You are not in Admin Mode.");
        return 1;
    }
    SendClientMessage(playerid, Admin, "Invalid Command.");
    return 1;
}

command(jetpack, playerid, params[])
{
    #pragma unused params
    if(IsPlayerAdmin(playerid))
    {
        SetPlayerSpecialAction(playerid,SPECIAL_ACTION_USEJETPACK);
        SendClientMessage(playerid, Admin, "You have spawned a jetpack.");
        return 1;
    }
    SendClientMessage(playerid, Admin, "Invalid Command.");
    return 1;
}

command(myskin, playerid, params[])
{
    new skin;
    if(IsPlayerAdmin(playerid))
    {
        if(sscanf(params, "i", skin))
        {
            SendClientMessage(playerid, Admin, "Usage: /myskin (SkinID)");
            return 1;
        }
        SetPlayerSkin(playerid, skin);
    }
    SendClientMessage(playerid, Admin, "Invalid Command.");
    return 1;
}

command(skininfo, playerid, params[])
{
    #pragma unused params
    if(IsPlayerAdmin(playerid))
    {
        SendClientMessage(playerid, Admin, "Skins that WILL CRASH THE SERVER: 3, 4, 5, 6, 7, 8, 42, 65, 74, 86, 119, 149, 208, 268, 273, 289th");
        SendClientMessage(playerid, Admin, "DO NOT USE THOSE!");
        return 1;
    }
    SendClientMessage(playerid, Admin, "Invalid Command.");
    return 1;
}

command(credits, playerid, params[])
{
    #pragma unused params
    SendClientMessage(playerid, Admin, "Admin FilterScript created by Karagon!");
    return 1;
}

//Player Commmands

command(message, playerid, params[])
{
    new string[128];
    new pname[128];
    GetPlayerName(playerid, pname, sizeof(pname));
    if(!strlen(params))
    {
        SendClientMessage(playerid, Player, "Usage: /message (message)");
        return 1;
    }
    format(string, sizeof(string), "*MESSAGE* %s(%d): %s", pname, playerid, params);
    SendClientMessageToAll(Player, string);
    return 1;
}

command(me, playerid, params[])
{
    new string[128];
    new pname[128];
    GetPlayerName(playerid, pname, sizeof(pname));
    if(!strlen(params))
    {
        SendClientMessage(playerid, Player, "Usage: /message (message)");
        return 1;
    }
    format(string, sizeof(string), "*MESSAGE* %s(%d): %s", pname, playerid, params);
    SendClientMessageToAll(Player, string);
    return 1;

}

command(register, playerid, params[])
{
    if(PLAYERLIST_authed[playerid])
    {
        SendClientMessage(playerid, Player, "You are already logged in.");
        return 1;
    }
    if(udb_Exists(PlayerName(playerid)))
    {
        SendClientMessage(playerid, Player, "That player name is already registerd. Please /login (password)");
        return 1;
    }
    if(strlen(params)==0)
    {
        SendClientMessage(playerid, Player, "Usage: /register (password)");
        return 1;
    }
   
    if(udb_Create(PlayerName(playerid), params))
    {
        dUserSetINT(PlayerName(playerid)).("Score", 0);
        //dUserSetINT(PlayerName(playerid)).("WHAT EVER HERE", 0);
        SendClientMessage(playerid, Player, "Your account has been created!");
        return 1;
    }
    return true;
}

command(login, playerid, params[])
{
    if(PLAYERLIST_authed[playerid])
    {
        SendClientMessage(playerid, Player, "You are already logged in!");
        return 1;
    }
    if(!udb_Exists(PlayerName(playerid)))
    {
        SendClientMessage(playerid, Player, "That player name already exits. Login please.");
        return 1;
    }
    if(udb_CheckLogin(PlayerName(playerid), params))
    {
        SetPlayerScore(playerid, dUserINT(PlayerName(playerid)).("Score")-GetPlayerScore(playerid));
        PLAYERLIST_authed[playerid]=true;
        SendClientMessage(playerid, Player, "You are now logged in.");
        return 1;
    }
    SendClientMessage(playerid, Player, "Login Failed.");
    return 1;
}
//-----Stocks------///
public SendAdminMessage(msg[])
{
    for(new i=0; i<MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            if(IsPlayerAdmin(i))
            {
                SendClientMessage(i, Admin, msg);
            }
        }
    }
}

public AntiCheat()
{

    for(new i=0; i<MAX_PLAYERS; i++)
    {
        new string[128];
        new opname[22];
        GetPlayerName(i, opname, 22);
        if(IsPlayerConnected(i))
        {
            if(BanWeapon(i))
            {
                if(!IsPlayerAdmin(i))
                {
                    format(string, sizeof(string), "*AUTO BAN* %s(%d) has been auto banned by the Anti Cheat", opname, i);
                    SendClientMessageToAll(Admin, string);
                    BanEx(i, "Anti Cheat: Spawning an Illegal Weapon");
                    return 1;
                }
            }
            new SpecialAction = GetPlayerSpecialAction(i);
            if(SpecialAction == SPECIAL_ACTION_USEJETPACK)
            {
                if(!IsPlayerAdmin(i))
                {
                    format(string, sizeof(string), "*AUTO BAN* %s(%d) has been Auto Banned by the Anti Cheat", opname, i);
                    SendClientMessageToAll(Admin, string);
                    BanEx(i, "Anti Cheat: Jetpack spawn");
                    return 1;
                }
            }
            if(GetPlayerMoney(i) > 500000000)
            {
                format(string, sizeof(string), "*AUTO BAN* %s(%d) has been Auto Banned by the Anti Cheat", opname, i);
                BanEx(i, "AntiCheat: Money Spawning");
                return 1;
            }
        }
    }
    return 1;
}

public BanWeapon(playerid)
{
    if(GetPlayerWeapon(playerid) == 16 || GetPlayerWeapon(playerid) == 17 || GetPlayerWeapon(playerid) == 35 ||
    GetPlayerWeapon(playerid) == 36 || GetPlayerWeapon(playerid) == 37 || GetPlayerWeapon(playerid) == 38 ||
    GetPlayerWeapon(playerid) == 39 || GetPlayerWeapon(playerid) == 40 || GetPlayerWeapon(playerid) == 18)
    {
        return 1;
    }
    return 0;
}
stock PlayerName(playerid)
{
    new name[24];
    GetPlayerName(playerid, name, 255);
    return name;
}

public OnPlayerDisconnect(playerid, reason)
{
    if(PLAYERLIST_authed[playerid])
    {
        dUserSetINT(PlayerName(playerid)).("Score", GetPlayerScore(playerid));
    }
    PLAYERLIST_authed[playerid]=false;
    return 1;
}
Reply
#2

Make sure it is in your filterscripts folder and has all appropriate, up to date plugins required in pawno>plugins.
For your making yourself an administrator problem find the file that checks if you are an admin and edit it so you are an administrator
Reply
#3

Also, have you added it to server.cfg?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)