Jump to content

Question

Posted

salls...

cum as putea sa fac asa daca un player trimite message de mai multe ori pe 2 secunde sa ii apara:You can not use commands in only 2 secounds....

Fara reclama in semnatura!

6 answers to this question

Recommended Posts

Posted

[pawn]new SpamStrings[MAX_PLAYERS];[/pawn]

[pawn]public MinSpam() {

for(new i = 0; i < MAX_PLAYERS; i ++) {

if(SpamStrings > 0) {

SpamStrings = 0;

}

}

}[/pawn]

La public OnPlayerText(playerid, text[])

[pawn]SpamStrings[playerid] ++;

if(SpamStrings[playerid] >= MAX_SPAM)

{

    new PlayerName[MAX_PLAYER_NAME];

GetPlayerName(playerid, PlayerName, MAX_PLAYER_NAME);

SendClientMessage(playerid,COLOR_BBLUE,"Please wait 2 seconds before you spam again (spam protection)");

return 0;

}[/pawn]

[pawn]

forward MinSpam();[/pawn]

[pawn]#define MAX_SPAM 3[/pawn]

Posted

static szPlayerChatMsg[MAX_PLAYERS][128];

IL pui la public OnPlayerText(playerid, text[])

[pawn] if(IsPlayerFlooding(playerid) && !IsPlayerAdmin(playerid))

{

    SendClientMessage(playerid, 0xFF0000FF, "*{6EF83C} You can only send a message once every three {FFFFFF}seconds.");

    return 0;

}

if(!IsPlayerAdmin(playerid))

{

if(strlen(text) == strlen(szPlayerChatMsg[playerid]) && !strcmp(szPlayerChatMsg[playerid], text,  false))

{

SendClientMessage(playerid, 0xFF0000FF, "* {FFFFFF}Please do not repeat {F81414}yourself.");

format(szPlayerChatMsg[playerid], 128, "%s", text);

    return 0;

}

  }

format(szPlayerChatMsg[playerid], 128, "%s", text);

    iPlayerChatTime[playerid] = GetTickCount();[/pawn]

SI pe esta jos de la  public OnPlayerText(playerid, text[])[pawn]}

stock IsPlayerFlooding(playerid)

{

if(GetTickCount() - iPlayerChatTime[playerid] < 2200)

    return 1;

return 0;

}[/pawn]

public OnPlayerDisconnect(playerid, reason)

iPlayerChatTime[playerid] = 0;

szPlayerChatMsg[playerid] = "";

Posted

merge aia cum you can not use commands...etc...

dar asta cum Please don't repeat yourself nu merge...imi apare  Please don't repeat yourself dar messajul pe care il scriu se trimite...

asa am pus la onplayertext:

public OnPlayerText(playerid,text[])
{
	SetPlayerChatBubble(playerid, text, 0xFFFFFFAA, 100.0, 10000);
	if(isafk[playerid] == 1)
	{
		SystemMessage(playerid, "You can not speak for you in BRB or AFK.");
	}
	if (!strcmp(text, reactionstr, false))
	{
		if (reactioninprog == 2) ReactionWin(playerid);
		if (reactioninprog == 1)
		{
			if (reactionwinnerid == playerid) { SendClientMessage(playerid, 0x247C1BFF, "You've already won!."); }
			else { SendClientMessage(playerid, 0x247C1BFF, "You are too slow!."); }
		}
	}
	if(IsPlayerFlooding(playerid) && !IsPlayerAdmin(playerid))
	{
	    SendClientMessage(playerid, 0xFF0000FF, "*{6EF83C} You can only send a message once every three {FFFFFF}seconds.");
	    return 0;
	}
		if(!IsPlayerAdmin(playerid))
	{
		if(strlen(text) == strlen(szPlayerChatMsg[playerid]) && !strcmp(szPlayerChatMsg[playerid], text,  false))
		{
			SendClientMessage(playerid, 0xFF0000FF, "* {FFFFFF}Please do not repeat {F81414}yourself.");
			format(szPlayerChatMsg[playerid], 128, "{E60000}%s", text);
		    return 1;
		}
  }
 	format(szPlayerChatMsg[playerid], 128, "%s", text);
    iPlayerChatTime[playerid] = GetTickCount();
	return 1;
	}

Fara reclama in semnatura!

Posted

Si jos ai pus la OnPlayerText

}

stock IsPlayerFlooding(playerid)

{

if(GetTickCount() - iPlayerChatTime[playerid] < 2200)

    return 1;

return 0;

}

asta o pui

asta am pus unde am celalalte stock-uri....

Fara reclama in semnatura!

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.