command unknow.. please help
#1

Hi im trying to make the /getpizza commad to work, problem is that when i execute the command it returns me "unknown command".

here is the code executed after checking if player is in the point.

pawn Код:
new rand = random(MAX_HOUSES - 1);
    while(!(HouseInfo[rand][hExteriorZ] <= 100 && HouseInfo[rand][hExteriorX] > -2802.389648 && HouseInfo[rand][hExteriorX] < -1523.710327 && HouseInfo[rand][hExteriorY] < 1334.343750 && HouseInfo[rand][hExteriorY] > -216.298019))
    {
        rand++;
        if(rand == 1400)
        {
            rand = 1;
        }
    }

    SetPVarInt(playerid, "tpPizzaTimer", floatround((GetPizzaDistance(rand) / 80), floatround_round));
    SetPVarInt(playerid, "pizzaTotal", floatround((GetPizzaDistance(rand) / 10), floatround_round));
    SetPVarInt(playerid, "pizzaTimer", GetPVarInt(playerid, "pizzaTotal"));
    SetTimerEx("OtherTimerEx", 1000, false, "ii", playerid, TYPE_TPPIZZARUNTIMER);
    SetTimerEx("OtherTimerEx", 1000, false, "ii", playerid, TYPE_PIZZATIMER);

    format(szMessage, sizeof(szMessage), "You have picked up a pizza for %s. You have %d seconds to deliver it!", HouseInfo[rand][hOwner], GetPVarInt(playerid, "pizzaTotal"));
    SendClientMessageEx(playerid, COLOR_WHITE, szMessage);
    SetPVarInt(playerid, "Pizza", rand);
    PizzaBar[playerid] = CreateProgressBar(258.00, 137.00, 131.50, 3.19, COLOR_GREEN, 100.0);
    SetProgressBarValue(PizzaBar[playerid], 100.0);
    ShowProgressBarForPlayer(playerid, PizzaBar[playerid]);
    SetPlayerCheckpoint(playerid, HouseInfo[rand][hExteriorX], HouseInfo[rand][hExteriorY], HouseInfo[rand][hExteriorZ], 5);
    return 1;
Can you tell what is wrong with the command or why it doesn't execute ?
Reply
#2

Quote:
Originally Posted by ******
Посмотреть сообщение
Firstly: You have a possible infinate loop in that code when all the houses are invalid.

Secondly: Download the crash detect plugin. Issues such as yours are often caused by an OOB stopping code execution, which that plugin will tell you about.
If all houses are invalid, how should i change the code so it will find valid houses? seems like it searches the right houses, and the houses are created in the server for the test. yet what does invalid house mean?

I forgot to tell that I already checked the command with the crashdetect plugin and I didn't really understand the crash output.

pawn Код:
[debug] Run time error 4: "Array index out of bounds"
[debug] Accessing element at index 1000 past array upper bound 999
[debug] AMX backtrace:
[debug] #0 0036ee1c in public cmd_getpizza (0x00000000, 0x02338910) from EXRPR46.amx
[debug] #1 native CallLocalFunction () [00472ad0] from samp-server.exe
[debug] #2 0000b550 in public OnPlayerCommandText (0x00000000, 0x023388e8) from EXRPR46.amx
Reply
#3

Quote:
Originally Posted by ******
Посмотреть сообщение
You have declared an array as "[1000]", then are trying to access slot "[1000]", which does't exist. Check pawn-lang.pdf for ore information on array indexes, and compile with -d3 for more specific debug information.
Thanks, I'll do!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)