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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: SERVER: UNKNOWN COMMAND (/showthread.php?tid=109764)



SERVER: UNKNOWN COMMAND - Justsmile - 22.11.2009

I am trying to make my own GM, but this command not work. It will only return Sever:unknown command. But if i am not at the House icon, he returns, the message.

pawn Код:
if(strcmp(cmd, "/buyhouse", true) == 0)
    {
      if(IsPlayerConnected(playerid))
      {
        for(new h = 0; h < sizeof(HouseInfo); h++)
            {
            if(PlayerToPoint( 3.0,playerid, HouseInfo[h][hEntranceX], HouseInfo[h][hEntranceY], HouseInfo[h][hEntranceZ]))
            {
              /*if(PlayerMoney[playerid] < HouseInfo[h][hValue])
              {
                SendClientMessage(playerid, COLOR_GREY, "Du hast nicht genug Geld.");
                return 1;
            }*/

            if(PlayerMoney[playerid] >= HouseInfo[h][hValue])
            {
                GetPlayerName(playerid, sendername, sizeof(sendername));
                strmid(HouseInfo[h][hOwner], sendername, 0, strlen(sendername), 255);
                HouseInfo[h][hLock] = 1;
                HouseInfo[h][hOwned] = 1;
                HouseInfo[h][hBank] = 0;
                PlayerMoney[playerid] = PlayerMoney[playerid] -= HouseInfo[playerid][hValue];
                SendClientMessage(playerid, COLOR_LIGHTBLUE, "* Du hast ein Haus gekauft.");
                OnHouseUpdate();
                }
            }
            else
            {
                    SendClientMessage(playerid, COLOR_GREY,"Du bist nicht in der nдhe eines Hauses.");
                    return 1;
                }
            }
        }//not connected
        return 1;
    }



Re: SERVER: UNKNOWN COMMAND - niCe - 22.11.2009

I guess it's caused by array overflow. Make sure you don't use higher indexes in array, than you have defined for that array. Actually, when I had a look at that code, why u use HouseInfo[playerid][hValue] playerid as an index? Shouldn't it be HouseInfo[h][hValue]?