2021-07-12, 05:41 AM
Es un simple sistema de Baneo
file:///C:/Users/pc/Documents/GTA%20San%20Andreas%20User%20Files/SAMP/screens/sa-mp-029.png
file:///C:/Users/pc/Documents/GTA%20San%20Andreas%20User%20Files/SAMP/screens/sa-mp-030.png
file:///C:/Users/pc/Documents/GTA%20San%20Andreas%20User%20Files/SAMP/screens/sa-mp-035.png
file:///C:/Users/pc/Documents/GTA%20San%20Andreas%20User%20Files/SAMP/screens/sa-mp-036.png
file:///C:/Users/pc/Documents/GTA%20San%20Andreas%20User%20Files/SAMP/screens/sa-mp-037.png
Code:
/* Cr?ditos Nikolay Staggs se puede modificar*/
#include <a_samp>
#include <dof2>
#include <zcmd>
#include <sscanf2>
#define BanPlayer "Bans/Player/%s.ini"
#define ban 1
main()
{
print("\n----------------------------------");
print(" Blank Gamemode by your name here");
print("----------------------------------\n");
}
new PlayerBaner[MAX_PLAYERS];
new PlayerBanerDays[MAX_PLAYERS];
new PlayerBanerRazon[MAX_PLAYERS][65];
new PlayerText:TextDraw_BAN_Player[MAX_PLAYERS][6];
CMD:ban(playerid, params[])
{
new razon[150], id, Days, Name[24], str[50];
if(sscanf(params, "iis[150]", id, Days, razon)) return SendClientMessage(playerid, -1, "USE: /ban [id] [dias] [razon]");
GetPlayerName(id, Name, sizeof(Name));
format(str, sizeof(str), BanPlayer, Name);
DOF2_CreateFile(str);
DOF2_SetInt(str, "Dias", gettime() (60*60*24*Days));
DOF2_SetInt(str, "Ban", ban);
DOF2_SetString(str, "Razon", razon);
DOF2_SaveFile();
PlayerBaner[id] = 1;
format(str, sizeof(str), "Fuiste baneado %i %s Razon %s", Days, Days == 1 ? ("dia") : ("dias"), razon);
SendClientMessage(id, -1, str);
return 1;
}
public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" Blank Filterscript by your name here");
print("--------------------------------------\n");
return 1;
}
public OnFilterScriptExit()
{
? ? DOF2_Exit();
return 1;
}
public OnPlayerConnect(playerid)
{
? ? CargarTextDraw(playerid);
new str[100], Name[24];
GetPlayerName(playerid, Name, sizeof(Name));
format(str, sizeof(str), BanPlayer, Name);
if(IsPlayer(playerid))
{
PlayerBanerDays[playerid] = DOF2_GetInt(str, "Dias");
if(gettime() >= PlayerBanerDays[playerid])
{
SendClientMessage(playerid, -1, "..................");
PlayerBaner[playerid] = 0;
DOF2_RemoveFile(str);
}
else
{
PlayerBaner[playerid] = DOF2_GetInt(str, "Ban");
if(PlayerBaner[playerid])
{
PlayerBanerDays[playerid] = DOF2_GetInt(str, "Dias");
strmid(PlayerBanerRazon[playerid],DOF2_GetString(str,"Razon"),0,strlen(DOF2_GetString(str,"Razon")),255);
new strs[128];
format(strs, sizeof strs, "te_ha_baneado~y~_razon~w~:~r~_%s_~w~%s", PlayerBanerRazon[playerid], ConvertTime(PlayerBanerDays[playerid] - gettime()));
PlayerTextDrawSetString(playerid, TextDraw_BAN_Player[playerid][5], strs);
PlayerTextDrawShow(playerid, TextDraw_BAN_Player[playerid][0]);
PlayerTextDrawShow(playerid, TextDraw_BAN_Player[playerid][1]);
PlayerTextDrawShow(playerid, TextDraw_BAN_Player[playerid][2]);
PlayerTextDrawShow(playerid, TextDraw_BAN_Player[playerid][3]);
PlayerTextDrawShow(playerid, TextDraw_BAN_Player[playerid][4]);
PlayerTextDrawShow(playerid, TextDraw_BAN_Player[playerid][5]);
SetTimerEx("TimerBan", 1000, true, "i", playerid);
}
}
}
return 1;
}
public OnPlayerSpawn(playerid)
{
return 1;
}
forward TimerBan(playerid);
public TimerBan(playerid)
{
? ? Kick(playerid);
return 1;
}
stock GetName(playerid)
{
new Name[MAX_PLAYER_NAME];
GetPlayerName(playerid, Name, MAX_PLAYER_NAME);
return Name;
}
stock IsPlayer(playerid)
{
new str[40],
Name[21];
GetPlayerName(playerid, Name, 21);
format(str, 40, BanPlayer, Name);
if(DOF2_FileExists(str)) return 1;
return 0;
}
stock ConvertTime(SEGUNDOS)
{
new MINUTOS_, HORAS_, DIAS_, String[200];
if(SEGUNDOS > 59)
{
MINUTOS_ = SEGUNDOS / 60;
SEGUNDOS = SEGUNDOS - MINUTOS_ * 60;
}
if(MINUTOS_ > 59)
{
HORAS_ = MINUTOS_ / 60;
MINUTOS_ = MINUTOS_ - HORAS_ * 60;
}
if(HORAS_ > 23)
{
DIAS_ = HORAS_ / 24;
HORAS_ = HORAS_ - DIAS_ * 24;
}
format(String, sizeof(String), "~y~Dias~w~:_%2d", DIAS_);
if(DIAS_ < 1) format(String, sizeof(String), "~y~Horas~w~:_%2d", HORAS_);
if(DIAS_ < 1 && HORAS_ < 1) format(String, sizeof(String), "~y~Minutos~w~:_%2d", MINUTOS_);
if(DIAS_ < 1 && HORAS_ < 1 && MINUTOS_ < 1) format(String, sizeof(String), "~y~Segundos~w~:_%2d", SEGUNDOS);
return String;
}
CargarTextDraw(playerid)
{
TextDraw_BAN_Player[playerid][0] = CreatePlayerTextDraw(playerid, 0.299992, -1.449999, "box");
PlayerTextDrawLetterSize(playerid, TextDraw_BAN_Player[playerid][0], 0.000000, 49.700000);
PlayerTextDrawTextSize(playerid, TextDraw_BAN_Player[playerid][0], 661.802734, 0.000000);
PlayerTextDrawAlignment(playerid, TextDraw_BAN_Player[playerid][0], 1);
PlayerTextDrawColor(playerid, TextDraw_BAN_Player[playerid][0], -1);
PlayerTextDrawUseBox(playerid, TextDraw_BAN_Player[playerid][0], 1);
PlayerTextDrawBoxColor(playerid, TextDraw_BAN_Player[playerid][0], 255);
PlayerTextDrawSetShadow(playerid, TextDraw_BAN_Player[playerid][0], 0);
PlayerTextDrawBackgroundColor(playerid, TextDraw_BAN_Player[playerid][0], 255);
PlayerTextDrawFont(playerid, TextDraw_BAN_Player[playerid][0], 1);
PlayerTextDrawSetProportional(playerid, TextDraw_BAN_Player[playerid][0], 0);
TextDraw_BAN_Player[playerid][1] = CreatePlayerTextDraw(playerid, 236.200103, 194.375000, "alerta");
PlayerTextDrawLetterSize(playerid, TextDraw_BAN_Player[playerid][1], 1.635500, 3.341249);
PlayerTextDrawTextSize(playerid, TextDraw_BAN_Player[playerid][1], 59.000000, 0.000000);
PlayerTextDrawAlignment(playerid, TextDraw_BAN_Player[playerid][1], 1);
PlayerTextDrawColor(playerid, TextDraw_BAN_Player[playerid][1], -5963521);
PlayerTextDrawSetShadow(playerid, TextDraw_BAN_Player[playerid][1], 0);
PlayerTextDrawBackgroundColor(playerid, TextDraw_BAN_Player[playerid][1], -5963521);
PlayerTextDrawFont(playerid, TextDraw_BAN_Player[playerid][1], 3);
PlayerTextDrawSetProportional(playerid, TextDraw_BAN_Player[playerid][1], 1);
TextDraw_BAN_Player[playerid][2] = CreatePlayerTextDraw(playerid, 327.100524, 240.775268, "el_equipo_de~y~_Radiation~w~_RP");
PlayerTextDrawLetterSize(playerid, TextDraw_BAN_Player[playerid][2], 0.209500, 0.401250);
PlayerTextDrawTextSize(playerid, TextDraw_BAN_Player[playerid][2], 0.000000, 561.000000);
PlayerTextDrawAlignment(playerid, TextDraw_BAN_Player[playerid][2], 2);
PlayerTextDrawColor(playerid, TextDraw_BAN_Player[playerid][2], -1);
PlayerTextDrawSetShadow(playerid, TextDraw_BAN_Player[playerid][2], 0);
PlayerTextDrawBackgroundColor(playerid, TextDraw_BAN_Player[playerid][2], 255);
PlayerTextDrawFont(playerid, TextDraw_BAN_Player[playerid][2], 2);
PlayerTextDrawSetProportional(playerid, TextDraw_BAN_Player[playerid][2], 1);
TextDraw_BAN_Player[playerid][3] = CreatePlayerTextDraw(playerid, 157.499603, 234.727783, "LD_SPAC:white");
PlayerTextDrawTextSize(playerid, TextDraw_BAN_Player[playerid][3], 341.000000, 1.000000);
PlayerTextDrawAlignment(playerid, TextDraw_BAN_Player[playerid][3], 1);
PlayerTextDrawColor(playerid, TextDraw_BAN_Player[playerid][3], -1);
PlayerTextDrawSetShadow(playerid, TextDraw_BAN_Player[playerid][3], 0);
PlayerTextDrawBackgroundColor(playerid, TextDraw_BAN_Player[playerid][3], 255);
PlayerTextDrawFont(playerid, TextDraw_BAN_Player[playerid][3], 4);
PlayerTextDrawSetProportional(playerid, TextDraw_BAN_Player[playerid][3], 0);
TextDraw_BAN_Player[playerid][4] = CreatePlayerTextDraw(playerid, 157.499603, 260.029327, "LD_SPAC:white");
PlayerTextDrawTextSize(playerid, TextDraw_BAN_Player[playerid][4], 341.000000, 1.000000);
PlayerTextDrawAlignment(playerid, TextDraw_BAN_Player[playerid][4], 1);
PlayerTextDrawColor(playerid, TextDraw_BAN_Player[playerid][4], -1);
PlayerTextDrawSetShadow(playerid, TextDraw_BAN_Player[playerid][4], 0);
PlayerTextDrawBackgroundColor(playerid, TextDraw_BAN_Player[playerid][4], 255);
PlayerTextDrawFont(playerid, TextDraw_BAN_Player[playerid][4], 4);
PlayerTextDrawSetProportional(playerid, TextDraw_BAN_Player[playerid][4], 0);
TextDraw_BAN_Player[playerid][5] = CreatePlayerTextDraw(playerid, 327.100524, 249.975830, "te_abaneado~y~_razon~w~:_por pendejo_Dias:~y~_9999");
PlayerTextDrawLetterSize(playerid, TextDraw_BAN_Player[playerid][5], 0.209500, 0.401250);
PlayerTextDrawTextSize(playerid, TextDraw_BAN_Player[playerid][5], 0.000000, 561.000000);
PlayerTextDrawAlignment(playerid, TextDraw_BAN_Player[playerid][5], 2);
PlayerTextDrawColor(playerid, TextDraw_BAN_Player[playerid][5], -1);
PlayerTextDrawSetShadow(playerid, TextDraw_BAN_Player[playerid][5], 0);
PlayerTextDrawBackgroundColor(playerid, TextDraw_BAN_Player[playerid][5], 255);
PlayerTextDrawFont(playerid, TextDraw_BAN_Player[playerid][5], 2);
PlayerTextDrawSetProportional(playerid, TextDraw_BAN_Player[playerid][5], 1);
return 1;
}
file:///C:/Users/pc/Documents/GTA%20San%20Andreas%20User%20Files/SAMP/screens/sa-mp-029.png
file:///C:/Users/pc/Documents/GTA%20San%20Andreas%20User%20Files/SAMP/screens/sa-mp-030.png
file:///C:/Users/pc/Documents/GTA%20San%20Andreas%20User%20Files/SAMP/screens/sa-mp-035.png
file:///C:/Users/pc/Documents/GTA%20San%20Andreas%20User%20Files/SAMP/screens/sa-mp-036.png
file:///C:/Users/pc/Documents/GTA%20San%20Andreas%20User%20Files/SAMP/screens/sa-mp-037.png
Code:
/* Cr?ditos Nikolay Staggs se puede modificar*/
#include <a_samp>
#include <dof2>
#include <zcmd>
#include <sscanf2>
#define BanPlayer "Bans/Player/%s.ini"
#define ban 1
main()
{
print("\n----------------------------------");
print(" Blank Gamemode by your name here");
print("----------------------------------\n");
}
new PlayerBaner[MAX_PLAYERS];
new PlayerBanerDays[MAX_PLAYERS];
new PlayerBanerRazon[MAX_PLAYERS][65];
new PlayerText:TextDraw_BAN_Player[MAX_PLAYERS][6];
CMD:ban(playerid, params[])
{
new razon[150], id, Days, Name[24], str[50];
if(sscanf(params, "iis[150]", id, Days, razon)) return SendClientMessage(playerid, -1, "USE: /ban [id] [dias] [razon]");
GetPlayerName(id, Name, sizeof(Name));
format(str, sizeof(str), BanPlayer, Name);
DOF2_CreateFile(str);
DOF2_SetInt(str, "Dias", gettime() (60*60*24*Days));
DOF2_SetInt(str, "Ban", ban);
DOF2_SetString(str, "Razon", razon);
DOF2_SaveFile();
PlayerBaner[id] = 1;
format(str, sizeof(str), "Fuiste baneado %i %s Razon %s", Days, Days == 1 ? ("dia") : ("dias"), razon);
SendClientMessage(id, -1, str);
return 1;
}
public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" Blank Filterscript by your name here");
print("--------------------------------------\n");
return 1;
}
public OnFilterScriptExit()
{
? ? DOF2_Exit();
return 1;
}
public OnPlayerConnect(playerid)
{
? ? CargarTextDraw(playerid);
new str[100], Name[24];
GetPlayerName(playerid, Name, sizeof(Name));
format(str, sizeof(str), BanPlayer, Name);
if(IsPlayer(playerid))
{
PlayerBanerDays[playerid] = DOF2_GetInt(str, "Dias");
if(gettime() >= PlayerBanerDays[playerid])
{
SendClientMessage(playerid, -1, "..................");
PlayerBaner[playerid] = 0;
DOF2_RemoveFile(str);
}
else
{
PlayerBaner[playerid] = DOF2_GetInt(str, "Ban");
if(PlayerBaner[playerid])
{
PlayerBanerDays[playerid] = DOF2_GetInt(str, "Dias");
strmid(PlayerBanerRazon[playerid],DOF2_GetString(str,"Razon"),0,strlen(DOF2_GetString(str,"Razon")),255);
new strs[128];
format(strs, sizeof strs, "te_ha_baneado~y~_razon~w~:~r~_%s_~w~%s", PlayerBanerRazon[playerid], ConvertTime(PlayerBanerDays[playerid] - gettime()));
PlayerTextDrawSetString(playerid, TextDraw_BAN_Player[playerid][5], strs);
PlayerTextDrawShow(playerid, TextDraw_BAN_Player[playerid][0]);
PlayerTextDrawShow(playerid, TextDraw_BAN_Player[playerid][1]);
PlayerTextDrawShow(playerid, TextDraw_BAN_Player[playerid][2]);
PlayerTextDrawShow(playerid, TextDraw_BAN_Player[playerid][3]);
PlayerTextDrawShow(playerid, TextDraw_BAN_Player[playerid][4]);
PlayerTextDrawShow(playerid, TextDraw_BAN_Player[playerid][5]);
SetTimerEx("TimerBan", 1000, true, "i", playerid);
}
}
}
return 1;
}
public OnPlayerSpawn(playerid)
{
return 1;
}
forward TimerBan(playerid);
public TimerBan(playerid)
{
? ? Kick(playerid);
return 1;
}
stock GetName(playerid)
{
new Name[MAX_PLAYER_NAME];
GetPlayerName(playerid, Name, MAX_PLAYER_NAME);
return Name;
}
stock IsPlayer(playerid)
{
new str[40],
Name[21];
GetPlayerName(playerid, Name, 21);
format(str, 40, BanPlayer, Name);
if(DOF2_FileExists(str)) return 1;
return 0;
}
stock ConvertTime(SEGUNDOS)
{
new MINUTOS_, HORAS_, DIAS_, String[200];
if(SEGUNDOS > 59)
{
MINUTOS_ = SEGUNDOS / 60;
SEGUNDOS = SEGUNDOS - MINUTOS_ * 60;
}
if(MINUTOS_ > 59)
{
HORAS_ = MINUTOS_ / 60;
MINUTOS_ = MINUTOS_ - HORAS_ * 60;
}
if(HORAS_ > 23)
{
DIAS_ = HORAS_ / 24;
HORAS_ = HORAS_ - DIAS_ * 24;
}
format(String, sizeof(String), "~y~Dias~w~:_%2d", DIAS_);
if(DIAS_ < 1) format(String, sizeof(String), "~y~Horas~w~:_%2d", HORAS_);
if(DIAS_ < 1 && HORAS_ < 1) format(String, sizeof(String), "~y~Minutos~w~:_%2d", MINUTOS_);
if(DIAS_ < 1 && HORAS_ < 1 && MINUTOS_ < 1) format(String, sizeof(String), "~y~Segundos~w~:_%2d", SEGUNDOS);
return String;
}
CargarTextDraw(playerid)
{
TextDraw_BAN_Player[playerid][0] = CreatePlayerTextDraw(playerid, 0.299992, -1.449999, "box");
PlayerTextDrawLetterSize(playerid, TextDraw_BAN_Player[playerid][0], 0.000000, 49.700000);
PlayerTextDrawTextSize(playerid, TextDraw_BAN_Player[playerid][0], 661.802734, 0.000000);
PlayerTextDrawAlignment(playerid, TextDraw_BAN_Player[playerid][0], 1);
PlayerTextDrawColor(playerid, TextDraw_BAN_Player[playerid][0], -1);
PlayerTextDrawUseBox(playerid, TextDraw_BAN_Player[playerid][0], 1);
PlayerTextDrawBoxColor(playerid, TextDraw_BAN_Player[playerid][0], 255);
PlayerTextDrawSetShadow(playerid, TextDraw_BAN_Player[playerid][0], 0);
PlayerTextDrawBackgroundColor(playerid, TextDraw_BAN_Player[playerid][0], 255);
PlayerTextDrawFont(playerid, TextDraw_BAN_Player[playerid][0], 1);
PlayerTextDrawSetProportional(playerid, TextDraw_BAN_Player[playerid][0], 0);
TextDraw_BAN_Player[playerid][1] = CreatePlayerTextDraw(playerid, 236.200103, 194.375000, "alerta");
PlayerTextDrawLetterSize(playerid, TextDraw_BAN_Player[playerid][1], 1.635500, 3.341249);
PlayerTextDrawTextSize(playerid, TextDraw_BAN_Player[playerid][1], 59.000000, 0.000000);
PlayerTextDrawAlignment(playerid, TextDraw_BAN_Player[playerid][1], 1);
PlayerTextDrawColor(playerid, TextDraw_BAN_Player[playerid][1], -5963521);
PlayerTextDrawSetShadow(playerid, TextDraw_BAN_Player[playerid][1], 0);
PlayerTextDrawBackgroundColor(playerid, TextDraw_BAN_Player[playerid][1], -5963521);
PlayerTextDrawFont(playerid, TextDraw_BAN_Player[playerid][1], 3);
PlayerTextDrawSetProportional(playerid, TextDraw_BAN_Player[playerid][1], 1);
TextDraw_BAN_Player[playerid][2] = CreatePlayerTextDraw(playerid, 327.100524, 240.775268, "el_equipo_de~y~_Radiation~w~_RP");
PlayerTextDrawLetterSize(playerid, TextDraw_BAN_Player[playerid][2], 0.209500, 0.401250);
PlayerTextDrawTextSize(playerid, TextDraw_BAN_Player[playerid][2], 0.000000, 561.000000);
PlayerTextDrawAlignment(playerid, TextDraw_BAN_Player[playerid][2], 2);
PlayerTextDrawColor(playerid, TextDraw_BAN_Player[playerid][2], -1);
PlayerTextDrawSetShadow(playerid, TextDraw_BAN_Player[playerid][2], 0);
PlayerTextDrawBackgroundColor(playerid, TextDraw_BAN_Player[playerid][2], 255);
PlayerTextDrawFont(playerid, TextDraw_BAN_Player[playerid][2], 2);
PlayerTextDrawSetProportional(playerid, TextDraw_BAN_Player[playerid][2], 1);
TextDraw_BAN_Player[playerid][3] = CreatePlayerTextDraw(playerid, 157.499603, 234.727783, "LD_SPAC:white");
PlayerTextDrawTextSize(playerid, TextDraw_BAN_Player[playerid][3], 341.000000, 1.000000);
PlayerTextDrawAlignment(playerid, TextDraw_BAN_Player[playerid][3], 1);
PlayerTextDrawColor(playerid, TextDraw_BAN_Player[playerid][3], -1);
PlayerTextDrawSetShadow(playerid, TextDraw_BAN_Player[playerid][3], 0);
PlayerTextDrawBackgroundColor(playerid, TextDraw_BAN_Player[playerid][3], 255);
PlayerTextDrawFont(playerid, TextDraw_BAN_Player[playerid][3], 4);
PlayerTextDrawSetProportional(playerid, TextDraw_BAN_Player[playerid][3], 0);
TextDraw_BAN_Player[playerid][4] = CreatePlayerTextDraw(playerid, 157.499603, 260.029327, "LD_SPAC:white");
PlayerTextDrawTextSize(playerid, TextDraw_BAN_Player[playerid][4], 341.000000, 1.000000);
PlayerTextDrawAlignment(playerid, TextDraw_BAN_Player[playerid][4], 1);
PlayerTextDrawColor(playerid, TextDraw_BAN_Player[playerid][4], -1);
PlayerTextDrawSetShadow(playerid, TextDraw_BAN_Player[playerid][4], 0);
PlayerTextDrawBackgroundColor(playerid, TextDraw_BAN_Player[playerid][4], 255);
PlayerTextDrawFont(playerid, TextDraw_BAN_Player[playerid][4], 4);
PlayerTextDrawSetProportional(playerid, TextDraw_BAN_Player[playerid][4], 0);
TextDraw_BAN_Player[playerid][5] = CreatePlayerTextDraw(playerid, 327.100524, 249.975830, "te_abaneado~y~_razon~w~:_por pendejo_Dias:~y~_9999");
PlayerTextDrawLetterSize(playerid, TextDraw_BAN_Player[playerid][5], 0.209500, 0.401250);
PlayerTextDrawTextSize(playerid, TextDraw_BAN_Player[playerid][5], 0.000000, 561.000000);
PlayerTextDrawAlignment(playerid, TextDraw_BAN_Player[playerid][5], 2);
PlayerTextDrawColor(playerid, TextDraw_BAN_Player[playerid][5], -1);
PlayerTextDrawSetShadow(playerid, TextDraw_BAN_Player[playerid][5], 0);
PlayerTextDrawBackgroundColor(playerid, TextDraw_BAN_Player[playerid][5], 255);
PlayerTextDrawFont(playerid, TextDraw_BAN_Player[playerid][5], 2);
PlayerTextDrawSetProportional(playerid, TextDraw_BAN_Player[playerid][5], 1);
return 1;
}