Command returns server unknown command.
#1

I have a sellhouse command but it just returns SERVER: Unknown command and crashdetect outputs something. This is the sellhouse command:
pawn Код:
CMD:sellhouse(playerid, params[])
{
    new bool:HouseHasCars= false, CarSlot, HouseID;
    HouseID = APlayerData[playerid][CurrentHouse];
    for(new i; i < MAX_HOUSES; i++)
    {
        if(IsPlayerInRangeOfPoint(playerid, 2.50, AHouseData[i][HouseX], AHouseData[i][HouseY], AHouseData[i][HouseZ]))
        {
            new pName[MAX_PLAYER_NAME], string2[128], string3[128], string4[128];
            GetPlayerName(playerid, pName, sizeof(pName));
            if(strmatch(AHouseData[i][Owner], pName))
            {
                for (CarSlot = 0; CarSlot < 20; CarSlot++)
                    if (AHouseData[HouseID][VehicleIDs][CarSlot] != 0)
                        HouseHasCars = true;

                if(HouseHasCars == false)
                {
                    GivePlayerCash(playerid, floatround(AHouseData[i][price] * 0.75));
                    format(string2, sizeof(string2), "UPDATE Houses SET Houseowner = '' WHERE HouseID = '%d'", i);
                    mysql_function_query( Handle, string2, false, "", "" );
                    SendClientMessage(playerid, 0xFF0000, "Your house has been sold");
                    format(string3, sizeof(string3), "UPDATE Users SET Houses = '%d' WHERE Name = '%s'", APlayerData[playerid][Houses]--, APlayerData[playerid][Name]);
                    mysql_function_query( Handle, string3, false, "", "" );
                    DestroyDynamicPickup(HousePickup[i]);
                    HousePickup[i] = CreateDynamicPickup(1273, 1, AHouseData[i][HouseX], AHouseData[i][HouseY], AHouseData[i][HouseZ], -1);
                    format(string4, sizeof(string4), "{FFFFFF}This house is for sale!\nPrice: %i Level: %i\n Type /buyhouse to buy\nHouse ID: %i", AHouseData[i][price], AHouseData[i][Houselevel], i);
                    UpdateDynamic3DTextLabelText(AHouseData[i][HouseLabel], COLOR_GREY, string4);
                    strdel(AHouseData[i][Owner], 0, 24); //Owner = "" Anyway why the pickup wont get deleted? :| old pickupwill stay
                    SavePlayer(playerid);
                }
                else
                    SendClientMessage(playerid, 0xFF0000AA, "You can not sell a house with cars assigned to it.");
            }
            else
                SendClientMessage(playerid, COLOR_GREY, "This house is not owned by you!");
        }
    }
    return 1;
}
The error that the crashdetect gives out:

Код:
[11:47:04] [debug] Run time error 4: "Array index out of bounds"
[11:47:04] [debug]  Accessing element at negative index -1
[11:47:04] [debug] AMX backtrace:
[11:47:04] [debug] #0 000341e8 in public cmd_sellhouse () from ET.amx
[11:47:04] [debug] #1 native CallLocalFunction () [004722d0] from samp-server.exe
[11:47:04] [debug] #2 00000748 in public OnPlayerCommandText () from ET.amx
[11:47:04] Thimo used:  /sellhouse
What am i doing wrong?
Reply


Messages In This Thread
Command returns server unknown command. - by thimo - 19.01.2014, 09:34
Re: Command returns server unknown command. - by Avi Raj - 19.01.2014, 09:36
Re: Command returns server unknown command. - by MatriXgaMer - 19.01.2014, 09:41
Re: Command returns server unknown command. - by thimo - 19.01.2014, 09:43
Re: Command returns server unknown command. - by thimo - 19.01.2014, 09:47
Re: Command returns server unknown command. - by Avi Raj - 19.01.2014, 09:47
Re: Command returns server unknown command. - by thimo - 19.01.2014, 14:08
Re: Command returns server unknown command. - by Konstantinos - 19.01.2014, 14:13
Re: Command returns server unknown command. - by thimo - 19.01.2014, 14:25
Re: Command returns server unknown command. - by Konstantinos - 19.01.2014, 14:30

Forum Jump:


Users browsing this thread: 1 Guest(s)