help with SpawnPlayerAtHouse & RentFeeUp
#1

hi all
I have 2 problems again and 'fight' with them 2 days!
First problem is: I have SpawnPlayerAtHouse and it just spawn me in house id 0 if im owner of it
pawn Код:
stock SpawnPlayerAtHouse(playerid)
{
    for(new i = 0; i < MAX_HOUSES; i++)
    {
        if(!strcmp(HouseInfo[i][hOwner], GetName(playerid), false) || !strcmp(HouseInfo[i][hRentUser], GetName(playerid), false))
        {
            SetPlayerPos(playerid, HouseInfo[i][hExitX], HouseInfo[i][hExitY], HouseInfo[i][hExitZ]);
            SetPlayerInterior(playerid, HouseInfo[i][hInterior]);
            SetPlayerVirtualWorld(playerid, HouseInfo[i][hVirtualWorld]);
            PlayerEnteredHisHouse[playerid] = true;
            return i;
        }
    }
    return 1;
}
Second problem: I made script that every one hour (In this case is one minute, just for testing) if player rent house than it takes his money and send into pocket money of house but when I pass 1 min it sends me 148 message: Rent Fee: 0 and it just take money of house that I rent
pawn Код:
SetTimer("RentFeeUp", 60000, 0);
public RentFeeUp()
{
    for(new p = 0; p < MAX_PLAYERS; p++)
    {
        if(!IsPlayerConnected(p)) continue;
        for(new i = 0; i < MAX_HOUSES; i++)
        {
            if(!strcmp(HouseInfo[i][hRentUser], GetName(p), false))
            {
                printf("Rent user of House ID %d is %s", i, HouseInfo[i][hRentUser]);
                GivePlayerMoney(p, -HouseInfo[i][hRentPrice]);
                HouseInfo[i][hMoney] += HouseInfo[i][hRentPrice];
                format(hstring, sizeof(hstring), "Rent fee: %d", HouseInfo[i][hRentPrice]);
                SendClientMessage(p, COLOR_LIME, hstring);
            }
        }
    }
    return 1;
}
Reply
#2

pawn Код:
stock SpawnPlayerAtHouse(playerid)
{
    for(new i = 0; i < MAX_HOUSES; i++)
    {
        if(strcmp(HouseInfo[playerid][hOwner], GetName(playerid), true) || strcmp(HouseInfo[playerid][hRentUser], GetName(playerid), true))
        {
            SetPlayerPos(playerid, HouseInfo[i][hExitX], HouseInfo[i][hExitY], HouseInfo[i][hExitZ]);
            SetPlayerInterior(playerid, HouseInfo[i][hInterior]);
            SetPlayerVirtualWorld(playerid, HouseInfo[i][hVirtualWorld]);
            PlayerEnteredHisHouse[playerid] = true;
            return i;
        }
    }
    return 1;
}
try this
Reply
#3

Quote:
Originally Posted by Speed
Посмотреть сообщение
pawn Код:
stock SpawnPlayerAtHouse(playerid)
{
    for(new i = 0; i < MAX_HOUSES; i++)
    {
        if(strcmp(HouseInfo[playerid][hOwner], GetName(playerid), true) || strcmp(HouseInfo[playerid][hRentUser], GetName(playerid), true))
        {
            SetPlayerPos(playerid, HouseInfo[i][hExitX], HouseInfo[i][hExitY], HouseInfo[i][hExitZ]);
            SetPlayerInterior(playerid, HouseInfo[i][hInterior]);
            SetPlayerVirtualWorld(playerid, HouseInfo[i][hVirtualWorld]);
            PlayerEnteredHisHouse[playerid] = true;
            return i;
        }
    }
    return 1;
}
try this
nope, I know that would not work because you need !strcmp() or strcmp() == 0, I tried that already

YEY, FIXED!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)