06.11.2011, 09:11
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
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
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;
}
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;
}