SA-MP Forums Archive
Scripting 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)
+--- Thread: Scripting Help (/showthread.php?tid=521136)



Scripting Help - kirostar - 21.06.2014

i want /blockcommands (command) for my admin system, because sometimes player makes /go many times so i want to block his commands for minutes, i searched for it but didn't get it, please help.


Re: Scripting Help - kirostar - 21.06.2014

:bumb:


Re: Scripting Help - AiRaLoKa - 22.06.2014

i just want to help

place it somewhere in your script (on the top under the #include <a_samp>)
pawn Код:
new bool:CmdBlocked;
inside of the /blockcommands
pawn Код:
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1, "you are not rcon administrator");
CmdBlocked = ((CmdBlocked) ? false : true);
SendClientMessage(playerid, -1, (CmdBlocked) ? "Command unblocked" : "Command blocked");
and inside the command that you want to block when it's blocked
pawn Код:
if(CmdBlocked) return SendClientMessage(playerid, -1, "Command is currently disabled");



Re: Scripting Help - kirostar - 22.06.2014

Код:
SendClientMessage(playerid, -1, (CmdBlocked) ? "Command unblocked" : "Command blocked");
This line have an error :

Код:
error 001: expected token: "-string end-", but found "-identifier-"



Re: Scripting Help - AiRaLoKa - 22.06.2014

it's worked for me with no error at all

but you can replace that line with this
pawn Код:
if(CmdBlocked) SendClientMessage(playerid, -1, "Command blocked");
else SendClientMessage(playerid, -1, "Command unblocked");
or
pawn Код:
SendClientMessage(playerid, -1, ((CmdBlocked) ? "Command blocked" : "Command unblocked"));



Re: Scripting Help - Bek_Loking - 22.06.2014

Replace this:
Код:
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1, "you are not rcon administrator");
with this:

Код:
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1, "you are not rcon administrator")
When there's a "if" this ";" shouldn't be there.


Re: Scripting Help - AiRaLoKa - 22.06.2014

Quote:
Originally Posted by Bek_Loking
Посмотреть сообщение
Replace this:
Код:
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1, "you are not rcon administrator");
with this:

Код:
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1, "you are not rcon administrator")
When there's a "if" this ";" shouldn't be there.
you've made a mistake
it was the "if" end. it was returned to SendClientMessage.


Re: Scripting Help - kirostar - 22.06.2014

Sorry i didn't focus to the command i want this to do it for players not for myself


Re: Scripting Help - AiRaLoKa - 22.06.2014

Quote:
Originally Posted by kirostar
Посмотреть сообщение
Sorry i didn't focus to the command i want this to do it for players not for myself
yeah. if you do like what i said, the command will blocked for everyone in your server.(if you block it ofcourse)


Re: Scripting Help - Raza2013 - 22.06.2014

use bools instead of local variable