30.11.2012, 19:37
okay it's working perfect now
checking if on house porch
When leave CP
EnterDynamicCP
checking if on house porch
Код:
public isOnHouse(playerid) { for(new i = 0; i < sizeof(HouseInfo); i++) { if (gPlayerLogged[playerid] != 0 && nearHouse[playerid] != i && standingOnHouse[playerid] != 1 && PlayerToPoint(1.6, playerid,HouseInfo[i][hEntrancex], HouseInfo[i][hEntrancey], HouseInfo[i][hEntrancez]) || (PlayerToPoint(3, playerid,HouseInfo[i][hExitx], HouseInfo[i][hExity], HouseInfo[i][hExitz]) && HouseInfo[i][hWorld] == GetPlayerVirtualWorld(playerid))) { nearHouse[playerid] = i; standingOnHouse[playerid] = 1; HouseEnter[i] = CreateDynamicCP(HouseInfo[i][hEntrancex],HouseInfo[i][hEntrancey],HouseInfo[i][hEntrancez], 1.5, -1, -1, -1, 100.0); } } return 1; }
Код:
public OnPlayerLeaveDynamicCP(playerid, checkpointid) { for(new i = 0; i < sizeof(HouseInfo); i++) { nearHouse[playerid] = 255; standingOnHouse[playerid] = 0; DestroyDynamicCP(HouseEnter[i]); } }
Код:
for(new i = 0; i < MAX_HOUSES;i++) { if(checkpointid == HouseEnter[i]) { new pName[24]; GetPlayerName(playerid,pName,24); if(HouseInfo[i][hOwned] == 1 && PlayerInfo[playerid][pHouseKey] != i) { format(string, sizeof(string), "You're standing on %s's porch.",HouseInfo[i][hOwner]); SCM(playerid, COLOR_LIGHTGREEN, string); SCM(playerid, COLOR_WHITE, "Available commands: /enter, /ds(hout)"); } if(HouseInfo[i][hOwned] == 1 && PlayerInfo[playerid][pHouseKey] == i) { SCM(playerid, COLOR_LIGHTGREEN, "You're standing on your porch."); SCM(playerid, COLOR_WHITE, "Available commands: /enter, /open, /setrent, /setrentable, /sellhouse"); } if(HouseInfo[i][hOwned] == 0) { format(string, sizeof(string), "You're standing on free house to buy.",HouseInfo[i][hOwner]); SCM(playerid, COLOR_LIGHTGREEN, string); SCM(playerid, COLOR_WHITE, "Available commands: /buyhouse"); } } //Don't need it now |if(checkpointid == HouseExit[i]){}| }