samp.directory
← Scripts and libraries

emmett-white/samp-admin-system

No description on GitHub.

Library★ 7updated Mar 2021No licencePawnsampctl
Open on GitHub

This repository has no licence file. It is public to read, but that alone does not give permission to reuse it.

Install with sampctl

sampctl package install emmett-white/samp-admin-system

Run this in your project folder. sampctl downloads the package and what it depends on.

Try it in the Pawn compiler →

Adds its include files, with the libraries it depends on, to the Pawn compiler in your browser, ready to include in a script.

Depends on 3 packages

README.md

samp-admin-system

Installation

Simply install to your project:

sampctl package install emmett-white/samp-admin-system

Include in your code and begin using the library:

#include <admin-system>

Info

Systems


SystemsStatus
Kick system✅
Ban system✅
Mute system✅
Jail system✅

Functions

stock Admin_GetMaxAdminLevel()
stock Admin_SetPlayerAdminLevel(const playerid, const level = 0, const code = 0)
stock Admin_SetPlayerAdminCode(const playerid, const code = 0)
stock Admin_GetPlayerAdminLevel(const playerid)
stock Admin_GetPlayerAdminCode(const playerid)

stock Admin_KickPlayer(const targetid, const adminid = INVALID_PLAYER_ID, const string: reason[] = "N/A")
stock Admin_GetPlayerKickReason(const playerid)
stock Admin_GetTotalKicked()

stock Admin_BanPlayer(const targetid, const adminid = INVALID_PLAYER_ID, const string: reason[] = "N/A")
stock Admin_GetPlayerBanReason(const playerid)
stock Admin_GetTotalBanned()

stock Admin_MutePlayer(const targetid, const adminid = INVALID_PLAYER_ID, const minutes = 0, const string: reason[] = "N/A")
stock Admin_GetPlayerMutedReason(const playerid)
stock Admin_GetTotalMuted()
stock Admin_IsPlayerMuted(const playerid)
stock Admin_GetPlayerMuteTime(const playerid)

stock Admin_JailPlayer(const targetid, const adminid = INVALID_PLAYER_ID, const minutes = 0, const string: reason[] = "N/A", Float: jail_pos_x = 0.0, Float: jail_pos_y = 0.0, Float: jail_pos_z = 0.0, Float: jail_pos_a = 0.0, const jail_vw = -1, const jail_int = -1)
stock Admin_GetPlayerJailReason(const playerid)
stock Admin_GetTotalJailed()
stock Admin_IsPlayerJailed(const playerid)
stock Admin_GetPlayerJailTime(const playerid)

Usage (+commands example)

How to set admin to the player?

CMD:setadmin(playerid, const params[])
{
    if (Admin_GetPlayerAdminLevel(playerid) < MAX_ADMIN_LEVEL) {
        return 0;
    }

    // Example with sscanf (Y_Less sscanf)
    extract params -> new targetid, level, code; else {
        return SendClientMessage(playerid, -1, "/setadmin <targetid> <level> <code>");
    }

    if (!(MIN_ADMIN_LEVEL <= level <= MAX_ADMIN_LEVEL)) {
        return 0;
    }

    Admin_SetPlayerAdminLevel(targetid, level, code);
    va_SendClientMessage(
        targetid, -1,
        "Admin Level: %d | Code: %d", Admin_GetPlayerAdminLevel(targetid), Admin_GetPlayerAdminCode(targetid)
    );

    return 1;
}

How to kick player(s)

CMD:kick(playerid, const params[])
{
    if (Admin_GetPlayerAdminLevel(playerid) < 1) {
        return 0;
    }

    // Example with sscanf (Y_Less sscanf)
    extract params -> new targetid, string: reason[64]; else {
        return SendClientMessage(playerid, -1, "/kick <targetid> <reason>");
    }

    Admin_KickPlayer(targetid, playerid, reason);

    return 1;
}

How to ban player(s)

CMD:ban(playerid, const params[])
{
    if (Admin_GetPlayerAdminLevel(playerid) < 1) {
        return 0;
    }

    // Example with sscanf (Y_Less sscanf)
    extract params -> new targetid, string: reason[64]; else {
        return SendClientMessage(playerid, -1, "/ban <targetid> <reason>");
    }

    Admin_anPlayer(targetid, playerid, reason);

    return 1;
}

How to mute player(s)

CMD:mute(playerid, const params[])
{
    if (Admin_GetPlayerAdminLevel(playerid) < 1) {
        return 0;
    }

    // Example with sscanf (Y_Less sscanf)
    extract params -> new targetid, minutes, string: reason[64]; else {
        return SendClientMessage(playerid, -1, "/mute <targetid> <minutes> <reason>");
    }

    Admin_MutePlayer(targetid, playerid, minutes, reason);

    return 1;
}

// To un-mute player just set minutes to 0...
__gPlayerMuted[targetid] = (!minutes ? (false) : (true)); // if minutes = 0 the player will not be muted..

How to jail player(s)

CMD:jail(playerid, const params[])
{
    if (Admin_GetPlayerAdminLevel(playerid) < 1) {
        return 0;
    }

    // Example with sscanf (Y_Less sscanf)
    extract params -> new targetid, minutes, string: reason[64]; else {
        return SendClientMessage(playerid, -1, "/jail <targetid> <minutes> <reason>");
    }

    Admin_JailPlayer(targetid, playerid, minutes, reason);

    return 1;
}

// To un-jail player just set minutes to 0...
__gPlayerJailed[targetid] = (!minutes ? (false) : (true)); // if minutes = 0 the player will not be jailed..

Testing

To test, simply run the package:

sampctl package run

This page is built from what GitHub publishes about the repository. samp.directory does not host the code. Report a problem with this listing

emmett-white/samp-admin-system: SA-MP Library | samp.directory