-
Kellene egy olyan script hogyha ír valaki a chat re akkor 3 másodperc után írhassa a következõt. Ha meg nem várja meg a 3 másodpercet és írna akkor meg írja ki neki pirossal hogy Kérlek írj lassabban !
-
#include < a_samp >
public OnFilterScriptInit( )
{
SetTimer( \"Update\", 3000, true );
}
public OnPlayerConnect( playerid )
{
SetPVarInt( playerid, \"Flood\", 0 );
return 1;
}
public OnPlayerText( playerid, text[] )
{
SetPVarInt( playerid, \"Flood\", GetPVarInt( playerid, \"Flood\" ) + 1 );
if( GetPVarInt( playerid, \"Flood\" ) > 1 )
{
SendClientMessage( playerid, 0xFF0000AA, \"HIBA: 3 Másodpercenként küldhetsz üzenetet, Írj lassabban!\" );
}
return 0;
}
forward Update( playerid );
public Update( playerid )
{
foreach(Player, i)
{
if( GetPVarInt( i, \"Flood\" ) > 0 )
{
SetPVarInt( i, \"Flood\", 0 );
}
}
}
Most gyors írtam egyet, nem biztos, hogy jó, nem teszteltem.
-
Nekem úgy kellene hogyha 3 másodpercen belül akar írni valamit az ne jelenjen meg a chat en és akkor írja ki neki hogy Kérlek írj lassabban !
-
#include < a_samp >
public OnFilterScriptInit( )
{
SetTimer( \"Update\", 3000, true );
}
public OnPlayerConnect( playerid )
{
SetPVarInt( playerid, \"Flood\", 0 );
return 1;
}
public OnPlayerText( playerid, text[] )
{
SetPVarInt( playerid, \"Flood\", GetPVarInt( playerid, \"Flood\" ) + 1 );
if( GetPVarInt( playerid, \"Flood\" ) > 1 )
{
SendClientMessage( playerid, 0xFF0000AA, \"HIBA: 3 Másodpercenként küldhetsz üzenetet, Írj lassabban!\" );
}
return 0;
}
forward Update( playerid );
public Update( playerid )
{
foreach(Player, i)
{
if( GetPVarInt( i, \"Flood\" ) > 0 )
{
SetPVarInt( i, \"Flood\", 0 );
}
}
}
Így... Az OnPlayerText-nél return 0; ne térjen vissza!
-
De most meg error os:
C:\\Documents and Settings\\Robi\\Asztal\\Új mappa (4)\\new.pwn(28) : error 017: undefined symbol \"foreach\"
C:\\Documents and Settings\\Robi\\Asztal\\Új mappa (4)\\new.pwn(30) : error 017: undefined symbol \"i\"
C:\\Documents and Settings\\Robi\\Asztal\\Új mappa (4)\\new.pwn(32) : error 017: undefined symbol \"i\"
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
3 Errors.
-
#include < a_samp >
#include < foreach >
public OnFilterScriptInit( )
{
SetTimer( \"Update\", 3000, true );
}
public OnPlayerConnect( playerid )
{
SetPVarInt( playerid, \"Flood\", 0 );
return 1;
}
public OnPlayerText( playerid, text[] )
{
SetPVarInt( playerid, \"Flood\", GetPVarInt( playerid, \"Flood\" ) + 1 );
if( GetPVarInt( playerid, \"Flood\" ) > 1 )
{
SendClientMessage( playerid, 0xFF0000AA, \"HIBA: 3 Másodpercenként küldhetsz üzenetet, Írj lassabban!\" );
}
return 0;
}
forward Update( playerid );
public Update( playerid )
{
foreach(Player, i)
{
if( GetPVarInt( i, \"Flood\" ) > 0 )
{
SetPVarInt( i, \"Flood\", 0 );
}
}
}
Szükséges hozzá foreach.inc!
-
baseaf.inc
#include <a_samp>
static iPlayerChatTime[MAX_PLAYERS];
stock
IsPlayerFlooding(playerid)
{
if(GetTickCount() - iPlayerChatTime[playerid] < 2000)
return 1;
return 0;
}
public
OnPlayerText(playerid, text[])
{
// Is the player flooding?
if(IsPlayerFlooding(playerid) && !IsPlayerAdmin(playerid))
{
SendClientMessage(playerid, 0xFF0000FF, \"* You can only send a message once every two seconds.\");
return 0;
}
iPlayerChatTime[playerid] = GetTickCount();
// bla bla..
return 1;
}
public
OnPlayerDisconnect(playerid, reason)
{
iPlayerChatTime[playerid] = 0;
return 1;
}
public
OnPlayerCommandText(playerid, cmdtext[])
{
if(IsPlayerFlooding(playerid) && !IsPlayerAdmin(playerid))
{
SendClientMessage(playerid, 0xFF0000FF, \"* You can only use commands once every two seconds.\");
return 1;
}
iPlayerChatTime[playerid] = GetTickCount();
// command .....
return 0;
}
Legelsõ filterszkript-be -ként kell beleírni\\betenni.
server.cfg
filterscripts baseaf (többi szkript neve)
-
baseaf.inc
#include <a_samp>
static iPlayerChatTime[MAX_PLAYERS];
stock
IsPlayerFlooding(playerid)
{
if(GetTickCount() - iPlayerChatTime[playerid] < 2000)
return 1;
return 0;
}
public
OnPlayerText(playerid, text[])
{
// Is the player flooding?
if(IsPlayerFlooding(playerid) && !IsPlayerAdmin(playerid))
{
SendClientMessage(playerid, 0xFF0000FF, \"* You can only send a message once every two seconds.\");
return 0;
}
iPlayerChatTime[playerid] = GetTickCount();
// bla bla..
return 1;
}
public
OnPlayerDisconnect(playerid, reason)
{
iPlayerChatTime[playerid] = 0;
return 1;
}
public
OnPlayerCommandText(playerid, cmdtext[])
{
if(IsPlayerFlooding(playerid) && !IsPlayerAdmin(playerid))
{
SendClientMessage(playerid, 0xFF0000FF, \"* You can only use commands once every two seconds.\");
return 1;
}
iPlayerChatTime[playerid] = GetTickCount();
// command .....
return 0;
}
Legelsõ filterszkript-be -ként kell beleírni\\betenni.
server.cfg
filterscripts baseaf (többi szkript neve)
[/quote]
Kösz, mûködik ! ;D