Small problem!
#1

pawn Код:
stock IsHouseOwner(playerid, h)
{
    new szName[32];
    GetPlayerName(playerid, szName, 32);
    if(!strcmp(HouseInfo[h][h_Owner], szName))
    {
        return 1;
    }
    else SendClientMessage(playerid, COLOR_GREY, "{D10D0D}[ERROR]: {FFFFFF}You are not the owner of this house.");
    return 0;
}
Basically, I use this function in my house commands. (eg. if(IsHouseOwner(playerid, h)) { // continues code })
But, if I am not the house owner it sends me the client message but it also allows me to continue the command

Thanks in advance. ;3
Reply
#2

it allows you to continue command ??

explain more please, i am unable to understand your problem.
Reply
#3

As in, when I use the command that I use the 'if(IsHouseOwner(playerid, h))', it allowed me to continue what the command is supposed to do, which it shouldn't, since I am not the owner of the house I do it on.
Reply
#4

Код:
stock IsHouseOwner(playerid, h)
{
    new szName[32];
    GetPlayerName(playerid, szName, 32);
    if(strcmp(HouseInfo[h][h_Owner], szName))
    {
        return 1;
    }
    else SendClientMessage(playerid, COLOR_GREY, "{D10D0D}[ERROR]: {FFFFFF}You are not the owner of this house.");
    return 0;
}
Reply
#5

Didn't work ^
Reply
#6

Код:
stock IsHouseOwner(playerid, h)
{
    new szName[32];
    GetPlayerName(playerid, szName, 32);
    if(!strcmp(HouseInfo[h][h_Owner], szName))
		return SendClientMessage(playerid, COLOR_GREY, "{D10D0D}[ERROR]: {FFFFFF}You are not the owner of this house.");
    return 1;
}
Reply
#7

Quote:
Originally Posted by AlphaPac
Посмотреть сообщение
Код:
stock IsHouseOwner(playerid, h)
{
    new szName[32];
    GetPlayerName(playerid, szName, 32);
    if(!strcmp(HouseInfo[h][h_Owner], szName))
		return SendClientMessage(playerid, COLOR_GREY, "{D10D0D}[ERROR]: {FFFFFF}You are not the owner of this house.");
    return 1;
}
Didn't work either.

(Thanks for helping btw)
Reply
#8

try with this

Код:
stock IsHouseOwner(playerid, h)
{
    new szName[32];
    GetPlayerName(playerid, szName, 32);
    if(strcmp(HouseInfo[h][h_Owner], szName) == 0) return 1;
    return 0;
}
Use this func like this
Код:
if(!IsHouseOwner(ID ,HOUSE)) return SendClientMessage(playerid, COLOR_GREY, "{D10D0D}[ERROR]: {FFFFFF}You are not the owner of this house.");

// rest of your code
Reply
#9

Didn't work, it says I am not the owner of houses I don't own, but it also says I am not the owner of houses I do own
Reply
#10

pawn Код:
stock IsHouseOwner(playerid, h)
{
    new szName[32];
    GetPlayerName(playerid, szName, 32);
    if(!strcmp(HouseInfo[h][h_Owner], szName))
    {
        return 1;
    }
    else if(strcmp(HouseInfo[h][h_Owner], szName)) return SendClientMessage(playerid, COLOR_GREY, "{D10D0D}[ERROR]: {FFFFFF}You are not the owner of this house.");

}
Maybe that? I also removed return 0; you can put it back maybe...

EDIT: You used detter's suggestion on your command or stock? If you did it on stock, I'd suggest you use it on commands.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)