CMD: Problem - 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: CMD: Problem (
/showthread.php?tid=451039)
CMD: Problem -
SRP - 15.07.2013
Hello All
I got a Problem with CMD:asellbiz When I do it it Sell All business Not only the one I wrote his id
So can Any one help meCMD text
PHP код:
CMD:asellbiz(playerid, params[])
{
new bizid, string[128];
if(PlayerInfo[playerid][pAdmin] < 100005) return SendClientMessage(playerid, COLOR_GREY, "You are not an authorized to use this command.");
if(sscanf(params, "i", bizid)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /asellbiz [bizid]");
if(!BizInfo[bizid][bType]) return SendClientMessage(playerid, COLOR_GREY, "Invalid business id.");
if(!strcmp("The State", BizInfo[bizid][bOwner], true)) return SendClientMessage(playerid, COLOR_GREY, "This business is not owned by anybody.");
foreach(Player, i)
{
{
PlayerInfo[i][pBiz] = 0;
format(string, sizeof(string), " Administrator %s has sold your business.", RPN(playerid));
SendClientMessage(i, COLOR_WHITE, string);
}
}
format(string, sizeof(string), "AdmWarn: %s has sold %s's business. (ID %d)", RPN(playerid), BizInfo[bizid][bOwner], bizid);
ABroadCast(COLOR_DARKRED, string, 2 );
format(BizInfo[bizid][bOwner], 32, "The State");
format(string, sizeof(string), "ID: %d\n%s\nOwner: %s\nStatus: For Sale\nPrice: $%d", bizid, RBT(bizid), BizInfo[bizid][bOwner], BizInfo[bizid][bPrice]);
UpdateDynamic3DTextLabelText(BizInfo[bizid][bText], COLOR_WHITE, string);
return 1;
}
Please Write the right CMD and send me it Or post it in a reply
+ sorry on my english
Re: CMD: Problem -
Bakr - 15.07.2013
pawn Код:
foreach(Player, i)
{
{
PlayerInfo[i][pBiz] = 0;
format(string, sizeof(string), " Administrator %s has sold your business.", RPN(playerid));
SendClientMessage(i, COLOR_WHITE, string);
}
}
Why are you looping through all the players and selling their business (even if they don't have one)?
Re: CMD: Problem -
dominik523 - 15.07.2013
Код:
foreach(Player, i)
{
if(IsPlayerLoggedIn(i) && PlayerInfo[i][pBiz] == bizid) // you are missing this line
{
PlayerInfo[i][pBiz] = 0;
format(string, sizeof(string), " Administrator %s has sold your business.", RPN(playerid));
SendClientMessage(i, COLOR_WHITE, string);
}
}
Re: CMD: Problem -
SRP - 15.07.2013
thanks Dominkin I will test it now+rep