Deny All commands exept 2
#1

While the player is in jail i dont want him to be able to use any cmd just /help & /ask
pawn Код:
if (GetPlayerVirtualWorld[playerid] == 1)
{
        SendClientMessage(playerid, 0xFF0000AA, "You cannot use any command just /help & /ask");
    return 0;
}
Reply
#2

Nice. Anything wrong?
Reply
#3

Quote:
Originally Posted by Super_Panda
Посмотреть сообщение
While the player is in jail i dont want him to be able to use any cmd just /help & /ask
pawn Код:
if (GetPlayerVirtualWorld[playerid] == 1 && strcmp(cmdtext, "/help") && strcmp(cmdtext, "/ask")) return SendClientMessage(playerid, 0xFF0000AA, "You cannot use any command just /help & /ask");
That should work.
Reply
#4

pawn Код:
C:\Users\Alex\Desktop\Untitled.pwn(133) : warning 235: public function lacks forward declaration (symbol "OnPlayerCommandReceived")
C:\Users\Alex\Desktop\Untitled.pwn(135) : error 028: invalid subscript (not an array or too many subscripts): "GetPlayerVirtualWorld"
C:\Users\Alex\Desktop\Untitled.pwn(135) : warning 215: expression has no effect
C:\Users\Alex\Desktop\Untitled.pwn(135) : error 001: expected token: ";", but found "]"
C:\Users\Alex\Desktop\Untitled.pwn(135) : error 029: invalid expression, assumed zero
C:\Users\Alex\Desktop\Untitled.pwn(135) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


4 Errors.
pawn Код:
public OnPlayerCommandReceived(playerid, cmdtext[])
{
    if (GetPlayerVirtualWorld[playerid] == 10 && strcmp(cmdtext, "/help") && strcmp(cmdtext, "/ask")) return SendClientMessage(playerid, 0xFF0000AA, "You cannot use any command just /help & /ask");
    {


    }
    return 1;
}
Reply
#5

1) Use OnPlayerCommandText, not OnPlayerCommandReceived.
2) It's GetPlayerVirtualWorld(playerid) not GetPlayerVirtualWorld[playerid]
Reply
#6

In short, this should work:

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (GetPlayerVirtualWorld(playerid) == 10 && !strcmp(cmdtext, "/help") && !strcmp(cmdtext, "/ask")) {
        SendClientMessage(playerid, 0xFF0000AA, "You cannot use any command just /help & /ask");
        return 0;
    }
   
    return 1;
}
[03]Garsino must have accidentally typed the wrong brackets and forgotten the exclamation mark before strcmp() or == 0 at the end, and was thinking you were using a more modern command processor (zcmd).
Reply
#7

That'll work for strcmp I need it for DCMD or SSCANF
Reply
#8

easy is check in help command that player is jail you return that he can't use it
Reply
#9

Quote:
Originally Posted by Calgon
Посмотреть сообщение
[03]Garsino must have accidentally typed the wrong brackets and forgotten the exclamation mark before strcmp() or == 0 at the end, and was thinking you were using a more modern command processor (zcmd).
Nope... Look at the posts he posted (first post for example). I just copied his code and added the extra checks. Oh and; your code is wrong. He want to deny every command except /help and /faq. Your code blocks the only command he didn't want to block.

Super_Panda: OnPlayerCommandText can be used with DCMD. And SSCANF is not a command processor...
Reply
#10

Ah, my bad. Sorry.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)