SA-MP Forums Archive
Global OOC - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Global OOC (/showthread.php?tid=156511)



Global OOC - Antonio [G-RP] - 23.06.2010

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;
    }
}



Re: Global OOC - NiiRV4N4 - 23.06.2010

Wait, whats' your problem here again?


Re: Global OOC - Antonio [G-RP] - 23.06.2010

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


Re: Global OOC - Antonio [G-RP] - 23.06.2010

Bump


Re: Global OOC - Retardedwolf - 23.06.2010

If you can't understand his indention click here.


http://pawn.pastebin.com/dNkw4NrK



Re: Global OOC - Antonio [G-RP] - 23.06.2010

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


Re: Global OOC - (SF)Noobanatior - 23.06.2010

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?


Re: Global OOC - Antonio [G-RP] - 23.06.2010

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.


Re: Global OOC - NiiRV4N4 - 23.06.2010

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.


Re: Global OOC - (SF)Noobanatior - 23.06.2010

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