16.02.2019, 09:50
Quote:
When `Owner` is empty, `strcmp` function will return 0. A simple solution would be:
pawn Код:
1) Global variable as a house counter. If MAX_HOUSES is 1000 but only 10 houses were loaded, it will loop 10 times instead of 1000. 2) Assign owner unique ID and compare integers instead of strings. 3) On success login: find the house index and assign it to `APlayerData[playerid][CurrentHouse]`. No more unnecessary loops. 4) Change the spawn location using `SetSpawnInfo` function. If the player owns a house, set the x, y and z of a house otherwise from the random trucker location. In `OnPlayerSpawn` check the value of `CurrentHouse`, if it is a house then set the interior to the correct one. |
pawn Код:
if (!isnull(AHouseData[HouseID][Owner]) && strcmp(AHouseData[HouseID][Owner], Name, false) == 0)