Prevent /o spam?
#1

How do I prevent /o spam? Like put a 3 second timer between using /o
Reply
#2

new CanTalk[MAX_PLAYERS];


if(CanTalk[playerid]==0){
SendClientMessage(playerid, red, "You cannot speak in /o right now to prevent spam");
return 1;
}

under your command: CanTalk[playerid]=0;
SetTimerEx("CanTalkInO" blah blah

under public CanTalkInO
CanTalk[playerid]=1;

I hope it's clear enough.

Reply
#3

Hah, I though it was gonna be something like tick count, its clear, so if nobody helps with GetTickCount, then ill use yours. Thanks
Reply
#4

if(GetPVarInt(playerid,"miau")> GetTickCount()) return 0;
SetPVarInt(playerid,"miau", GetTickCount()+3000);
Reply
#5

And how does that work?
Reply
#6

You don't need timer.

pawn Код:
new lasttimeooc[MAX_PLAYERS];
pawn Код:
// /o
if((gettime() - lasttimeooc[playerid]) > 3)
{
  lasttimeooc[playerid] = gettime();

  //Rest of the ooc cmd code here.
}
else
{
  return SendClientMessage(playerid, COLOR_HERE, "Wait 3 seconds before talking again, k?");
}
Edit: lol at below. You replaced 3 parts of my script with identical code and decided to post it cuz it's so much different from mine?

I c wat you did thar.
Reply
#7

pawn Код:
if(GetPVarInt(playerid,"OCCTick")< GetTickCount() + 3000)
{
    SetPVarInt(playerid,"OCCTick", GetTickCount());
    // Do your thing
}
else
{
    // Must wait 3 seconds
}
Reply
#8

Fin, don't beak Mike. He has helped my script so much, and PVar is better than normal variables, so thanks for the help, but lets not be ass holes over forums.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)