SA-MP Forums Archive
Server Unknown command. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Server Unknown command. (/showthread.php?tid=403567)



Server Unknown command. - HshinnOued - 30.12.2012

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!


Re: Server Unknown command. - Feastahashi - 30.12.2012

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;
}



Re : Server Unknown command. - HshinnOued - 30.12.2012

It still doesn't work..


Re: Server Unknown command. - Feastahashi - 30.12.2012

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.


Re : Server Unknown command. - HshinnOued - 30.12.2012

Simply shows "unknown command".

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


Re: Server Unknown command. - Feastahashi - 30.12.2012

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.


Re : Server Unknown command. - HshinnOued - 30.12.2012

I'll try this and tell you what happen thanks


Re: Server Unknown command. - ViruZz - 30.12.2012

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


Re: Server Unknown command. - StuartD - 30.12.2012

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


Re: Server Unknown command. - Konstantinos - 30.12.2012

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.