Help Zcmd
#1

Hello, what happens is that through my commands CMD: but now remaining in OnPlayerCommandText not work

because it happens?

pawn Код:
//In OnPlayerCommandText(playerid, cmdtext[])
   

    if(IsPlayerFlooding(playerid))
    {
    new Float:X,Float:Y,Float:Z;
    PlayerPlaySound(playerid, 1009, X, Y, Z);
    SendClientMessage(playerid, 0xFF0000FF, "*** {80FF80} No Flood");
    return 1;
    }
    iPlayerChatTime[playerid] = GetTickCount();
    if(SpawnCMDS[playerid]==1)
    {
    static Float:X,Float:Y, Float:Z;GetPlayerPos(playerid,X, Y,Z);SetPlayerPos(playerid,X,Y,Z+1);
    PlayerPlaySound(playerid, 1009, X, Y, Z);
    SetPlayerHealth(playerid,100);
    SpawnPlayer(playerid);
    GameTextForPlayer(playerid, "~g~came out of the dm", 3000,3);
    return 1;
    }
    if (BloqueoCMDS[playerid]==1)//Lock command
    {
    static Float:X,Float:Y,Float:Z;GetPlayerPos(playerid,X, Y,Z);SetPlayerPos(playerid,X,Y,Z);
    PlayerPlaySound(playerid,1095,0.0,0.0,0.0);
    GameTextForPlayer(playerid, "~r~You can not use commands", 3000,3);
    return 1;
    }

//Commands in CMD
CMD:dm(playerid, params[])
{
BloqueoCMDS[playerid]=1;
return 1;}
//protection does not work command
Reply
#2

Can you show some more of your code
Reply
#3

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
    {

    new cmd[50],idx; cmd = strtok(cmdtext, idx);
    if(IsPlayerFlooding(playerid))
    {
    new Float:X,Float:Y,Float:Z;
    PlayerPlaySound(playerid, 1009, X, Y, Z);
    SendClientMessage(playerid, 0xFF0000FF, "*** {80FF80} No agas flood de comandos");
    GameTextForPlayer(playerid, "_~n~_~n~~w~No Flood~n~~r~de Comandos", 4000, 6);
    return 1;
    }
    iPlayerChatTime[playerid] = GetTickCount();
    if(SpawnCMDS[playerid]==1)
    {
    static Float:X,Float:Y, Float:Z;GetPlayerPos(playerid,X, Y,Z);SetPlayerPos(playerid,X,Y,Z+1);
    PlayerPlaySound(playerid, 1009, X, Y, Z);
    SetPlayerHealth(playerid,100);
    SpawnPlayer(playerid);
    GameTextForPlayer(playerid, "~g~Fuera del ~y~Game/Dm/Race/Event", 3000,3);
    return 1;
    }
    if (BloqueoCMDS[playerid]==1)//No usar cmds - No usar comandos
    {
    static Float:X,Float:Y,Float:Z;GetPlayerPos(playerid,X, Y,Z);SetPlayerPos(playerid,X,Y,Z);
    PlayerPlaySound(playerid,1095,0.0,0.0,0.0);
    ShowPlayerDialog(playerid,EstasEnDM, DIALOG_STYLE_MSGBOX, " ", "{FF0000}|®| Aviso: {FFFFFF}Estas en Dm/Race/Game y no pudes usar comandos\nSi deseas abandonar La zona clickea {FF8000}SalirDm", "Ok", "SalirDm");
    return 1;
    }
      if (strcmp("/p", cmdtext, true, 10) == 0){GivePlayerWeapon(playerid,46,1);GameTextForPlayer(playerid,"_~n~_~n~_~n~~b~Paracaidas",3000,6);return 1;}
return 1;//Public closed
}
I'm using CMD

OnPlayerCommandText but nothing works for me
Reply
#4

What happens if you type /p ?
Reply
#5

this, and other functions do not work

pawn Код:
public OnPlayerCommandPerformed(playerid, cmdtext[], success)
{
if(!success) return SendClientMessage(playerid, 0xFF0000FF, "The command does not exist");//This mesagge
return 1;
}

pawn Код:
new pos, funcname[MAX_FUNC_NAME];
    while(cmdtext[++pos] > ' ')
    {
        funcname[pos-1] = tolower(cmdtext[pos]);
    }
    format(funcname, sizeof(funcname),"_%s",funcname);
    while(cmdtext[pos] == ' ') pos++;
    if(!cmdtext[pos])
    {
        if(CallLocalFunction(funcname, "is", playerid, "\1"))
            return 1;
    }
    if(CallLocalFunction(funcname, "is", playerid, cmdtext[pos]))
        return 1;

    PlayerPlaySound(playerid, 1009, 0, 0, 0);
    return UnknownCommand(playerid);

}
already solved thanks
Reply
#6

If you are using zcmd, OnPlayeraCommandText won't work because of the include system.

Checkout this: https://sampforum.blast.hk/showthread.php?tid=91354
Reply
#7

^

If you're using zcmd don't put command under "OnPlayerCommandText" callback but put it Outside of callback.
For example:

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
    {
    // bla bla bla
}

// YOUR CODE GOES HERE

public OtherCallBacks(Goes,here)
{
    //
}
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)