ZCMD command error -
iBots - 16.04.2015
I have made this for deleting house...it includes furniture,but the problem is that when i put for example /deletehouse [houseid], if it's an invalid house id it says wrong house id,but if i put a right house id that is used it shows error message by ZCMD,why?here is the code:
pawn Код:
CMD:resethouse(houseid, params[])
{
new house;
if(!sscanf(params, "d", house))
{
if(hInfo[house][hcreated] != 1) return SendClientMessage(houseid, -1, "Invalid house id");
else
{
hInfo[house][hcreated] = 0; //it only changes these two things
hInfo[house][houseowned] = 0; //it only changes these two things
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(pInfo[i][playerhouse] == house)
{
pInfo[i][playerhouse] = 0;
}
}
hInfo[house][housepot] = 0;
hInfo[house][housegun] = 0;
hInfo[house][housecash] = 0;
hInfo[house][houselock] = 0;
format(string, sizeof(string), "You have deleted house id %d.", house);
SendClientMessage(houseid, COLOR_GREY, string);
new query[128];
mysql_format(dbHandle, query, sizeof(query), "DELETE * FROM `houselist` WHERE `hID`=%d", house);
printf("%d deleted", house);
mysql_tquery(dbHandle, query, "", "");
}
}
else
{
SendClientMessage(houseid, COLOR_GREY, "/resethouse [houseid]");
}
return 1;
}
Re: ZCMD command error -
Azula - 16.04.2015
PHP код:
CMD:resethouse(houseid, params[])
{
new house;
if(sscanf(params, "i", house)) return SendClientMessage(houseid, COLOR_GREY, "/resethouse [houseid]")
if(hInfo[house][hcreated] != 1) return SendClientMessage(houseid, -1, "Invalid house id");
else
{
hInfo[house][hcreated] = 0; //it only changes these two things
hInfo[house][houseowned] = 0; //it only changes these two things
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(pInfo[i][playerhouse] == house)
{
pInfo[i][playerhouse] = 0;
}
}
hInfo[house][housepot] = 0;
hInfo[house][housegun] = 0;
hInfo[house][housecash] = 0;
hInfo[house][houselock] = 0;
format(string, sizeof(string), "You have deleted house id %d.", house);
SendClientMessage(houseid, COLOR_GREY, string);
new query[128];
mysql_format(dbHandle, query, sizeof(query), "DELETE * FROM `houselist` WHERE `hID`=%d", house);
printf("%d deleted", house);
mysql_tquery(dbHandle, query, "", "");
}
return 1;
}
Re: ZCMD command error -
iBots - 16.04.2015
still doesnt work
Re: ZCMD command error -
ATGOggy - 16.04.2015
Show the hInfo enum
Re: ZCMD command error -
iBots - 16.04.2015
pawn Код:
enum housesinfo
{
hcreated,
houseowned,
housepot,
housegun,
housecash,
houselock,
Float:houseX,
Float:houseY,
Float:houseZ
}
new hInfo[MAX_HOUSEAMOUNTS][housesinfo];
Re: ZCMD command error -
ATGOggy - 16.04.2015
Use crashdetect.dll and see if you gets something on server_log. Because, if there's any runtime error that is causing the callback to end, it will be printed on log.
Re: ZCMD command error -
iBots - 16.04.2015
here is what crashdetect gives,when i put a valid id:
Код:
[07:13:29] [debug] Run time error 4: "Array index out of bounds"
[07:13:29] [debug] Accessing element at index 100 past array upper bound 99
[07:13:29] [debug] AMX backtrace:
[07:13:29] [debug] #0 00009000 in public cmd_resethouse () from rp.amx
[07:13:29] [debug] #1 native CallLocalFunction () [00472ad0] from samp-server.exe
[07:13:29] [debug] #2 00000608 in public OnPlayerCommandText () from rp.amx
Re: ZCMD command error -
ATGOggy - 16.04.2015
What is your MAX_HOUSEAMOUNTS and with what valid id did you test the code?
Re: ZCMD command error -
iBots - 16.04.2015
i created house,it was id 1,and when i do /resethouse 1,it sends me error message from the zcmd thingy,and if i do /resethouse 1 again it shows invalid house id
and MAX_HOUSEAMOUNTS is 200
Re: ZCMD command error -
ATGOggy - 16.04.2015
Put // before each line after 'else', test the code and see when the this thing is not printed on the log.