Going Crazy ^^
#6

Quote:
Originally Posted by admantis
Посмотреть сообщение
You first are using too many return 1 codes. Secondly you are not using a 'else' or 'else if' statement (Code #2), and yes, you are blind to not notice.
pawn Код:
if(strcmp(cmd, "/buyhouse", true) == 0)
{
    for(new i; i<MAX_HOUSES; i++)
    {
        if(!IsPlayerInRangeOfPoint(playerid, 3, HouseInfo[i][PickupX], HouseInfo[i][PickupY], HouseInfo[i][PickupZ])) continue;
        {
            new Pname[24]; GetPlayerName(playerid, Pname, 24);
            for(new S; S<MAX_HOUSES; S++)
            {
                if(!strcmp(dini_Get("Owned.ini", HouseInfo[S][HouseNames]), Pname)) return SendClientMessage(playerid, 0xF60000AA, "You already have a house!");
            }
            if(GetPlayerMoney(playerid) < HouseInfo[i][HouseCost]) return SendClientMessage(playerid, 0xF60000AA, "You don't have enough money to buy this house");
            if(HouseInfo[i][Owned] == 1) return SendClientMessage(playerid, 0xF60000AA, "This house is already owned!");
            GivePlayerMoney(playerid, - HouseInfo[i][HouseCost]);
            GameTextForPlayer(playerid, "~r~House Purchased!", 2000, 3);
            HouseInfo[i][Owned] = 1;
            GetPlayerName(playerid, Pname, 24);
            format(HouseInfo[i][HouseOwner], 24, "%s", Pname);
            dini_Set("Owners.ini", HouseInfo[i][HouseNames], Pname);
        }
        else SendClientMessage(playerid, 0xF60000AA, "You are not close enough to a house");
    }
    return 1;
}
pawn Код:
if(strcmp(cmd, "/sellhouse", true) == 0)
{
    for(new i; i<MAX_HOUSES; i++)
    {
        if(IsPlayerInRangeOfPoint(playerid, 3, HouseInfo[i][PickupX], HouseInfo[i][PickupY], HouseInfo[i][PickupZ]))
        {
            new Pname[24]; GetPlayerName(playerid, Pname, 24);
            if(strcmp(Pname, HouseInfo[i][HouseOwner])) return SendClientMessage(playerid, 0xF60000AA, "You don't own this house!");
            GivePlayerMoney(playerid, HouseInfo[i][HouseSell]);
            GameTextForPlayer(playerid, "~r~House Sold!", 2000, 3);
            HouseInfo[i][Owned] = 0;
            format(HouseInfo[i][HouseOwner], 24, "0943jt3u9*egjlfd");
            dini_Unset("Owners.ini", HouseInfo[i][HouseNames]);
        }
        else SendClientMessage(playerid, 0xF60000AA, "You are not close enough to a house");
    }
    return 0;
}
Код:
invalid expression, assumed zero
on code

pawn Код:
else SendClientMessage(playerid, COLOR_RED, "You are not close enough to a house");
on the buyhouse command

I am using this tutorial to make a house system
http://forum.sa-mp.com/showthread.ph...highlight=news
Reply


Messages In This Thread
Going Crazy ^^ - by BizzyD - 26.03.2011, 16:04
Re: Going Crazy ^^ - by antonio112 - 26.03.2011, 16:06
Re: Going Crazy ^^ - by admantis - 26.03.2011, 16:08
Re: Going Crazy ^^ - by BizzyD - 26.03.2011, 16:09
Re: Going Crazy ^^ - by admantis - 26.03.2011, 16:12
Re: Going Crazy ^^ - by BizzyD - 26.03.2011, 16:13
Re: Going Crazy ^^ - by admantis - 26.03.2011, 16:19
Re: Going Crazy ^^ - by BizzyD - 26.03.2011, 16:21
Re: Going Crazy ^^ - by admantis - 26.03.2011, 16:24
Re: Going Crazy ^^ - by BizzyD - 26.03.2011, 16:38

Forum Jump:


Users browsing this thread: 1 Guest(s)