Server Unknown command.
#1

I create a script but when I type the command, the command doesn't work...

My script:
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/lancerderby", cmdtext, true, 10) == 0)
    {
          if(IsPlayerConnected(playerid) && (derby == 0) && IsPlayerAdmin(playerid)){

            derby = 1;
            SendClientMessageToAll(0xDEEE20FF, "Un admin a lancй un derby, /rejoindrederby pour le rejoindre."); }
            return 1;
     }
     
    if (strcmp("/fermerderby", cmdtext, true, 10) == 0)
    {
            if(IsPlayerConnected(playerid) && (derby == 1) && IsPlayerAdmin(playerid)) {
           
            derby = 0;
            SendClientMessageToAll(0xDEEE20FF, "Le derby est maintenant terminй."); }
            return 1;
    }
     
    if (strcmp("/rejoindrederby", cmdtext, true, 10) == 0)
    {
            if(IsPlayerConnected(playerid) && (derby == 1)) {
           
            ResetPlayerWeapons(playerid);
            SetPlayerPos(playerid,2499.3069,2981.0603,2.3494);
            SendClientMessage(playerid, 0xDEEE20FF, "Rejoins une des voiture placйes sur la piste!."); }
            return 1;
    }

    return 0;
}
Thanks for helping me and sorry for my english!
Reply
#2

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/lancerderby", cmdtext, true, 12) == 0)
    {
          if(IsPlayerConnected(playerid) && (derby == 0) && IsPlayerAdmin(playerid)){

            derby = 1;
            SendClientMessageToAll(0xDEEE20FF, "Un admin a lancй un derby, /rejoindrederby pour le rejoindre."); }
            return 1;
     }

    if (strcmp("/fermerderby", cmdtext, true, 12) == 0)
    {
            if(IsPlayerConnected(playerid) && (derby == 1) && IsPlayerAdmin(playerid)) {

            derby = 0;
            SendClientMessageToAll(0xDEEE20FF, "Le derby est maintenant terminй."); }
            return 1;
    }

    if (strcmp("/rejoindrederby", cmdtext, true, 15) == 0)
    {
            if(IsPlayerConnected(playerid) && (derby == 1)) {

            ResetPlayerWeapons(playerid);
            SetPlayerPos(playerid,2499.3069,2981.0603,2.3494);
            SendClientMessage(playerid, 0xDEEE20FF, "Rejoins une des voiture placйes sur la piste!."); }
            return 1;
    }

    return 0;
}
Reply
#3

It still doesn't work..
Reply
#4

Are you logged on RCON admin? Why doesn't works? Simply shows "nothing" or an "unknown command" error?

I suggest you to use ZCMD and SSCANF.
Reply
#5

Simply shows "unknown command".

A friend try this script in his server and it worked so I don't know what is the problem...
Reply
#6

You don't need the IsPlayerConnected, because you can't use a command when you're not on server.

Also check the OnPlayerCommandText in other of your active Gamemodes/Filterscripts. Otherwise, I don't know, and I suggest you to use ZCMD and SSCANF: easier and faster.
Reply
#7

I'll try this and tell you what happen thanks
Reply
#8

If you're using this as a filterscript, is it loaded?
Reply
#9

Try This?

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/lancerderby", cmdtext, true, 10) == 0)
    {
          if(IsPlayerConnected(playerid) && (derby == 0) && IsPlayerAdmin(playerid)){

            derby = 1;
            SendClientMessageToAll(0xDEEE20FF, "Un admin a lancй un derby, /rejoindrederby pour le rejoindre."); }
            return 1;
     }
     
    if (strcmp("/fermerderby", cmdtext, true, 10) == 0)
    {
            if(IsPlayerConnected(playerid) && (derby == 1) && IsPlayerAdmin(playerid)) {
           
            derby = 0;
            SendClientMessageToAll(0xDEEE20FF, "Le derby est maintenant terminй."); }
            return 1;
    }
     
    if (strcmp("/rejoindrederby", cmdtext, true, 10) == 0)
    {
            if(IsPlayerConnected(playerid) && (derby == 1)) {
           
            ResetPlayerWeapons(playerid);
            SetPlayerPos(playerid,2499.3069,2981.0603,2.3494);
            SendClientMessage(playerid, 0xDEEE20FF, "Rejoins une des voiture placйes sur la piste!."); }
            return 1;
    }

    return 1;
}
Untested
Reply
#10

Quote:
Originally Posted by stuartd96
Посмотреть сообщение
Try This?

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/lancerderby", cmdtext, true, 10) == 0)
    {
          if(IsPlayerConnected(playerid) && (derby == 0) && IsPlayerAdmin(playerid)){

            derby = 1;
            SendClientMessageToAll(0xDEEE20FF, "Un admin a lancй un derby, /rejoindrederby pour le rejoindre."); }
            return 1;
     }
     
    if (strcmp("/fermerderby", cmdtext, true, 10) == 0)
    {
            if(IsPlayerConnected(playerid) && (derby == 1) && IsPlayerAdmin(playerid)) {
           
            derby = 0;
            SendClientMessageToAll(0xDEEE20FF, "Le derby est maintenant terminй."); }
            return 1;
    }
     
    if (strcmp("/rejoindrederby", cmdtext, true, 10) == 0)
    {
            if(IsPlayerConnected(playerid) && (derby == 1)) {
           
            ResetPlayerWeapons(playerid);
            SetPlayerPos(playerid,2499.3069,2981.0603,2.3494);
            SendClientMessage(playerid, 0xDEEE20FF, "Rejoins une des voiture placйes sur la piste!."); }
            return 1;
    }

    return 1;
}
Untested
This wouldn't work at all. This callback should return false at the end and still the lenght of the command is wrong. Since it's optional, just don't use it at all if it's going to be incorrect.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)