Anti Command spam, /shout system
#1

Hi, i have created a Shout system, with a anti spam, so you need to wait for 2 minuts before you can shout again. Only, if 1 player shouted, NOBODY can shout anymore for 2 minuts. I want that it be that if 1 player shouted, a other player can shout also in that 2 minuts, but need to wait also 2 minuts before shouting again.
This is my code:

Up the script

Quote:

new boolhout;
forward antishoutspam(playerid);

public

Quote:

public OnPlayerCommandText(playerid, cmdtext[])
{

dcmd(shout, 5, cmdtext);

return 0;
}
dcmd_shout(playerid, params[])
{
#pragma unused params
if(GetPlayerScore(playerid) <= 4999)SendClientMessage(playerid, COLOR_LIGHTBLUE, "You need 5000 score ore more! Try to get 5000 score, and try again.");
else if(shout) return SendClientMessage(playerid, COLOR_RED, "Serverguid : {33FF00}You cant shout so fast! Please wait first ");
else if(!strlen(params)) SendClientMessage(playerid, 0xFF0000AA, "Serverguid: {00FF15}Use: /Shout [Message] - Try again!");
else
{
new PlayerName[MAX_PLAYER_NAME];
GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
format(string, sizeof(string), "Serverguid: {00FF15}%s Shouted: {F0FC03}%s!", PlayerName, params);
SendClientMessageToAll(COLOR_RED, string);
SetPlayerScore(playerid, GetPlayerScore(playerid) - 5000);
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
Timer1 = SetTimer("antishoutspam",120000,false);
shout= true;
GameTextForAll("-!!- Theres a new shout -!!-",2000,1);
}
return 1;
}

Forward

Quote:

public antishoutspam(playerid)
{
shout = false;
KillTimer(Timer1);
return 1;
}

init

Quote:

public OnGameModeInit()
{
SetTimer("antishoutspam",0,false);
return 1;

No errors, evrything is working
But how can i do that if someone shooted, a other guy can shout again, and if he shouted he needs to wait 2 mins.
Can you give a example?
Thank you
Reply


Messages In This Thread
Anti Command spam, /shout system - by Penait1 - 02.05.2011, 19:12
Re: Anti Command spam, /shout system - by Penait1 - 02.05.2011, 21:06
Re: Anti Command spam, /shout system - by park4bmx - 02.05.2011, 21:26

Forum Jump:


Users browsing this thread: 2 Guest(s)