CMD: Problem
#1

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(playeridparams[])
{
    new 
bizidstring[128];
    if(
PlayerInfo[playerid][pAdmin] < 100005) return SendClientMessage(playeridCOLOR_GREY"You are not an authorized to use this command.");
    if(
sscanf(params"i"bizid)) return SendClientMessage(playeridCOLOR_WHITE"USAGE: /asellbiz [bizid]");
    if(!
BizInfo[bizid][bType]) return SendClientMessage(playeridCOLOR_GREY"Invalid business id.");
    if(!
strcmp("The State"BizInfo[bizid][bOwner], true)) return SendClientMessage(playeridCOLOR_GREY"This business is not owned by anybody.");
    foreach(
Playeri)
    {
        {
            
PlayerInfo[i][pBiz] = 0;
            
format(stringsizeof(string), " Administrator %s has sold your business."RPN(playerid));
            
SendClientMessage(iCOLOR_WHITEstring);
        }
    }
    
format(stringsizeof(string), "AdmWarn: %s has sold %s's business. (ID %d)"RPN(playerid), BizInfo[bizid][bOwner], bizid);
    
ABroadCast(COLOR_DARKREDstring);
    
format(BizInfo[bizid][bOwner], 32"The State");
    
format(stringsizeof(string), "ID: %d\n%s\nOwner: %s\nStatus: For Sale\nPrice: $%d"bizidRBT(bizid), BizInfo[bizid][bOwner], BizInfo[bizid][bPrice]);
     
UpdateDynamic3DTextLabelText(BizInfo[bizid][bText], COLOR_WHITEstring);
    return 
1;

Please Write the right CMD and send me it Or post it in a reply
+ sorry on my english
Reply
#2

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)?
Reply
#3

Код:
	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);
		}
	}
Reply
#4

thanks Dominkin I will test it now+rep
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)