Business textdraw not updating. - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Business textdraw not updating. (
/showthread.php?tid=447691)
Business textdraw not updating. -
Mariooo - 01.07.2013
Hello, when i buy a business, it will not be updated. But mixed with Non-owned and owned textdraw. The textdraw isn't readable anymore.
This is my OnPlayerPickupDynamicPickup
Код:
public OnPlayerPickUpDynamicPickup(playerid, pickupid)
{
new string[256];
//for(new b = 1;b <MAX_BUSINESSES; b++)// Loopd through all the businesses again.
for(new i = 1; i <MAX_BUSINESSES; i++)
{
if(pickupid == BusinessInfo[i][bOutsideIcon])//Checks if it's a biz pickup.
{
if(BusinessInfo[i][bOwned] == 0)//Checks if it is owned.
{
format(string, sizeof(string), "{0000FF}[For Sale]{F0CC00}\nPrice: $%d\nType: %s", BusinessInfo[i][bPrice], BusinessType(i), i);//Formats a string with all the info.
business1[i] = Create3DTextLabel(string, COLOR_GREEN, BusinessInfo[i][bEntranceX], BusinessInfo[i][bEntranceY], BusinessInfo[i][bEntranceZ],15.0,0,0);
}
if(BusinessInfo[i][bOwned] == 1)//Checks if it owned.
{
format(string, sizeof(string), "{0000FF}[Business]{F0CC00}\nName: %s\nOwner: %s\nType: %s", BusinessInfo[i][bName], BusinessInfo[i][bOwner], BusinessType(i), i);//Formats a string with all the info.
business2[i] = Create3DTextLabel(string, COLOR_GREEN, BusinessInfo[i][bEntranceX], BusinessInfo[i][bEntranceY], BusinessInfo[i][bEntranceZ],15.0,0,0);
}
}
}
return 1;
}
And this is my buybiz command.
Код:
CMD:buybiz(playerid, params[])
{
new id = IsPlayerNearBizEnt(playerid);
for(new b = 0; b < sizeof(BusinessInfo); b++)
{
if(id == -1 || id == 0) return SendClientMessage(playerid, COLOR_GREY, "You are not near a biz");
if(BusinessInfo[id][bOwned] != 0) return SendClientMessage(playerid, COLOR_GREY, "This biz is not for sale.");
if(PlayerInfo[playerid][BizID] > MAX_BUSINESSES) return SendClientMessage(playerid, COLOR_LIGHTRED, "You already own 2 businesses.");
if(PlayerInfo[playerid][pCash] < BusinessInfo[id][bPrice]) return SendClientMessage(playerid, COLOR_LIGHTRED, "Sorry, you can not afford this biz.");
PlayerInfo[playerid][BizID] = id;
PlayerInfo[playerid][pCash] -= BusinessInfo[id][bPrice];
GivePlayerMoney(playerid, -BusinessInfo[id][bPrice]);
BusinessInfo[id][bLocked] = 0;
BusinessInfo[id][bOwned] = 1;
BusinessInfo[id][bOwner] = playerid;
new text[128];
format(text, sizeof(text), "{0000FF}[Business]{F0CC00}\nName: %s\nOwner: %s\nType: %s", BusinessInfo[b][bName], BusinessInfo[b][bOwner], BusinessType(b), b);
UpdateDynamic3DTextLabelText(business1[b], COLOR_GREEN, text);
SendClientMessage(playerid, COLOR_YELLOW, "Congratulations on your new biz! Use /bizsetname to change your business name.");
}
return 1;
}
I hope you guys can help me.
Greetings,
Mario