SA-MP Forums Archive
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: Unknown Command (/showthread.php?tid=150345)



Unknown Command - acade - 25.05.2010

Hello,

I got this command but when it's typed in the server the unknown command comes up.

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    new cmd[256];
    new tmp[500];
    new idx;
    new string[500];
//  new sendername[MAX_PLAYER_NAME];
    cmd = strtok(cmdtext, idx);
    if(strcmp(cmd, "/createhouse", true) == 0)
    {
        if (AccountData[playerid][Admin] >= 4)
        {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_SYSTEM, "[CMDINFO] - /createhouse [id] [price]");
                return 1;
            }
            new id = strval(tmp);
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_SYSTEM, "[CMDINFO] - /createhouse [id] [price]");
                return 1;
            }
            new price = strval(tmp);
            new Float:x,Float:y,Float:z;
            GetPlayerPos(playerid, x, y, z);
            HouseInfo[id][hEnterX] = x;
            HouseInfo[id][hEnterY] = y;
            HouseInfo[id][hEnterZ] = z;
            HouseInfo[id][EnterWorld] = GetPlayerVirtualWorld(playerid);
            HouseInfo[id][EnterInterior] = GetPlayerInterior(playerid);
            HouseInfo[id][hPrice] = price;
            HouseInfo[id][hOwned] = 0;
            HouseInfo[id][hRentable] = 0;
            SaveHouses();
            format(string, sizeof(string), "[House for sale]\nPrice: %d", HouseInfo[id][hPrice]);
            Move3DTextLabel(housetext[id], string, COLOR_SPRINGGREEN, x, y, z);
            SendClientMessage(playerid, COLOR_SPRINGGREEN, "House Created at Location");
            return 1;
        }
        else SendClientMessage(playerid,RED,"Your Admin Level is wrong!");
    }
    return 1;
}



Re: Unknown Command - Grim_ - 25.05.2010

OnPlayerCommandText should return 0, not 1.