SA-MP Forums Archive
help ? - 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: help ? (/showthread.php?tid=80916)



help ? - radi - 07.06.2009

how can i make a protection on the word
kwakbox
like
that i can use the word 1 time in 5 minutes
so is type
kwakbox
and i want to type it a gain
it says < You already sayed kwakbox wait 5 minutes >


Re: help ? - lol2112 - 07.06.2009

Don't really know how efficient this is but ought to work (not tested):

Код:
new StopKwak[MAX_PLAYERS]; //at the top of your script
forward AllowKwak(playerid);
Код:
OnPlayerText(playerid, text[])
{
     if(!strcmp(text, "kwakbox",false, 7))
     {
         if(StopKwak[playerid] == 0)
         {
               StopKwak[playerid] = 1;
               SetTimerEx("AllowKwak", 300000, false, "i", playerid);
         }
         else
         {
               SendClientMessage(playerid, 0xFF0000, "Please wait 5 minutes before saying kwakbox again!");
               return 0;
         }
      }
      return 1;
}
Код:
public AllowKwak(playerid) //anywhere in your script
{
     StopKwak[playerid] = 0;
}



Re: help ? - radi - 07.06.2009

thanks that works
my bot dousnt responds on it


Re: help ? - [CK]Steel - 07.06.2009

Quote:
Originally Posted by tim1120
thanks that works
my bot dousnt responds on it
If it does not show your text, copy the following and re-paste it were you had before.. DO NOT CHANGE ANYTHING ELSE, EXCEPT THIS....

pawn Код:
OnPlayerText(playerid, text[])
{
     if(!strcmp(text, "kwakbox",false, 7))
     {
         if(StopKwak[playerid] == 0)
         {
               StopKwak[playerid] = 1;
               SetTimerEx("AllowKwak", 300000, false, "i", playerid);
         }
         else
         {
               SendClientMessageToPlayer(playerid, 0xFF0000, "Please wait 5 minutes before saying kwakbox again!");
               return 0;
         }
      }
      return 1;
}
Your actually changing,
Код:
SendClientMessage
to this..
.
Код:
SendClientMessageToPlayer
Which this is actually gonna send the Player who said "Kwakbox", the message saying "Please wait 5 minutes before saying kwakbox again!"


Re: help ? - lol2112 - 07.06.2009

Quote:
Originally Posted by tim1120
my bot dousnt responds on it
What do you mean by that? Does it work or doesn't it...

Quote:
Originally Posted by tim1120
Your actually changing,
Код:
SendClientMessage
to this..
.
Код:
SendClientMessageToPlayer
Which this is actually gonna send the Player who said "Kwakbox", the message saying "Please wait 5 minutes before saying kwakbox again!"
Not true, SendClientMessage sends a message to a particular player, while SendClientMessageToAll sends a message to all the players in the server.