07.10.2010, 22:56
Well we all know strcmp has that bug of returning false if it returns a valid value.
I can't seem to find a way to change the pickup model depending on the name.
Here is my code:
I've tried tons of things, switching the values ( == 1/ == 0). But none of it just works.
The problem is that no matter what the House owner's name is, it will be green; meaning the house can be bought.
If I switch the values the other way where == 1 is in the second else if, the same thing happens. But the model is blue this time. No matter the name.
If this doesn't work, I'll just use a var to see if its owned or not.
I can't seem to find a way to change the pickup model depending on the name.
Here is my code:
pawn Code:
function AddHouses(HouseID)
{
DestroyHouses(HouseID)
HouseInfo[HouseID][LabelID] = Create3DTextLabel(str, CYAN, HouseInfo[HouseID][EntX], HouseInfo[HouseID][EntY], HouseInfo[HouseID][EntY], 30.0, -1, 1);
if(strcmp(HouseInfo[HouseID][Owner], "For Sale", true) == 1)
{
HouseInfo[HouseID][PickupID] = CreatePickup(1273, 23, HouseInfo[HouseID][EntX], HouseInfo[HouseID][EntY], HouseInfo[HouseID][EntZ], -1); //Green
}
else if(strcmp(HouseInfo[HouseID][Owner], "For Sale", true) == 0)
{
HouseInfo[HouseID][PickupID] = CreatePickup(1272, 23, HouseInfo[HouseID][EntX], HouseInfo[HouseID][EntY], HouseInfo[HouseID][EntZ], -1); //Blue
}
return 1;
}
The problem is that no matter what the House owner's name is, it will be green; meaning the house can be bought.
If I switch the values the other way where == 1 is in the second else if, the same thing happens. But the model is blue this time. No matter the name.
If this doesn't work, I'll just use a var to see if its owned or not.