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;
}
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);
return 1;
}
else
{
HR[i][Lock] = 1;
dini_IntSet(file,"Locked",1);
GameTextForPlayer(playerid,"~w~Door ~r~locked",3000,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);
return 1;
}
else
{
BR[j][Lock] = 1;
dini_IntSet(file,"Locked",1);
GameTextForPlayer(playerid,"~w~Door ~r~locked",3000,1);
}
}
if(j == -255 && i == -255)
{
SendClientMessage(playerid,COLOUR_RED,"* You are not at the door of a house or business");
}
return 1;
}
Iggy, I've tried my returns in all different ways, But I have worked it out using i514x_'s method; It was my Business checker that was failing me. (:
Thanks guys. |
no problem
and iggy, it works because when something is not working in my gamemode, im always doing that ![]() |
Printing test to the screen wouldn't stop a command from returning unknown command trust me. If its returning unknown command that means the script doesn't know the command exists (or it returns 0) so print just wouldn't get executed (because to the script it isn't there). It would work with stuff that partially gets executed, i just cant understand how it fixed the problem.
|
I think he means doing it likes this:
<Execute command> <Print> <Get required info> <print> <do something> <print> <return> So you can see what prints are executed before the command breaks... Well, that's what I did anyway. (: |