22.04.2015, 19:06
When I'm not near house pickup its shows this error from crashdetect and I need help to fix it or give me tutorial to read more about this problems
Код:
[22:01:45] [debug] Run time error 4: "Array index out of bounds" [22:01:45] [debug] Accessing element at negative index -1 [22:01:45] [debug] AMX backtrace: [22:01:45] [debug] #0 000a36e0 in public cmd_buyhouse (playerid=0, params[]=@010b9b8c "") at Drift GM\gamemodes\drift.pwn:10292 [22:01:45] [debug] #1 native CallLocalFunction () from samp-server.exe [22:01:45] [debug] #2 000216e8 in ?? (... <2 arguments>) at Drift GM\pawno\include\zcmd.inc:102 [22:01:45] [debug] #3 00006cf4 in public OnPlayerCommandText (playerid=0, cmdtext[]=@010b9b64 "/buyhouse") at Drift GM\pawno\include\YSI\y_hooks/impl.inc:929
PHP код:
CMD:buyhouse(playerid, params[])
{
new string[128];
new sendername[MAX_PLAYER_NAME];
GetPlayerName(playerid, sendername, 24);
new i = IsPlayerNearHouse(playerid);
if(IsPlayerNearHouse(playerid))
{
if(PlayerInfo[playerid][pHouseKey] != 999) return SendClientMessage(playerid, COLOR_RED, "Вие вече имате къща.");
if(HouseInfo[i][hOwned]) return SendClientMessage(playerid, COLOR_RED, "Тази къща принадлежи на друг играч.");
if(GetPlayerCash(playerid) > HouseInfo[i][hPrice])
{
PlayerInfo[playerid][pHouseKey] = i;
HouseInfo[i][hOwned] = 1;
strmid(HouseInfo[i][hOwner], sendername, 0, strlen(sendername), 255);
GivePlayerCash(playerid, -HouseInfo[i][hPrice]);
SetPlayerPos(playerid, HouseInfo[i][hExitX], HouseInfo[i][hExitY], HouseInfo[i][hExitZ]);
SetPlayerInterior(playerid ,HouseInfo[i][hExitInt]);
HouseInfo[i][hExitVW] = 100+i;
SetPlayerVirtualWorld(playerid, 100+i);
InHouse[playerid] = i;
DestroyDynamic3DTextLabel(HouseInfo[i][hLable]);
format(string, sizeof(string), "Тази къща принадлежи на\n%s\nИнтериор: %s\nИД: %d", HouseInfo[i][hOwner], HouseInfo[i][hType], i);
HouseInfo[i][hLable] = CreateStreamed3DTextLabel(string, COLOR_GREEN, HouseInfo[i][hEnterX], HouseInfo[i][hEnterY], HouseInfo[i][hEnterZ], 10.0, 0);
SaveHouses();
SavePlayer(playerid);
SendClientMessage(playerid, COLOR_GREEN, "Добре дошли в новата ви къща. Можете да излезете като натиснте 'N'.");
}
else
{
SendClientMessage(playerid, COLOR_RED, "Вие нямате достатъчно пари, за да си купите тази къща!");
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_RED, "Ти не си в близост до къща, която се продава!"); // Line 10292
return 1;
}
return 1;
}