07.06.2013, 03:10
(
Последний раз редактировалось Swyft™; 07.06.2013 в 07:57.
)
This is just a basic include for people that are making there own Admin systems, or such.
To use this include, simply add #include <infract after all of your includes
Here's a list of functions used
Basic example of using the commands
INCLUDES
To use this include, simply add #include <infract after all of your includes
pawn Код:
#include <a_samp>
#include <zcmd>
#include <sscanf>
#include <infract> // At the bottom :) MUST be at the bottom
Here's a list of functions used
pawn Код:
GetPlayerInfractions(playerid); // This will get the players Infractions.
InfractPlayer(playerid); // This adds an infraction number to the player and all infractions are out of /3... Version 2, may have options to change it. It also may be possible to set a certain number of Infractions. But that is untested.
Basic example of using the commands
pawn Код:
CMD:infract(playerid, params[])
{
new string[256], target, reason[128];
if(IsPlayerAdmin(playerid))
{
if(!sscanf(params, "us[128]", target, reason)) return SendClientMessage(playerid, 0xFF0000FF, "[USAGE]{FFFFFF} /infract [id] [reason]");
new pName[MAX_PLAYER_NAME], gName[MAX_PLAYER_NAME];
GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
GetPlayerName(target, gName, MAX_PLAYER_NAME);
InfractPlayer(target);
format(string, sizeof(string), "{FF0000}%s has infracted %s (Reason: %s] [INFRACTIONS: %d/3]", pName, gName, reason, GetPlayerInfractions(target));
SendClientMessageToAll(0xFF0000FF, string);
}
else return SendClientMessage(playerid, 0xFF0000FF, "[ERROR]{FFFFFF} You have to be inside RCON");
return 1;
}
CMD:myinfractions(playerid, params[])
{
new string[64];
format(string, sizeof(string), "You have (%d/3) infractions", GetPlayerInfractions(playerid));
SendClientMessage(playerid, 0xFF0000FF, string);
return 1;
}
pawn Код:
/*
Infraction Sender created by Swyft
Created on June 6, 2013
*/
#include <a_samp>
#define GetPlayerInfractions(%0) infraction[(%0)]
forward InfractPlayer(playerid);
forward InfractTimer(playerid);
new infraction[MAX_PLAYERS];
public OnPlayerConnect(playerid)
{
infraction[playerid] = 0;
return CallLocalFunction("Swyft_OnPlayerConnect", "d", playerid);
}
#if defined _ALS_OnPlayerConnect
#undef OnPlayerConnect
#else
#define _ALS_OnPlayerConnect
#endif
#define OnPlayerConnect Swyft_OnPlayerConnect
forward Swyft_OnPlayerConnect(playerid);
public InfractPlayer(playerid)
{
SetTimerEx("InfractTImer",1000,false,"i",playerid) ;
return 1;
}
public InfractTimer(playerid)
{
infraction[playerid]++;
return 1;
}
public OnPlayerUpdate(playerid)
{
if(infraction[playerid] == 3) return Kick(playerid);
return CallLocalFunction("Swyft_OnPlayerUpdate", "d", playerid);
}
#if defined _ALS_OnPlayerUpdate
#undef OnPlayerUpdate
#else
#define _ALS_OnPlayerUpdate
#endif
#define OnPlayerUpdate Swyft_OnPlayerUpdate
forward Swyft_OnPlayerUpdate(playerid);
stock OnPlayerInfraction(playerid) { return InfractPlayer(playerid); }