14.10.2016, 23:10
hey guys i have a sistem that is not working right ....
i have under ongamemodeinit a timer
SetTimer("OnOwnerLastOnline",60000,1);
and at the end of the script
it's selling the house before my lastlogin timer if i edited my lastlogin in DB from `players` with +2 mins more and i restart the server i w8 5 sec then the house is selling before the timer or if i put the same time on my lastlogin it's selling same like that if(gettimer()-lastloginhouse) >= 300) wont work
i have under ongamemodeinit a timer
SetTimer("OnOwnerLastOnline",60000,1);
and at the end of the script
Код HTML:
forward OnOwnerLastOnline(houseid);
public OnOwnerLastOnline(houseid)
{
if(!cache_num_rows())return 1;
new houseOwner[MAX_PLAYER_NAME],LastLogin;
for(new i,j=cache_num_rows();i<j;i++)
{
cache_get_field_content(i,"Owner",houseOwner,handle,MAX_PLAYER_NAME);
LastLogin = cache_get_field_content_int(i,"LastLogin",handle);
if((gettime()-LastLogin) >= 300)
{
//The owner of this house was online more then 10 days ago
mysql_format(handle,gQuery,sizeof(gQuery),"UPDATE `houses` SET `Owner`='The State',`Lock`='1',`Furniture`='0',`Safe`='0',`Rent`='1',`Rentable`='0',`Owned`='0' WHERE `Owner`='%e'",houseOwner);
mysql_tquery(handle,gQuery,"","");
mysql_format(handle,gQuery,sizeof(gQuery),"UPDATE `players` SET `HouseKey`='0',`SpawnChange`='1' WHERE `ID`=%d", PlayerInfo[i][pSQLID]);
mysql_tquery(handle,gQuery,"","");
new house = PlayerInfo[i][pHouseKey];
PlayerInfo[i][pHouseKey] = 0;
Update(i,pHouseKeyx);
HouseInfo[house][hLock] = 1;
hUpdate(house, hLockx);
HouseInfo[house][hOwned] = 0;
hUpdate(house, hOwnedx);
HouseInfo[house][hSellPrice] = 0;
hUpdate(house, hSellPricex);
strmid(HouseInfo[house][hOwner], "The State", 0, MAX_PLAYER_NAME, MAX_PLAYER_NAME);
hUpdate(house, hOwnerx);
RadioH[house] = 0;
if(HouseEntered[i] == house)
{
SetPlayerInterior(i,0);
SetPlayerVirtualWorld(i,0);
SetPlayerPos(i,HouseInfo[house][hEntranceX],HouseInfo[house][hEntranceY],HouseInfo[house][hEntranceZ]);
HouseEntered[i] = 0;
}
PlayerInfo[i][pSpawnChange] = 1;
Update(i, pSpawnChangex);
new data[e_furniture];
for(new c; c < Streamer_GetUpperBound(STREAMER_TYPE_OBJECT); ++c)
{
if(!IsValidDynamicObject©) continue;
Streamer_GetArrayData(STREAMER_TYPE_OBJECT, c, E_STREAMER_EXTRA_ID, data);
if(data[SQLID] > 0 && data[HouseID] == house) DestroyDynamicObject©;
}
gQuery[0] = (EOS);
mysql_format(handle, gQuery, sizeof(gQuery), "DELETE FROM housefurnitures WHERE HouseID=%d", house);
mysql_tquery(handle, gQuery, "", "");
for(new b = 1; b <= TotalClans; b++)
{
if(ClanInfo[b][clHouseHQ] == house)
{
ClanInfo[b][clHQType] = 0;
cUpdate(b, clHQTypex);
ClanInfo[b][clHouseHQ] = 0;
cUpdate(b, clHouseHQx);
}
}
HouseUpdate(house);
}
}
return 1;
}

