Global OOC
#1

Alright I completed the code, but for some reason, I can spam the same thing without getting any mesage.

pawn Код:
dcmd_o(playerid,params[])
{
    new string[128], spam[128];
    if(!strlen(params)) return SendClientMessage(playerid, color_white,"[Info] Usage: /o [message]");
    if(gPlayerMuted[playerid] == 0) {
      if(TogOOC == 1) {
        if(GetPVarInt(playerid,"OCCTick")< GetTickCount() + 3000)
            {
                GetPVarString(playerid,"params", spam, sizeof(spam));
                if(!strcmp(params, spam, false, strlen(params)))
                {
                    SetPVarString(playerid,"params", params);
                    SetPVarInt(playerid,"OCCTick", GetTickCount());
                    format(string,sizeof(string),"(( OOC: [ID:%d] %s: %s ))", playerid ,GetPlayerNameEx(playerid),params);
                    SendGlobalMessage(color_ooc, string);
                    printf("[%d]%s: %s ",playerid ,GetPlayerNameEx(playerid), params);
                    return 1;
                }
                else
                {
                  SendClientMessage(playerid, color_red, "[Error] Please refrain from saying the same thing twice.");
                  return 1;
                }
            }
            else
            {
              SendFormattedMessage(playerid, color_red, "[Error] You must wait %d seconds before talking again!", GetTickCount() / 100);
              return 1;
            }
        }
        else
        {
          SendClientMessage(playerid, color_red, "[Error] The Global OOC chat is currently disabled!");
          return 1;
        }
    }
    else
    {
      SendClientMessage(playerid, color_red, "[Error] You cannot use the Global OOC chat while muted");
      return 1;
    }
}
Reply
#2

Wait, whats' your problem here again?
Reply
#3

The think isn't working, I can repeat myself and spam as much as I want.
Reply
#4

Bump
Reply
#5

If you can't understand his indention click here.


http://pawn.pastebin.com/dNkw4NrK
Reply
#6

Lol sa-mp Forums fuck it up. Thanks for the pastebin mate
Reply
#7

is there a timer or some more code that does the mute stuff? if so can i see it
and is the goal 1 msgs or less per player per 3secs?
Reply
#8

The mute doesn't affect the problem. There's 2 objectives, 1. You cannot repeat yourself. 2. After talking you must wait 3 seconds before typing again.
Reply
#9

What about using a variable?
new CanUseOOC[MAX_PLAYERS];
SetTimerEx("HasGateOpen", 3000, 0, "d", playerid);
CanUseOOC[playerid] =1;

forward CanUseO(playerid)
public CanUseO(playerid)
{

CanUseOOC[playerid] = 1;
return 1;
}
if(strcmp(cmd, "/o", true) == 0)
{
if(CanUseOOC[playerid] == 1);
{


Work something out.
Reply
#10

well where do you set the pvar "OCCTick" coz if thats 0 then you will always be able to say as much as you want
and also "spam" coz if that is "/n" then your string wont be the same an you can repeat your self
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)