[HELP]Business -
[Aka]Dragonu - 01.09.2011
Hello again. I have a business system and it works just fine, but when I /sellbusiness the server says on main chat for example : Dragonu has sold Santos Bank. The thing is that I named the "Santos Bank" "Los Santos Bank" so in game when i sell my business it only appears Dragonu sold Santos Bank, instead of Dragonu sold Los Santos Bank.
Here is the business code :
pawn Код:
1480.982177,-1770.193603,18.795799,389.832000,173.746200,1008.382812,Los Santos Bank,For Sale,0,0,100000000,35,0,3,1,49400,98
And here is the business sale script
pawn Код:
if(strcmp(cmd, "/sellbusiness", true) == 0 || strcmp(cmd, "/sellbiz", true) == 0)
{
if(PlayerInfo[playerid][pBusinessKey] == INVALID_BUSINESS_ID)
{
SendClientMessage(playerid, COLOR_RED, "You cannot sell your business because you don't have one.");
return 1;
}
else
{
new businessid = PlayerInfo[playerid][pBusinessKey];
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
SendClientMessage(playerid, COLOR_YELLOW, "You have successfully sold your business.");
PlayerInfo[playerid][pBusinessKey] = INVALID_BUSINESS_ID;
new bizzname[32];
strmid(bizzname, BusinessInfo[businessid][bDescription], 3, strlen(BusinessInfo[businessid][bDescription]), 32);
format(string, sizeof(string), "%s has sold business %s.", PlayerName[playerid], bizzname);
SendClientMessageToAll(COLOR_YELLOW, string);
GivePlayerMoney(playerid, BusinessInfo[businessid][bPrice]/2);
SellBusiness(businessid);
OnBusinessUpdate();
}
return 1;
}
Re: [HELP]Business -
Pinguinn - 01.09.2011
The size of 'bizzname' is to small
Increase it to 50 or so
Re: [HELP]Business -
[Aka]Dragonu - 01.09.2011
Where did you see that size?
Re: [HELP]Business -
Pinguinn - 01.09.2011
pawn Код:
new bizzname[50];
strmid(bizzname, BusinessInfo[businessid][bDescription], 3, strlen(BusinessInfo[businessid][bDescription]), 32);
format(string, sizeof(string), "%s has sold business %s.", PlayerName[playerid], bizzname);
SendClientMessageToAll(COLOR_YELLOW, string);
Just replace the lines with the lines above
If that doesn't work, try changing the size of string
Re: [HELP]Business -
[Aka]Dragonu - 01.09.2011
Ok i increased that to "50" but still the same thing, any more help please?
Re: [HELP]Business -
Jafet_Macario - 01.09.2011
pawn Код:
if(strcmp(cmd, "/sellbusiness", true) == 0 || strcmp(cmd, "/sellbiz", true) == 0)
{
if(PlayerInfo[playerid][pBusinessKey] == INVALID_BUSINESS_ID)
{
SendClientMessage(playerid, COLOR_RED, "You cannot sell your business because you don't have one.");
return 1;
}
else
{
new businessid = PlayerInfo[playerid][pBusinessKey];
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
SendClientMessage(playerid, COLOR_YELLOW, "You have successfully sold your business.");
PlayerInfo[playerid][pBusinessKey] = INVALID_BUSINESS_ID;
new bizzname[32];
strmid(bizzname, BusinessInfo[businessid][bDescription], 3, strlen(BusinessInfo[businessid][bDescription]), 32);
format(string, sizeof(string), "%s has sold business %s.", PlayerName[playerid], BusinessInfo[businessid][bDescription]);
SendClientMessageToAll(COLOR_YELLOW, string);
GivePlayerMoney(playerid, BusinessInfo[businessid][bPrice]/2);
SellBusiness(businessid);
OnBusinessUpdate();
}
return 1;
}
Re: [HELP]Business -
[Aka]Dragonu - 01.09.2011
Thank you very much, but I have exactly this problem on /buybusiness, here is the code :
pawn Код:
if(strcmp(cmd, "/buybusiness", true) == 0 || strcmp(cmd, "/buybiz", true) == 0)
{
for(new i = 0; i <MAX_HOUSES; i++)
{
if (PlayerToPoint(3.0, playerid, BusinessInfo[i][bEntrancex], BusinessInfo[i][bEntrancey], BusinessInfo[i][bEntrancez]))
{
if(PlayerInfo[playerid][pLevel] < BusinessInfo[i][bLevel])
{
format(string, sizeof(string), "You must be level %d to buy this business.", BusinessInfo[i][bLevel]);
SendClientMessage(playerid, COLOR_RED, string);
return 1;
}
if(PlayerInfo[playerid][pBusinessKey] != INVALID_BUSINESS_ID)
{
SendClientMessage(playerid, COLOR_RED, "You are already owning a business, sell that first.");
return 1;
}
if(BusinessInfo[i][bOwned] == 1)
{
SendClientMessage(playerid, COLOR_RED, "This business you are trying to buy is already owned.");
return 1;
}
if(GetPlayerMoney(playerid) < BusinessInfo[i][bPrice])
{
format(string, sizeof(string), "You need %d$ dollars in cash to buy this business.", BusinessInfo[i][bPrice]);
SendClientMessage(playerid, COLOR_RED, string);
return 1;
}
else
{
SetPlayerPos(playerid, BusinessInfo[i][bExitx], BusinessInfo[i][bExity], BusinessInfo[i][bExitz]);
SetPlayerInterior(playerid, BusinessInfo[i][bInt]);
SetPlayerVirtualWorld(playerid, BusinessInfo[i][bWorld]);
GivePlayerMoney(playerid, -BusinessInfo[i][bPrice]);
BusinessInfo[i][bOwned] = 1;
strmid(BusinessInfo[i][bOwner], PlayerName[playerid], false, strlen(PlayerName[playerid]), 25);
PlayerInfo[playerid][pBusinessKey] = i;
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
format(string, sizeof(string), "You have successfully bought this business for %d$.", BusinessInfo[i][bPrice]);
SendClientMessage(playerid, COLOR_YELLOW, string);
new bizzname[32];
strmid(bizzname, BusinessInfo[i][bDescription], 3, strlen(BusinessInfo[i][bDescription]), 32);
format(string, sizeof(string), "%s has bought business %s.", PlayerName[playerid], bizzname);
SendClientMessageToAll(COLOR_YELLOW, string);
OnBusinessUpdate();
return 1;
}
}
}
return 1;
}
Here is the line that sends the message to the whole server
pawn Код:
strmid(bizzname, BusinessInfo[i][bDescription], 3, strlen(BusinessInfo[i][bDescription]), 32);
format(string, sizeof(string), "%s has bought business %s.", PlayerName[playerid], bizzname);
Re: [HELP]Business -
Jafet_Macario - 01.09.2011
PHP код:
if(strcmp(cmd, "/buybusiness", true) == 0 || strcmp(cmd, "/buybiz", true) == 0)
{
for(new i = 0; i <MAX_HOUSES; i++)
{
if (PlayerToPoint(3.0, playerid, BusinessInfo[i][bEntrancex], BusinessInfo[i][bEntrancey], BusinessInfo[i][bEntrancez]))
{
if(PlayerInfo[playerid][pLevel] < BusinessInfo[i][bLevel])
{
format(string, sizeof(string), "You must be level %d to buy this business.", BusinessInfo[i][bLevel]);
SendClientMessage(playerid, COLOR_RED, string);
return 1;
}
if(PlayerInfo[playerid][pBusinessKey] != INVALID_BUSINESS_ID)
{
SendClientMessage(playerid, COLOR_RED, "You are already owning a business, sell that first.");
return 1;
}
if(BusinessInfo[i][bOwned] == 1)
{
SendClientMessage(playerid, COLOR_RED, "This business you are trying to buy is already owned.");
return 1;
}
if(GetPlayerMoney(playerid) < BusinessInfo[i][bPrice])
{
format(string, sizeof(string), "You need %d$ dollars in cash to buy this business.", BusinessInfo[i][bPrice]);
SendClientMessage(playerid, COLOR_RED, string);
return 1;
}
else
{
SetPlayerPos(playerid, BusinessInfo[i][bExitx], BusinessInfo[i][bExity], BusinessInfo[i][bExitz]);
SetPlayerInterior(playerid, BusinessInfo[i][bInt]);
SetPlayerVirtualWorld(playerid, BusinessInfo[i][bWorld]);
GivePlayerMoney(playerid, -BusinessInfo[i][bPrice]);
BusinessInfo[i][bOwned] = 1;
strmid(BusinessInfo[i][bOwner], PlayerName[playerid], false, strlen(PlayerName[playerid]), 25);
PlayerInfo[playerid][pBusinessKey] = i;
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
format(string, sizeof(string), "You have successfully bought this business for %d$.", BusinessInfo[i][bPrice]);
SendClientMessage(playerid, COLOR_YELLOW, string);
new bizzname[32];
strmid(bizzname, BusinessInfo[i][bDescription], 3, strlen(BusinessInfo[i][bDescription]), 32);
format(string, sizeof(string), "%s has bought business %s.", PlayerName[playerid], BusinessInfo[i][bDescription]);
SendClientMessageToAll(COLOR_YELLOW, string);
OnBusinessUpdate();
return 1;
}
}
}
return 1;
}
Re: [HELP]Business -
[Aka]Dragonu - 01.09.2011
Thanks, it works!