25.01.2015, 01:43
Maybe it work for you, but your example is wrong.
Let's say that, all players need to have score greater then 1, ok?
And on the server we will have 2 players: Player X and Player Y.
Your code will be
Now, Player X's level is 2 and Player Y's level is 1.
Each player will execute two commands.
/command1 - require score 2 to use it.
/command2 - doesn't exist.
Player X will execute: /command1 and /command2.
When Player X will execute /command1, he will be ok, no error message.
When Player X will execute /command2, he will receive a message with unknown command.
Player Y will execute: /command1 and /command2.
When Player Y will execute /command1, he will receive a message about the level.
When Player Y will execute /command2, he will receive a message with unknown command and about the level.
So, if you want to avoid this you need to return function with 0 and you need that.
Let's say that, all players need to have score greater then 1, ok?
And on the server we will have 2 players: Player X and Player Y.
Your code will be
pawn Код:
public OnPlayerCommandPerformed(playerid, cmdtext[], success)
{
if(!success)
SendClientMessage(playerid, COLOR_NEWS, "Error: That command does not exist. Refer to /help for server commands.");
if(GetPlayerScore(playerid) <= 1)
SendClientMessage(playerid, COLOR_NEWS, "Error: You need to have score greater then 1 to use commands on this server");
return 1;
}
Each player will execute two commands.
/command1 - require score 2 to use it.
/command2 - doesn't exist.
Player X will execute: /command1 and /command2.
When Player X will execute /command1, he will be ok, no error message.
When Player X will execute /command2, he will receive a message with unknown command.
Player Y will execute: /command1 and /command2.
When Player Y will execute /command1, he will receive a message about the level.
When Player Y will execute /command2, he will receive a message with unknown command and about the level.
So, if you want to avoid this you need to return function with 0 and you need that.