SA-MP Forums Archive
Small problem! - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Small problem! (/showthread.php?tid=418520)



Small problem! - MattSlater - 25.02.2013

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


Re: Small problem! - jiwan - 25.02.2013

it allows you to continue command ??

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


Re: Small problem! - MattSlater - 25.02.2013

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.


Re: Small problem! - AlphaPac - 25.02.2013

Код:
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;
}



Re: Small problem! - MattSlater - 25.02.2013

Didn't work ^


Re: Small problem! - AlphaPac - 25.02.2013

Код:
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;
}



Re: Small problem! - MattSlater - 25.02.2013

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)


Re: Small problem! - detter - 25.02.2013

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



Re: Small problem! - MattSlater - 26.02.2013

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


Re: Small problem! - Blast3r - 26.02.2013

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.