16.08.2014, 13:32
Code:
I have no idea what is wrong. The idea was to remove the textdraws when player isn't in range of business pickups.
But the textdraws just flashes and all, and are not solid. Help is appreciated!
pawn Код:
public OnPlayerPickUpDynamicPickup(playerid, pickupid)
{
new bizstr[128], biztype[64], bizowned[64], bizprice[64];
for(new b = 1;b < sizeof(BusinessInfo);b++)// Loopd through all the businesses again.
{
if(pickupid == BusinessInfo[b][bOutsideIcon])//Checks if it's a biz pickup.
{
if(BusinessInfo[b][bOwned] == 0)//Checks if it is owned.
{
for(new eleven = 0; eleven < 11; eleven++)
{
format(bizstr, sizeof(bizstr), "Business name: ~g~None");
format(biztype, sizeof(biztype), "Type: ~g~%s", BusinessType(b));
format(bizowned, sizeof(bizowned), "Owned by: ~g~The State");
format(bizprice, sizeof(bizprice), "Price: ~r~$%d", BusinessInfo[b][bPrice]);
PlayerTextDrawSetString(playerid, PlayerText:BizTD[5][playerid], bizstr);
PlayerTextDrawSetString(playerid, PlayerText:BizTD[6][playerid], biztype);
PlayerTextDrawSetString(playerid, PlayerText:BizTD[7][playerid], bizowned);
PlayerTextDrawSetString(playerid, PlayerText:BizTD[8][playerid], bizprice);
PlayerTextDrawShow(playerid, BizTD[eleven][playerid]);
SetTimer("CheckInRange", 1000, true);
}
}
if(BusinessInfo[b][bOwned] == 1)//Checks if it owned.
{
for(new eleven = 0; eleven < 11; eleven++)
{
format(bizstr, sizeof(bizstr), "Business name: ~g~%s", BusinessInfo[b][bName]);
format(biztype, sizeof(biztype), "Type: ~g~%s", BusinessType(b));
format(bizowned, sizeof(bizowned), "Owned by: ~g~%s", BusinessInfo[b][bOwner]);
format(bizprice, sizeof(bizprice), "Price: ~r~$%d", BusinessInfo[b][bPrice]);
PlayerTextDrawSetString(playerid, PlayerText:BizTD[5][playerid], bizstr);
PlayerTextDrawSetString(playerid, PlayerText:BizTD[6][playerid], biztype);
PlayerTextDrawSetString(playerid, PlayerText:BizTD[7][playerid], bizowned);
PlayerTextDrawSetString(playerid, PlayerText:BizTD[8][playerid], bizprice);
PlayerTextDrawShow(playerid, BizTD[eleven][playerid]);
SetTimer("CheckInRange", 6000, true);
}
}
}
}
return 1;
}
public CheckInRange(playerid)
{
for(new b = 1;b < sizeof(BusinessInfo);b++)// Loopd through all the businesses again.
{
if(IsPlayerInRangeOfPoint(playerid, 5.0, BusinessInfo[b][bEntranceX], BusinessInfo[b][bEntranceY], BusinessInfo[b][bEntranceZ]))
{
for(new eleven = 0; eleven < 11; eleven++)
{
PlayerTextDrawShow(playerid, BizTD[eleven][playerid]);
}
}
else
{
for(new eleven = 0; eleven < 11; eleven++)
{
PlayerTextDrawHide(playerid, BizTD[eleven][playerid]);
}
}
}
return 1;
}
But the textdraws just flashes and all, and are not solid. Help is appreciated!