Giter VIP home page Giter VIP logo

protection's Introduction

Protection

Flexible server protection system (development).

Dependencies

Callbacks

forward OnPlayerGetProtectionWarning(playerid, Protection:protection, bool:warn_reached, message[]);

Functions

// protection params
Protection_SetParamInt(Protection:protection, ProtectionParams:param, value);
Protection_GetParamInt(Protection:protection, ProtectionParams:param);
Protection_SetParamFloat(Protection:protection, ProtectionParams:param, Float:value);
Float:Protection_GetParamFloat(Protection:protection, ProtectionParams:param);
Protection_SetParamString(Protection:protection, ProtectionParams:param, value[]);
Protection_GetParamString(Protection:protection, ProtectionParams:param, value[], size = sizeof(value));
Protection_SetParamArray(Protection:protection, ProtectionParams:param, values[], const size = sizeof(values));
Protection_GetParamArray(Protection:protection, ProtectionParams:param, values[], size = sizeof(values));

// player protection params
Protection_SetPlayerParamInt(playerid, Protection:protection, ProtectionPlayerParams:param, value);
Protection_GetPlayerParamInt(playerid, Protection:protection, ProtectionPlayerParams:param);
Protection_SetPlayerParamFloat(playerid, Protection:protection, ProtectionPlayerParams:param, Float:value);
Float:Protection_GetPlayerParamFloat(playerid, Protection:protection, ProtectionPlayerParams:param);
Protection_SetPlayerParamString(playerid, Protection:protection, ProtectionPlayerParams:param, value[]);
Protection_GetPlayerParamString(playerid, Protection:protection, ProtectionPlayerParams:param, value[], size = sizeof(value));

// player info
Protection_SetPlayerInfoInt(playerid, ProtectionPlayerInfo:param, value);
Protection_GetPlayerInfoInt(playerid, ProtectionPlayerInfo:param);
Protection_SetPlayerInfoFloat(playerid, ProtectionPlayerInfo:param, Float:value);
Float:Protection_GetPlayerInfoFloat(playerid, ProtectionPlayerInfo:param);
Protection_SetPlayerInfoString(playerid, ProtectionPlayerInfo:param, value[]);
Protection_GetPlayerInfoString(playerid, ProtectionPlayerInfo:param, value[], size = sizeof(value));

Function params

enum Protection {
	PROTECTION_ALL,
	PROTECTION_TELEPORT,
	PROTECTION_INTERIOR,
	PROTECTION_SPECIALACTION,
	PROTECTION_RCON,
	PROTECTION_PING,
	PROTECTION_HEALTH,
	PROTECTION_ARMOUR,
	PROTECTION_VEHICLETELEPORT,
	PROTECTION_WEAPON,
	PROTECTION_MONEY,
	PROTECTION_KILLFLOOD,
	PROTECTION_WEAPONDAMAGE,
	PROTECTION_RAPIDFIRE,
	PROTECTION_BADSHOT,
	PROTECTION_PICKUPPICK,
	PROTECTION_VEHICLECOLOR,
	PROTECTION_CAMERA,
	PROTECTION_CAMERAMODE,
	PROTECTION_FAKEKILL,
	PROTECTION_VEHICLETUNING,
}

enum ProtectionParams {
	PROTECTION_NAME[PROTECTION_MAX_STRING],
	PROTECTION_FUNCTION[PROTECTION_MAX_STRING],
	bool:PROTECTION_ENABLED,
	PROTECTION_CHECK_DELAY,
	PROTECTION_LAST_TICKCOUNT,
	PROTECTION_SPAWN_DELAY,
	PROTECTION_MAX_WARNINGS,
	Float:PROTECTION_MAX_DISTANCE,
	Float:PROTECTION_MAX_VEHICLE_DISTANCE,
	PROTECTION_MAX_PING,
	PROTECTION_AVAILABLE_IDS[PROTECTION_MAX_AVAILABLE_IDS],
	PROTECTION_COUNTERACTION,
}

enum ProtectionPlayerParams {
	PROTECTION_PLAYER_DISABLED,
	PROTECTION_PLAYER_COUNTERACTION,
	PROTECTION_PLAYER_WARNING_COUNT,
	PROTECTION_PLAYER_BLOCK_UPDATE,
}

enum ProtectionPlayerInfo {
	bool:PROTECTION_PLAYER_SPAWNED,
	PROTECTION_PLAYER_IP[PROTECTION_MAX_IP + 1],
	PROTECTION_PLAYER_PING,
	PROTECTION_PLAYER_SPAWN_TICK,
}

Examples

#include <a_samp>
#include "foreach"
#include "getspawninfo"
#include "protection"

main() {}

public OnGameModeInit()
{
	// enable all protections
	Protection_SetParamInt(PROTECTION_ALL, PROTECTION_ENABLED, 1);
	// redefine name
	Protection_SetParamString(PROTECTION_TELEPORT, PROTECTION_NAME, "Телепорт");
	return 1;
}

public OnPlayerSpawn(playerid)
{
	// disable all protections for admin
	if (IsPlayerAdmin(playerid)) {
		Protection_SetPlayerParamInt(playerid, PROTECTION_ALL, PROTECTION_PLAYER_DISABLED, 1);
	}
	return 1;
}

public OnPlayerGetProtectionWarning(playerid, Protection:protection, bool:warn_reached, message[])
{
	new
		string[144],
		protection_name[32];

	Protection_GetParamString(protection, PROTECTION_NAME, protection_name);

	format(string, sizeof(string), "* Player: %d | Warn reached: %d | Name: %s | Message: %s", playerid, _:warn_reached, protection_name, message);
	SendClientMessageToAll(-1, string);
	return 1;
}

protection's People

Contributors

ziggi avatar nexiustailer avatar cantbekarma avatar medzvel avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.