Nice work!!
Greetings
Greetings
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
Show posts Menu#define LIMIT_REP_SPAM 3
#define MSNxSEC 1750
new MSNCount[MAX_PLAYERS];
new MSNPlayer[MAX_PLAYERS];
public OnPlayerText(playerid, cmdtext[])
{
new MSN[256],spammer = (GetTickCount()-MSNCount[playerid])/MSNxSEC;
MSNPlayer[playerid]+=spammer-1;
if(MSNPlayer[playerid]>LIMIT_REP_SPAM)MSNPlayer[playerid]=LIMIT_REP_SPAM-1;
if(MSNPlayer[playerid]<0)MSNPlayer[playerid]=-1;
MSNCount[playerid]=GetTickCount();
if(MSNPlayer[playerid]<0) {
format(MSN,256,">> Auto-Kick %s, ID %d, Reason: [ No Spam/Flooding ].", PlayerName(playerid), playerid);
SendClientMessageToAll(0x377DFFFF,MSN);
Kick(playerid);
return 1;
}
return 0;
}
stock PlayerName(playerid)
{
new name[24];
GetPlayerName(playerid,name,24);
return name;
}
enum playerToSpamm
{
CountText,
LastText[256],
}
new Spamming[MAX_PLAYERS][playerToSpamm];
public OnPlayerText(playerid, cmdtext[])
{
PlayerSpamming(playerid,cmd,cmdtext);
return 0;
}
public PlayerSpamming(playerid,cmd[],cmdtext[])
{
if (strcmp(cmd, cmd, true) == 0) {
if (strcmp(cmdtext, Spamming[playerid][LastText], true) == 0 && Spamming[playerid][CountText] >= 3) {format(MSN,256,">> Auto-Kick %s, ID %d, Reason: [ SPAMMING ].", PlayerName(playerid), playerid); SendClientMessageToAll(0x377DFFFF,MSN); Kick(playerid);}
else {
format(MSN,256,"%s", cmdtext);
if (strcmp(cmd, Spamming[playerid][LastText], true) == 0) {Spamming[playerid][LastText] = MSN; Spamming[playerid][CountText] = Spamming[playerid][CountText] + 1;}
else {Spamming[playerid][LastText] = MSN; Spamming[playerid][CountText] = 0;}
}
}
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
Spamming[playerid][CountText] = 0; // this in an empty line
return 1;
}
public OnPlayerCommandText(playerid, cmdtext)
{
/*Below where the public begins OnPlayerCommandText (playerid, cmdtext)
define this:*/
new Float:x, Float:y, Float:z; // If not exist, put that.
new MSN[256]; // If not exist, put that.
else if (strcmp(cmd, "spawnallv", true) == 0) {
// Here you put what you want, is to lock the command to members or need to spawn.
else {
format(MSN,256, "Admin %s spawn all vehicles, Activated!", PlayerName(playerid));
SendClientMessageToAll(BLUE,MSN);
for(new v = 1; v <= NUMBERS; v++) {// <- depending on the vehicle you have on your server, put the number in that part.
new separation = dini_Int("/Vehicles/Separation.ini", IntToStr(v));
GetPlayerPos(playerid, x, y, z);
SetVehiclePos(v, x+10.0000, y+10.0000, z +separation, 0);
}
}
return 1;
}
else if (strcmp(cmd, "delspawnallv", true) == 0) {
// Here you put what you want, is to lock the command to members or need to spawn.
else {
format(MSN,256, "Admin %s delate and respawned all vehicles!", PlayerName(playerid));
SendClientMessageToAll(BLUE,MSN);
for(new v = 1; v <= NUMBERS; v++) {// <- depending on the vehicle you have on your server, put the number in that part.
SetVehicleToRespawn(v);
}
}
return 1;
}
return 0;
}
stock PlayerName(playerid)
{
new name[24];
GetPlayerName(playerid,name,24);
return name;
}
public InfoPlayerBanned(playerid)
{
new IP[256],MSN[256],BAN;
GetPlayerIp(playerid,IP,256);
BAN = dini_Int("/Banneds/Banlist.ini",IP);//find IP in the list.
if(BAN == 1){// if the IP in the list is 1, kick player (1 = true, 0 = false)
format(MSN,256,">> Server Auto-Kick: %s - Reason: [IP Banned]",PlayerName(playerid));
SendClientMessageToAll(0x377DFFFF,MSN);
Kick(playerid);//kick player :P
}
}
public PlayerBanIP(playerid,admin,reason[])
{
new IP[256],MSN[256],inf[256];
GetPlayerIp(playerid,IP,256);
format(inf,256,"1 %s %s %s",PlayerName(playerid),PlayerName(admin),reason);//info to archive player banned
dini_Set("/Banneds/Banlist.ini",IP,inf);//send to ban list
dini_Set("/Banneds/PlayerBanlist.ini",gPlayers[playerid],IP);//send to player and IP
format(MSN,256,">> Admin %s Banned: %s, ID: %d, Reason:%s",gPlayers[admin],gPlayers[playerid],playerid,reason);
SendClientMessageToAll(0x377DFFFF,MSN);
Kick(playerid);//kick player xP
}
public PlayerUnBanIP(player[],admin,reason[])
{
new MSN[256],IP[256],param[2][128];
IP = dini_Get("/Banneds/PlayerBanlist.ini",player);
split(dini_Get("/Banneds/Banlist.ini",IP), param, ' ');
format(MSN,256,">> Admin %s Un-Banned: %s, Reason:%s",PlayerName(admin),param[1],reason);
SendClientMessageToAll(0x377DFFFF,MSN);
dini_Unset("/Banneds/Banlist.ini",IP);//remove IP banned the list
dini_Unset("/Banneds/PlayerBanlist.ini",player);//remove the name list
}
public IsPlayerBanned(player[])
{
new ispb[256];
ispb = dini_Get("/Banneds/PlayerBanlist.ini",player);//find IP to check list banneds
return (strcmp(ispb, "0", true) == 0) ? false : true;//checks the existence of the player or not
}
public OnPlayerConnect(playerid)
{
InfoPlayerBanned(playerid);
return 1;
}
else if (strcmp(cmd, "ban", true) == 0) {
new plr,reason[256];
tmp = strtok(cmdtext, idx), plr = FindPlayerIDFromString(tmp), reason = strtok(cmdtext, idx);
if (!strlen(reason)) SendClientMessage(playerid,0x04A36BFF,"** pm >> [Syntax] - The correct use: /c ban <player> <reason>");
else if (plr == INACTIVE_PLAYER_ID) SendClientMessage(playerid,0x04A36BFF,"** pm >> [Error] - Unknown player.");
else {
PlayerBanIP(plr,playerid,cmdtext[strval(reason)+strlen(tmp)+4]);
}
return 1;
}
else if (strcmp(cmd, "unban", true) == 0) {
new reason[256];
tmp = strtok(cmdtext, idx), reason = strtok(cmdtext, idx);
if (!strlen(reason)) SendClientMessage(playerid,0x04A36BFF,"** pm >> [Syntax] - The correct use: /c unban <player> <reason>");
else if (!IsPlayerBanned(tmp)) SendClientMessage(playerid,0x04A36BFF,"** pm >> [Error] - This player is't banned, insert full name.");
else {
PlayerUnBanIP(tmp,playerid,cmdtext[strval(reason)+strlen(tmp)+6]);
}
return 1;
}
stock PlayerName(playerid)
{
new name[24];
GetPlayerName(playerid,name,24);
return name;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
new cmd[256], idx;
cmd = strtok(cmdtext, idx);
else if (strcmp(cmd, "setskin", true) == 0) {
new arg[256], sk[256], p[256];
arg = strtok(cmdtext, idx), sk = strtok(cmdtext, idx), p = FindPlayerIDFromString(arg);
if (!strlen(sk)) SendClientMessage(playerid,colour, "[Syntax] - The correct use: /c setskin <playerid/name> <skinid>.");
else {
if (p == 255) SendClientMessage(playerid,colour,"[Error] - Unknown player.");
else if (!IsNumeric(sk)) SendClientMessage(playerid,colour,"[Error] - Invalid Skin, type numbers to skin.");
else {
new player1[24], player2[24],MSN[256];
GetPlayerName(playerid,player1,24);
GetPlayerName(p,player2,24);
format(MSN,256,"Admin %s set skin %d to: %s.",player1,strval(sk),player2);
SendClientMessageToAll(colour,MSN);
SetPlayerSkin(p,strval(sk));
}
}
return 1;
}
return 0;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
new cmd[256], idx;
cmd = strtok(cmdtext, idx);