BlockCommand [+REP]
#1

Hello i want to create and command to block other commands
I want it example : /blockcmd [command name]
and when the other people try the commands blocked
Thank you
Reply
#2

There is probably better and more advanced ways to do this but I'll give you a simple soloution.
PS: This is just pseudo code.
Код:
new bool:CanUseStats[MAX_PLAYERS];

In command /stats
{
     if(!CanUseStats[playerid]) return SendClientMessage(playerid, 0x0000FF, "You can't use this command!);
}

In /blockcmd
{
  Use scanf to deal with params, you will need two, the player id and the command to block
    if(!strcmp(cmd, "stats", true))
    {
         CanUseStats[player] = false;
    }
}
You can work based on that now to block any cmd you want.
Reply
#3

Hmm what about the MySQL
If i register in it and Can be changed IN GAme ?
How to use it ? with #define ?
Reply
#4

What MySQL? I don't really understand what you are trying to do.
Reply
#5

More of times i saw when login in any gamemode
I found example: #define Ban 1
And ban command is enable / disable
Reply
#6

If you use #define it won't be dynamic anymore. Which means you will only be able to black and unblock commands after changing that in the script and restarting the server. Just use variables instead. And if you mean that you want to keep that command blocked even after the server restarts, just save it like you save any other player stats. If you are using MySQL, create a table called cmds for example and for the structure add all the commands you want.
Reply
#7

Quote:
Originally Posted by mirou123
Посмотреть сообщение
If you use #define it won't be dynamic anymore. Which means you will only be able to black and unblock commands after changing that in the script and restarting the server. Just use variables instead. And if you mean that you want to keep that command blocked even after the server restarts, just save it like you save any other player stats. If you are using MySQL, create a table called cmds for example and for the structure add all the commands you want.
Soo if i create the commands
It mut bee variable for all commands
EXP: BlockStats
Reply
#8

Yeah one variable for each command. You can also make an array but you have to remember Which command has which index.
For example: new CMDs[3];
0 would be for /ban
1 would be for /kick
2 for /jail etc...
That will block that command for everyone though not just one player.
Reply
#9

https://sampforum.blast.hk/showthread.php?tid=568459
Reply
#10

I want it to be saved and after restart server
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)