29.10.2010, 20:39
Hey, for some reason when I do this command it's coming up with the 'SERVER: Unknown command' message, although I've defined the error message to something else. So I'm guessing I'm putting the returns in the wrong place. I've tried just returning it at the end, but that doesn't work either, just the same message. Here is the command, I'm pretty damn tired at the moment and can't see anything wrong, So can anybody see anything wrong with it here?
pawn Код:
dcmd_Lock(playerid, params[])
{
#pragma unused params
new file[16];
new i = GetHouseID(playerid);
new j = GetBusinessID(playerid);
if(i != -255)
{
if(PR[playerid][HouseID] != i) return SendClientMessage(playerid, COLOUR_RED, "* You don't own this house");
format(file, sizeof(file), "Houses/%d.cfg",i);
if(HR[i][Lock] == 1)
{
HR[i][Lock] = 0;
dini_IntSet(file,"Locked",0);
GameTextForPlayer(playerid,"~w~Door ~g~unlocked",3000,1);
}
else
{
HR[i][Lock] = 1;
dini_IntSet(file,"Locked",1);
GameTextForPlayer(playerid,"~w~Door ~r~locked",3000,1);
}
return 1;
}
if(j != -255)
{
if(PR[playerid][BusinessID] != j) return SendClientMessage(playerid, COLOUR_RED, "* You don't own this business");
format(file, sizeof(file), "Business/%d.cfg",j);
if(BR[j][Lock] == 1)
{
BR[j][Lock] = 0;
dini_IntSet(file,"Locked",0);
GameTextForPlayer(playerid,"~w~Door ~g~unlocked",3000,1);
}
else
{
BR[j][Lock] = 1;
dini_IntSet(file,"Locked",1);
GameTextForPlayer(playerid,"~w~Door ~r~locked",3000,1);
}
return 1;
}
if(j == -255 && i == -255)
{
SendClientMessage(playerid,COLOUR_RED,"* You are not at the door of a house or business");
}
return 1;
}