all commands unknown, but I returned right...
#1

All my commands display Server: unknown command
Still, I'm pretty sure that I did not return wrong...

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    new string[256];
    new sendername[MAX_PLAYER_NAME];
    new cmd[256];
    new idx;
    cmd = strtok(cmdtext, idx);
    new giveplayerid, moneys;
    new giveplayer[MAX_PLAYER_NAME];
   
    if(JailTime[playerid] != 0)
    {
        SendClientMessage(playerid, COLOR_RED, "You can not use commands whil you are in jail!");
        return 1;
    }

//==============================================================================
//Speepcap CMD
//==============================================================================

    if ( !strcmp( "/myspeedcap", cmdtext, true, 11 ) )
    {
        new
            szMessage[ 24 ]
        ;

        if ( !( cmdtext[ 11 ] && cmdtext[ 12 ] ) )
        {
            SendClientMessage(playerid, COLOR_LIGHTBLUE , "USAGE: /myspeedcap [max speed] pick a value between 0 and 0.9 " );
            SendClientMessage(playerid, COLOR_LIGHTBLUE , "0 will disable the speed cap." );

            return 1;
        }

        g_fSpeedCap[ playerid ] = floatstr( cmdtext[ 12 ] );

        format( szMessage, sizeof( szMessage ), "* Speed cap: %0.4f", g_fSpeedCap[ playerid ] );

        SendClientMessage( playerid, 0xFFFF00FF, szMessage );

        return 1;
    }
   
//==============================================================================
//Blow Up minigame
//==============================================================================
        if(strcmp(cmd, "/blowup", true) == 0)
        {

            for(new i = 0; i < MAX_PLAYERS; i++)
            {
                if(gTeam[i] != TEAM_BANDIT)
                {
                    SendClientMessage(playerid,COLOR_RED,"This minigame is only for Bandits!");
                    return 1;
                }
                if(GetPlayerScore(playerid) < 500)
                {
                    SendClientMessage(playerid,COLOR_RED,"You need a score of atleast 500 to play this minigame!");
                    return 1;
                }
               
                if(GetPlayerMoney(playerid) < 5000)
                {
                    SendClientMessage(playerid,COLOR_RED,"You Do not have enough money for this minigame!");
                    return 1;
                }
               
                if(blowupvar[playerid] != 1)
                {
                    SendClientMessage(playerid,COLOR_RED,"You cannot enter the blowup minigame yet, check the timer at the right please.");
                    return 1;
                }

                if(blowupvar[playerid] == 1)
                {
                    SendClientMessageToAllBandits("The blowup minigame has started, backup your teammate (marked as a red flag)");
                    SendClientMessageToAllBandits("So he will win, also the other Bandits will be rewarded");

                    SetTimer("blowupgame", 200, false);
                    GivePlayerMoney(playerid, -5000);
                    SendClientMessage(playerid, COLOR_ORANGE, " ");
                    SendClientMessage(playerid, COLOR_ORANGE, "|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||");
                    SendClientMessage(playerid, COLOR_ORANGE, "Gratz! u are playing the game Blowup! NOTE: joining the game costed u $5000");
                    SendClientMessage(playerid, COLOR_ORANGE, "But winning this game will earn u $50000");
                    SendClientMessage(playerid, COLOR_ORANGE, "|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||");

                    SetPlayerWantedLevel(playerid, 6);

                    format(string,sizeof(string),"IMPORTANT: A bandit has started a mission to blowup the Cops base... quick! stop him!");
                    SendClientMessageToAllCops(string);
                    SendClientMessageToAllCops("He's name is unknown yet but he's marked as a red flag on the radar... catch him!");

                    SendClientMessageToAllDrivers("A bandit is about to try to blow up the Cops team base...");
                    SendClientMessageToAllDrivers("Help the cops, and u will be rewarded!");

                    mtask[playerid] = 0;
                    isblower[playerid] = 1;
                    blowupvar[i] = 0;
                    return 1;
                }
            break;
            }
        return 1;
    }
//==============================================================================
//Rating
//==============================================================================
if(!strcmp(cmdtext, "/rate", true))
    {
        ShowPlayerDialog(playerid,DIALOG,DIALOG_STYLE_MSGBOX,"Server rating system","This is the server rating system.\nIf you want to rate this server,\npress Okay, else press Cancel.","Okay","Cancel");
        return 1;
    }
   
//==============================================================================
//Bounty command
//==============================================================================
 if(strcmp(cmd, "/bounty", true) == 0) {
        new tmp[256];
        tmp = strtok(cmdtext, idx);

        if(!strlen(tmp)) {
            SendClientMessage(playerid, COLOR_ERROR, "USAGE: /bounty [playerid] [amount]");
            return 1;
        }
        giveplayerid = strval(tmp);

        tmp = strtok(cmdtext, idx);
        if(!strlen(tmp)) {
            SendClientMessage(playerid, COLOR_ERROR, "USAGE: /bounty [playerid] [amount]");
            return 1;
        }
        moneys = strval(tmp);

        if(moneys > GetPlayerMoney(playerid)) {
            SendClientMessage(playerid, COLOR_ERROR, "You don't have enough money!");
            return 1;
        }
        if(moneys < 1) {
            SendClientMessage(playerid, COLOR_YELLOW, "Hey what are you trying to pull here?");
            return 1;
        }
        if(IsPlayerConnected(giveplayerid)==0) {
            SendClientMessage(playerid, COLOR_ERROR, "Player is not connected");
            return 1;
        }
        if(gTeam[playerid] == gTeam[giveplayerid]){
            SendClientMessage(playerid, COLOR_ERROR, "You cannot put bounties on your team mates!");
            return 1;
        }
        if(playerid == giveplayerid){
            SendClientMessage(playerid, COLOR_ERROR, "You wanna bounty yourself??? come one man we are friends, we can talk about it!");
            return 1;
        }

        bounty[giveplayerid]+=moneys;
        GivePlayerMoney(playerid, 0-moneys);

        GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
        GetPlayerName(playerid, sendername, sizeof(sendername));

        format(string, sizeof(string), "You have put a $%d bounty on the head of %s (id: %d).", moneys, giveplayer,giveplayerid);
        SendClientMessage(playerid, COLOR_YELLOW, string);

        format(string, sizeof(string), "%s has had a $%d bounty put on his head from %s (total: $%d).", giveplayer, moneys, sendername, bounty[giveplayerid]);
        SendClientMessageToAll(COLOR_ORANGE, string);

        format(string, sizeof(string), "You have had a $%d bounty put on you from %s (id: %d).", moneys, sendername, playerid);
        SendClientMessage(giveplayerid, COLOR_RED, string);

        return 1;
    }
//==============================================================================
//Bounties command
//==============================================================================
   
    if(strcmp(cmd, "/bounties", true) == 0)
    {
//      new tmp[256];
        new x;

        SendClientMessage(playerid, COLOR_GREEN, "Current Bounties:");
        for(new i=0; i < MAX_PLAYERS; i++) {
            if(IsPlayerConnected(i) && bounty[i] > 0) {
                GetPlayerName(i, giveplayer, sizeof(giveplayer));
                format(string, sizeof(string), "%s%s(%d): $%d", string,giveplayer,i,bounty[i]);

                x++;
                if(x > 3) {
                    SendClientMessage(playerid, COLOR_YELLOW, string);
                    x = 0;
                    format(string, sizeof(string), "");
                } else {
                    format(string, sizeof(string), "%s, ", string);
                }
            }
        }

        if(x <= 3 && x > 0) {
            string[strlen(string)-2] = '.';
            SendClientMessage(playerid, COLOR_YELLOW, string);
        }

        return 1;
    }
   
//==============================================================================
//Callhelp command for the Cops
//==============================================================================

//      if(strcmp(cmd, "/callhelp", true) == 0)
//          {
//              if(gTeam[playerid] == TEAM_COPS)
//              {
//                  if(GetDistanceBetweenPlayers(playerid1,playerid2) < 20)
//                  {
//                      if(gTeam[playerid1] == TEAM_COPS && gTeam[playerid2] != TEAM_COPS)
//                      {
////                            if(GetPlayerWantedLevel(playerid2) > 2)
    //                          {
      //                          new Float:x, Float:y, Float:z;
        //                      GetPlayerPos(playerid, x, y, z);
//
//                              SetPlayerMapIcon( playerid, 6, x, y, z, 30, 0, MAPICON_GLOBAL );
//
//                              format(string,sizeof(string),"Cop %s(%d) has called for help! he's marked as a blue sirene on the map!",PlayerName(playerid),playerid);
//                              SendClientMessageToAllCops(string);
//                          }
//                          else if(GetPlayerWantedLevel(playerid2) < 3)
//                          {
//                              SendClientMessage(playerid, COLOR_RED, "Can't u deal with a low wanted suspect on your own???");
//                          }
//                      }
//                   }
//////                   else if(GetDistanceBetweenPlayers(playerid1,playerid2) > 20
    //               {
    //                  if(gTeam[playerid1] == TEAM_COPS)
    //                  {
    //                      SendClientMessage(playerid, COLOR_RED, "You are to far away from a suspect to use this command!");
//                      }
//                  }
//              }
//              return 1;
//          }
           
//==============================================================================
//SpikeStrip
//==============================================================================
   
        if (strcmp("/spike", cmdtext, true, 8) == 0)
        {
            if(gTeam[playerid] != TEAM_COPS)
            {
                SendClientMessage(playerid,COLOR_RED,"Only Cops can throw spikes!");
            }
           
            if (IsPlayerInAnyVehicle(playerid))
            {
                SendClientMessage(playerid,COLOR_RED,"Exit your vehicle before using this command please!");
            }
           
            new vehicleid = GetPlayerVehicleID(playerid);
            if(vehicleid == 0)
            {
                new Float:X, Float:Y, Float:Z, Float:A;
                GetPlayerPos(playerid, X, Y, Z);
                GetPlayerFacingAngle(playerid, A);
                CreateSmallStinger(X+(6.0*floatsin(-A, degrees)), Y+(6.0*floatcos(-A, degrees)), Z-0.825, A, GetPlayerVirtualWorld(playerid), 60000);
                SendClientMessage(playerid,COLOR_SEXYGREEN,"You have thrown a SpikeStrip!");
            }
            return 1;
        }
   
//==============================================================================
//Cinfo
//==============================================================================
   
        if(strcmp(cmd, "/cinfo", true) == 0)
        {
            if(cinfo[playerid] == 0)
            {
                SendClientMessage(playerid, COLOR_YELLOW, "U have enabled your cinfo!");
                cinfo[playerid] = 1;
            }
            else if(cinfo[playerid] == 1)
            {
                SendClientMessage(playerid, COLOR_YELLOW, "U have disabled your cinfo!");
                cinfo[playerid] = 0;
            }
            return 1;
        }
       
//==============================================================================
//Seatbelt
//==============================================================================
   
        if(strcmp(cmd, "/seatbelt", true) == 0)
        {
            if(IsPlayerConnected(playerid))
            {
                GetPlayerName(playerid, sendername, sizeof(sendername));
                new length = strlen(cmdtext);
                while ((idx < length) && (cmdtext[idx] <= ' '))
                {
                    idx++;
                }
                new offset = idx;
                new result[64];
                while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
                {
                    result[idx - offset] = cmdtext[idx];
                    idx++;
                }
                result[idx - offset] = EOS;
                if(!strlen(result) && IsPlayerInAnyVehicle(playerid) == 0)
                { //line 124
                    SendClientMessage(playerid, COLOR_GRAD2, "You need to be in a vehicle to use /seatbelt.");
                    return 1;
                }
                if(IsPlayerInAnyVehicle(playerid) == 1 && Seatbelt[playerid] == 0)
                {
                    Seatbelt[playerid] = 1;
                    SendClientMessage(playerid, COLOR_WHITE, "You have put on a seatbelt.");
                }
                else if(IsPlayerInAnyVehicle(playerid) == 1 && Seatbelt[playerid] == 1)
                {
                    Seatbelt[playerid] = 0;
                    SendClientMessage(playerid, COLOR_WHITE, "You have taken off your seatbelt");
                    format(string, sizeof(string), "* %s extends his arm unbuckling his seatbelt.", sendername);
                }
                ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                printf("%s", string);
            }
            return 1;
        }
//==============================================================================
//Hometracker
//==============================================================================

        if (strcmp("/home", cmdtext, true, 10) == 0)
        {
            if(HomeE[playerid] == 0)
            {
                HomeE[playerid] =1;

                SetPlayerMapIcon( playerid, 8, 669.7355,-1275.9504,13.4609, 55, 0, MAPICON_GLOBAL );//drivers
                SetPlayerMapIcon( playerid, 9, 722.52911376953, -12763287353516, 17612741470337, 30, 0, MAPICON_GLOBAL );//cops
                SetPlayerMapIcon( playerid, 10, 722.52911376953, -12763287353516, 17612741470337, 18, 0, MAPICON_GLOBAL );//bandits
               
                SendClientMessage(playerid, COLOR_YELLOW, "Type /dhome to disable");
            }
            else if(HomeE[playerid] == 1)
            {
                SendClientMessage(playerid, COLOR_RED, "You have already enabled home!");
            }
            return 1;
        }

        if (strcmp("/dhome", cmdtext, true, 10) == 0)
        {
            if(HomeE[playerid] == 1)
            {
                RemovePlayerMapIcon( playerid, 8 );
                RemovePlayerMapIcon( playerid, 9 );
                RemovePlayerMapIcon( playerid, 10 );
               
                SendClientMessage(playerid, COLOR_YELLOW, "You have disabled your home Tracker.");
                HomeE[playerid] =0;
            }
            else
            {
                SendClientMessage(playerid, COLOR_RED, "You don't have /home enabled!");
            }
            return 1;
        }

        //_Level CMD

        if (strcmp("/L1", cmdtext, true, 10) == 0)
        {
            ShowPlayerDialog(playerid,1,DIALOG_STYLE_LIST,"Team:","1. Drivers\r\n2. Cops\r\n3. Bandits","Option 1", "Option 2");
            return 1;
        }

        if (strcmp("/L2", cmdtext, true, 10) == 0)
        {
            ShowPlayerDialog(playerid,1,DIALOG_STYLE_LIST,"MyDialog","1. Line\r\n2. Line\r\n3. Line","Option 1", "Option 2");
            return 1;
        }

        if (strcmp("/L3", cmdtext, true, 10) == 0)
        {
            ShowPlayerDialog(playerid,1,DIALOG_STYLE_LIST,"MyDialog","1. Line\r\n2. Line\r\n3. Line","Option 1", "Option 2");
            return 1;
        }

        //_Team CMD

        if (strcmp("/cops", cmdtext, true, 10) == 0)
        {
            ShowPlayerDialog(playerid,1,DIALOG_STYLE_LIST,"MyDialog","1. Line\r\n2. Line\r\n3. Line","Option 1", "Option 2");
            return 1;
        }

        if (strcmp("/drivers", cmdtext, true, 10) == 0)
        {
            //gTeam[playerid] = 0;
            gTeam[playerid] = TEAM_DRIVERS;
            return 1;
        }

        if (strcmp("/b", cmdtext, true, 10) == 0)
        {
            //gTeam[playerid] = 0;
            gTeam[playerid] = TEAM_BANDIT;
            SetPlayerColor(playerid,COLOR_ORANGE); // orange
            return 1;
        }

        if (strcmp("/c", cmdtext, true, 10) == 0)
        {
            //gTeam[playerid] = 0;
            gTeam[playerid] = TEAM_COPS;
            return 1;
        }

        if (strcmp("/u", cmdtext, true, 10) == 0)
        {
            //gTeam[playerid] = 0;
            gTeam[playerid] = TEAM_UNSPAWNED;
            SetPlayerColor(playerid,COLOR_GREY); // grey
            return 1;
        }
       
        if (strcmp("/td", cmdtext, true, 10) == 0)
        {
            //gTeam[playerid] = 0;
            TDCDShowForAll();
            return 1;
        }

        dcmd(rob,3,cmdtext);
        dcmd(arrest,6,cmdtext);
        dcmd(cuff,4,cmdtext);
        dcmd(uncuff,6,cmdtext);
        dcmd(ticket,6,cmdtext);
        dcmd(payticket,9,cmdtext);
        dcmd(callhelp, 8,cmdtext);
        dcmd(wanted, 6,cmdtext);
       
    return 0;
}
Reply
#2

Do you use another command processor?(zcmd,ycmd,etc.)
Reply
#3

Knackworst if your one cmd is such buggy or understandable to pawno, It will return all cmds to UNKNOWN.
Reply
#4

Yes I do, I use zcmd and dini too
Reply
#5

i suggest you to use zcmd and not strcmp...
zcmd is alot better than strcmp..

and use only 1 cmd proccecer
(choose 1 of those : dcmd , zcmd , strcmp , ycmd )
Reply
#6

Quote:
Originally Posted by knackworst
Посмотреть сообщение
Yes I do, I use zcmd and dini too
You can't use OnPlayerCommandText with zcmd. Convert them all.
Reply
#7

So u guys suggest, ZCMD ? what's wrong with strcmp? I find it the most easy way, lol
Reply
#8

Quote:
Originally Posted by knackworst
Посмотреть сообщение
So u guys suggest, ZCMD ? what's wrong with strcmp? I find it the most easy way, lol
If you learn how to use zcmd, you'll know how easy to use it.
FS to convert strcmp to zcmd:
https://sampforum.blast.hk/showthread.php?tid=271043
Reply
#9

Quote:
Originally Posted by knackworst
Посмотреть сообщение
So u guys suggest, ZCMD ? what's wrong with strcmp? I find it the most easy way, lol
strcmp is unstandable , Harder to make commands like : /skin [skinid]

zcmd is standable , Easier to make command like the example above this (using sscanf)
easier to write:
Код:
CMD:Name(playerid, params[])
and strcmp you will need to write:
Код:
if(!strcmp(const string1[], const string2[], bool:ignorecase, length))
Reply
#10

Quote:
Originally Posted by xkirill
Посмотреть сообщение
strcmp is unstandable , Harder to make commands like : /skin [skinid]

zcmd is standable , Easier to make command like the example above this (using sscanf)
easier to write:
Код:
CMD:Name(playerid, params[])
and strcmp you will need to write:
Код:
if(!strcmp(const string1[], const string2[], bool:ignorecase, length))
Even easier:

pawn Код:
CMD:Name(playerid, o[])
Reply


Forum Jump:


Users browsing this thread: 5 Guest(s)