anticommandspam - OCMD -
playstores - 09.10.2018
Is there a possibility to anticommandspam while using ocmd without checking commandspam before
every single command?
Re: anticommandspam - OCMD -
KinderClans - 09.10.2018
I don't know how ocmd works but in my gamemode, in OnPlayerCommandRecieved, i have this:
pawn Код:
if(Player[playerid][IsLoggedIn] == false) return ShowPlayerFooter(playerid, "You need to be ~r~logged ~w~to use commands.", 5000);
To prevent non logged players the usage of commands.
You can easily replace it with your anti cmd spam code.
Re: anticommandspam - OCMD -
XxBaDxBoYxX - 09.10.2018
Use a mixture of this
tutorial by
[HLF]Southclaw &
OnPlayerCommandRecieved
Re: anticommandspam - OCMD -
Undef1ned - 09.10.2018
Quote:
Originally Posted by XxBaDxBoYxX
Use a mixture of this tutorial by [HLF]Southclaw & OnPlayerCommandRecieved
|
Why use something like that if it's just done with a single line?
Re: anticommandspam - OCMD -
KinderClans - 09.10.2018
...Or if you wish to block just some commands:
Put:
pawn Код:
SetPVarInt(playerid,"CmdTime",GetTickCount()+10000);//10000 stands for 10 seconds
In the command you wish to block.
And:
pawn Код:
if(GetPVarInt(playerid,"CmdTime")>GetTickCount()) return SendClientMessage(playerid,-1,"* Please wait before using this command again.");
In
OnPlayerCommandRecieved.
Obviosuly pvars are just an idea. You can use tick count instead if you wish.
Re: anticommandspam - OCMD -
XxBaDxBoYxX - 10.10.2018
Quote:
Originally Posted by Undef1ned
Why use something like that if it's just done with a single line?
|
The result would be also a single if condition (or switch, according to the scripter's will)
Simply, Learning and applying it yourself is by far better practice than waiting for someone else to "feed" it for you.
Re: anticommandspam - OCMD -
Bruno13 - 10.10.2018
Quote:
Originally Posted by KinderClans
...Or if you wish to block just some commands:
Put:
pawn Код:
SetPVarInt(playerid,"CmdTime",GetTickCount()+10000);//10000 stands for 10 seconds
In the command you wish to block.
And:
pawn Код:
if(GetPVarInt(playerid,"CmdTime")>GetTickCount()) return SendClientMessage(playerid,-1,"* Please wait before using this command again.");
In OnPlayerCommandRecieved.
Obviosuly pvars are just an idea. You can use tick count instead if you wish.
|
PVar is the last option to get performance.
Re: anticommandspam - OCMD -
KinderClans - 11.10.2018
I know, it was just to give him an idea.
Re: anticommandspam - OCMD -
playstores - 13.10.2018
I tried it with GetTickCount and GetTime both won't work > OnPlayerCommandPerformed works
I can just type a Command every single sec like before
public OnPlayerCommandPerformed(playerid, cmdtext[], success)
{
if(success)
{
if(lastcommand[playerid]>gettime()) return SendClientMessage(playerid,-1,"* Please wait before using this command again.");
lastcommand[playerid] = gettime()+10000;
return 1;
}
return 1;
}
Re: anticommandspam - OCMD -
KinderClans - 13.10.2018
You have to put:
pawn Код:
lastcommand[playerid] = gettime()+10000;
In every command you wish to block.