Weird Change
#1

I've added :
pawn Код:
for(new b = 0; b < sizeof(BizzInfo); b++)
            {
I've changed :
pawn Код:
if (BizEntered[playerid] >= 26 && BizEntered[playerid] <= 32 || BizEntered[playerid] == 44 || BizEntered[playerid] == 54 || BizEntered[playerid] == 57)//centerpoint 24-7
to

pawn Код:
if(BizzInfo[b][bBizType] == 3 && BizEntered[playerid] == b)//centerpoint 24-7
            {
And now whenever I enter that command it just repeats this:

pawn Код:
SendClientMessage(playerid, COLOR_LIME, "------24/7 Store------");
                    SendClientMessage(playerid, COLOR_WHITE, "CellPhone($2000) - PhoneBook($5000) - FireExtinguisher($1000) - Laptop($10000)");
                    SendClientMessage(playerid, COLOR_WHITE, "Golfclub($1000) - Shovel($1000) - Flowers($50) - Cigarettes($5)");
                    SendClientMessage(playerid, COLOR_WHITE, "Para($2500) - Cane($1000) - Camera($1500) - MP4($2500) - Radio($3000)");
                    SendClientMessage(playerid, COLOR_GREY, ".: Usage: /buy [Item name] :.");
                    return 1;
What is causing this?

pawn Код:
for(new b = 0; b < sizeof(BizzInfo); b++)
            {
            new x_job[128];
            new shop = BizEntered[playerid];
            x_job = mystrtok(cmdtext, idx);
            if(BizzInfo[b][bBizType] == 3 && BizEntered[playerid] == b)//centerpoint 24-7
            {
                if(!strlen(x_job))
                {
                    SendClientMessage(playerid, COLOR_LIME, "------24/7 Store------");
                    SendClientMessage(playerid, COLOR_WHITE, "CellPhone($2000) - PhoneBook($5000) - FireExtinguisher($1000) - Laptop($10000)");
                    SendClientMessage(playerid, COLOR_WHITE, "Golfclub($1000) - Shovel($1000) - Flowers($50) - Cigarettes($5)");
                    SendClientMessage(playerid, COLOR_WHITE, "Para($2500) - Cane($1000) - Camera($1500) - MP4($2500) - Radio($3000)");
                    SendClientMessage(playerid, COLOR_GREY, ".: Usage: /buy [Item name] :.");
                    return 1;
                }
                tmp = mystrtok(cmdtext, idx);
                if(BizzInfo[shop][bProducts] == 0)
                {
                    SendClientMessage(playerid,COLOR_ERROR,"BIZ: Out of stock");
                    return 1;
                }
                if(strcmp(x_job,"cellphone",true) == 0 && Money[playerid] > 500)
                {

                    format(string, sizeof(string), "~r~-$%d", 2000);
                    GameTextForPlayer(playerid, string, 5000, 1);
                    GivePlayerMoney(playerid,-2000);
                    Money[playerid] -= 2000;
                    BizzInfo[shop][bBizCash] += 2000;
                    BizzInfo[shop][bProducts]--;
                    PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
                    new randphone = 10000 + random(89999);//minimum 1000  max 9999
                    PlayerInfo[playerid][pPnumber] = randphone;
                    format(string, sizeof(string), "[24/7] You have successfully purchased phone. Phone Number:%d", randphone);
                    SendClientMessage(playerid, COLOR_OLIVE, string);
                    return 1;
                }
                else if(strcmp(x_job,"cigarettes",true) == 0 && Money[playerid] > 5)
                {
                    GivePlayerMoney(playerid,-5);
                    Money[playerid] -= 5;
                    BizzInfo[shop][bBizCash] += 5;
                    BizzInfo[shop][bProducts]--;
                    format(string, sizeof(string), "~r~-$%d", 5);
                    GameTextForPlayer(playerid, string, 5000, 1);

                    PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
                    PlayerInfo[playerid][pCigarettes] += 5;
                    format(string, sizeof(string), "[24/7] You have successfully purchased cigarettes. /smoke");
                    SendClientMessage(playerid, COLOR_OLIVE, string);
                    return 1;
                }
                else if(strcmp(x_job,"phonebook",true) == 0 && Money[playerid] > 5000)
                {
                    GivePlayerMoney(playerid,-5000);
                    Money[playerid] -= 5000;
                    BizzInfo[shop][bBizCash] += 5000;
                    BizzInfo[shop][bProducts]--;
                    format(string, sizeof(string), "~r~-$%d", 5000);
                    GameTextForPlayer(playerid, string, 5000, 1);

                    PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
                    PlayerInfo[playerid][pPhoneBook] = 1;
                    format(string, sizeof(string), "[24/7] You have successfully purchased phonebook. /number [PartOfName/ID]");
                    SendClientMessage(playerid, COLOR_OLIVE, string);
                    return 1;
                }
                else if(strcmp(x_job,"para",true) == 0 && Money[playerid] > 2500)
                {
                    GivePlayerMoney(playerid,-2500);
                    Money[playerid] -= 2500;
                    BizzInfo[shop][bBizCash] += 2500;
                    BizzInfo[shop][bProducts]--;
                    format(string, sizeof(string), "~r~-$%d", 2500);
                    GameTextForPlayer(playerid, string, 5000, 1);

                    PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
                    GivePlayerWeapon(playerid,46,1);
                    format(string, sizeof(string), "[24/7] You have successfully purchased parachute.");
                    SendClientMessage(playerid, COLOR_OLIVE, string);
                    return 1;
                }
                else if(strcmp(x_job,"laptop",true) == 0 && Money[playerid] > 10000)
                {
                    GivePlayerMoney(playerid,-10000);
                    Money[playerid] -= 10000;
                    BizzInfo[shop][bBizCash] += 10000;
                    BizzInfo[shop][bProducts]--;
                    format(string, sizeof(string), "~r~-$%d", 10000);
                    GameTextForPlayer(playerid, string, 5000, 1);

                    PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
                    PlayerInfo[playerid][pLaptop] = 1;
                    format(string, sizeof(string), "[24/7] You have successfully purchased laptop. /laptop");
                    SendClientMessage(playerid, COLOR_OLIVE, string);
                    return 1;
                }
                else if(strcmp(x_job,"FireExtinguisher",true) == 0 && Money[playerid] > 1000)
                {
                    GivePlayerMoney(playerid,-1000);
                    Money[playerid] -= 1000;
                    Money[playerid] -= 1000;
                    BizzInfo[shop][bBizCash] += 1000;
                    format(string, sizeof(string), "~r~-$%d", 5000);
                    GameTextForPlayer(playerid, string, 5000, 1);
                    BizzInfo[shop][bProducts]--;
                    PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
                    GivePlayerWeapon(playerid, 42, 100);
                    format(string, sizeof(string), "[24/7] You have successfully purchased Fire extinguisher.");
                    SendClientMessage(playerid, COLOR_OLIVE, string);
                    return 1;
                }
                else if(strcmp(x_job,"golfclub",true) == 0 && Money[playerid] > 1000)
                {

                    GivePlayerMoney(playerid,-1000);
                    Money[playerid] -= 1000;
                    BizzInfo[shop][bBizCash] += 1000;
                    BizzInfo[shop][bProducts]--;
                    format(string, sizeof(string), "~r~-$%d", 5000);
                    GameTextForPlayer(playerid, string, 5000, 1);

                    BizzInfo[shop][bProducts]--;
                    PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
                    GivePlayerWeapon(playerid, 2, 1);
                    format(string, sizeof(string), "[24/7] You have successfully purchased Golf Club.");
                    SendClientMessage(playerid, COLOR_OLIVE, string);
                    return 1;
                }
                else if(strcmp(x_job,"shovel",true) == 0 && Money[playerid] > 1000)
                {
                    GivePlayerMoney(playerid,-1000);
                    Money[playerid] -= 1000;
                    BizzInfo[shop][bBizCash] += 1000;
                    BizzInfo[shop][bProducts]--;

                    format(string, sizeof(string), "~r~-$%d", 5000);
                    GameTextForPlayer(playerid, string, 5000, 1);
                    PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
                    GivePlayerWeapon(playerid, 6, 1);
                    format(string, sizeof(string), "[24/7] You have successfully purchased shovel.");
                    SendClientMessage(playerid, COLOR_OLIVE, string);
                    return 1;
                }
                else if(strcmp(x_job,"flowers",true) == 0 && Money[playerid] > 5000)
                {



                    GivePlayerMoney(playerid,-50);
                    BizzInfo[shop][bBizCash] += 50;
                    Money[playerid] -= 50;
                    format(string, sizeof(string), "~r~-$%d", 5000);
                    GameTextForPlayer(playerid, string, 5000, 1);
                    BizzInfo[shop][bProducts]--;
                    PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
                    GivePlayerWeapon(playerid, 14, 1);
                    format(string, sizeof(string), "[24/7] You have successfully purchased Flowers.");
                    SendClientMessage(playerid, COLOR_OLIVE, string);
                    return 1;
                }
                else if(strcmp(x_job,"mp4",true) == 0 && Money[playerid] > 2500)
                {

                    GivePlayerMoney(playerid, - 2500);
                    BizzInfo[shop][bBizCash] += 2500;
                    Money[playerid] -= 2500;
                    BizzInfo[shop][bProducts]--;
                    format(string, sizeof(string), "~r~-$%d", 2500);
                    GameTextForPlayer(playerid, string, 5000, 1);
                    PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
                    format(string, sizeof(string), "[24/7] You have successfully purchased MP4 player. /music [On/Off/Next]");
                    SendClientMessage(playerid, COLOR_OLIVE, string);
                    PlayerInfo[playerid][pCDPlayer] = 1;
                    return 1;
                }

                else if (strcmp(x_job,"Cane",true) == 0 && Money[playerid] > 1000)
                {

                    GivePlayerMoney(playerid,-1000);
                    BizzInfo[shop][bBizCash] += 1000;
                    Money[playerid] -= 1000;
                    format(string, sizeof(string), "~r~-$%d", 5000);
                    GameTextForPlayer(playerid, string, 5000, 1);
                    BizzInfo[shop][bProducts]--;
                    PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
                    GivePlayerWeapon(playerid, 15, 1);
                    format(string, sizeof(string), "[24/7] You have successfully purchased Cane.");
                    SendClientMessage(playerid, COLOR_OLIVE, string);
                    return 1;
                }
                else if (strcmp(x_job,"Camera",true) == 0 && Money[playerid] > 1000)
                {

                    GivePlayerMoney(playerid,-1000);
                    BizzInfo[shop][bBizCash] += 1000;
                    Money[playerid] -= 1000;
                    format(string, sizeof(string), "~r~-$%d", 5000);
                    GameTextForPlayer(playerid, string, 5000, 1);
                    BizzInfo[shop][bProducts]--;
                    PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
                    GivePlayerWeapon(playerid, 43, 10);
                    format(string, sizeof(string), "[24/7] You have successfully purchased Camera.");
                    SendClientMessage(playerid, COLOR_OLIVE, string);
                    return 1;
                }
                else if (strcmp(x_job,"Radio",true) == 0 && Money[playerid] > 3000)
                {

                    format(string, sizeof(string), "~r~-$%d", 500);
                    GameTextForPlayer(playerid, string, 5000, 1);
                    GivePlayerMoney(playerid,-1000);
                    Money[playerid] -= 1000;
                    BizzInfo[shop][bBizCash] += 1000;
                    BizzInfo[shop][bProducts]--;
                    PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
                    new randfreq = 100001;
                    PlayerInfo[playerid][pFreq] = randfreq;
                    format(string, sizeof(string), "[24/7]Radio successfully purchased your freq is %d", randfreq);
                    SendClientMessage(playerid, COLOR_OLIVE, string);
                    return 1;
                }
                else
                {
                    SendClientMessage(playerid, COLOR_ERROR, "You don't have the cash for that !");
                }
            }
Reply
#2

PHP код:
for(new 0sizeof(BizzInfo); b++)
{
            new 
x_job[128];
            new 
shop BizEntered[playerid];
            
x_job mystrtok(cmdtextidx);
            if(
BizzInfo[b][bBizType] == && BizEntered[playerid] == b)//centerpoint 24-7
            
{
                if(!
strlen(x_job))
                {
                    
SendClientMessage(playeridCOLOR_LIME"------24/7 Store------");
                    
SendClientMessage(playeridCOLOR_WHITE"CellPhone($2000) - PhoneBook($5000) - FireExtinguisher($1000) - Laptop($10000)");
                    
SendClientMessage(playeridCOLOR_WHITE"Golfclub($1000) - Shovel($1000) - Flowers($50) - Cigarettes($5)");
                    
SendClientMessage(playeridCOLOR_WHITE"Para($2500) - Cane($1000) - Camera($1500) - MP4($2500) - Radio($3000)");
                    
SendClientMessage(playeridCOLOR_GREY".: Usage: /buy [Item name] :.");
                    break;
                }
                
tmp mystrtok(cmdtextidx);
                if(
BizzInfo[shop][bProducts] == 0)
                {
                    
SendClientMessage(playerid,COLOR_ERROR,"BIZ: Out of stock");
                    break;
                }
                if(
strcmp(x_job,"cellphone",true) == && Money[playerid] > 500)
                {
                    
format(stringsizeof(string), "~r~-$%d"2000);
                    
GameTextForPlayer(playeridstring50001);
                    
GivePlayerMoney(playerid,-2000);
                    
Money[playerid] -= 2000;
                    
BizzInfo[shop][bBizCash] += 2000;
                    
BizzInfo[shop][bProducts]--;
                    
PlayerPlaySound(playerid10520.00.00.0);
                    new 
randphone 10000 random(89999);//minimum 1000  max 9999
                    
PlayerInfo[playerid][pPnumber] = randphone;
                    
format(stringsizeof(string), "[24/7] You have successfully purchased phone. Phone Number:%d"randphone);
                    
SendClientMessage(playeridCOLOR_OLIVEstring);
                    break;
                }
                else if(
strcmp(x_job,"cigarettes",true) == && Money[playerid] > 5)
                {
                    
GivePlayerMoney(playerid,-5);
                    
Money[playerid] -= 5;
                    
BizzInfo[shop][bBizCash] += 5;
                    
BizzInfo[shop][bProducts]--;
                    
format(stringsizeof(string), "~r~-$%d"5);
                    
GameTextForPlayer(playeridstring50001);
                    
PlayerPlaySound(playerid10520.00.00.0);
                    
PlayerInfo[playerid][pCigarettes] += 5;
                    
format(stringsizeof(string), "[24/7] You have successfully purchased cigarettes. /smoke");
                    
SendClientMessage(playeridCOLOR_OLIVEstring);
                    break;
                }
                else if(
strcmp(x_job,"phonebook",true) == && Money[playerid] > 5000)
                {
                    
GivePlayerMoney(playerid,-5000);
                    
Money[playerid] -= 5000;
                    
BizzInfo[shop][bBizCash] += 5000;
                    
BizzInfo[shop][bProducts]--;
                    
format(stringsizeof(string), "~r~-$%d"5000);
                    
GameTextForPlayer(playeridstring50001);
                    
PlayerPlaySound(playerid10520.00.00.0);
                    
PlayerInfo[playerid][pPhoneBook] = 1;
                    
format(stringsizeof(string), "[24/7] You have successfully purchased phonebook. /number [PartOfName/ID]");
                    
SendClientMessage(playeridCOLOR_OLIVEstring);
                    break;
                }
                else if(
strcmp(x_job,"para",true) == && Money[playerid] > 2500)
                {
                    
GivePlayerMoney(playerid,-2500);
                    
Money[playerid] -= 2500;
                    
BizzInfo[shop][bBizCash] += 2500;
                    
BizzInfo[shop][bProducts]--;
                    
format(stringsizeof(string), "~r~-$%d"2500);
                    
GameTextForPlayer(playeridstring50001);
                    
PlayerPlaySound(playerid10520.00.00.0);
                    
GivePlayerWeapon(playerid,46,1);
                    
format(stringsizeof(string), "[24/7] You have successfully purchased parachute.");
                    
SendClientMessage(playeridCOLOR_OLIVEstring);
                    break;
                }
                else if(
strcmp(x_job,"laptop",true) == && Money[playerid] > 10000)
                {
                    
GivePlayerMoney(playerid,-10000);
                    
Money[playerid] -= 10000;
                    
BizzInfo[shop][bBizCash] += 10000;
                    
BizzInfo[shop][bProducts]--;
                    
format(stringsizeof(string), "~r~-$%d"10000);
                    
GameTextForPlayer(playeridstring50001);
                    
PlayerPlaySound(playerid10520.00.00.0);
                    
PlayerInfo[playerid][pLaptop] = 1;
                    
format(stringsizeof(string), "[24/7] You have successfully purchased laptop. /laptop");
                    
SendClientMessage(playeridCOLOR_OLIVEstring);
                    break;
                }
                else if(
strcmp(x_job,"FireExtinguisher",true) == && Money[playerid] > 1000)
                {
                    
GivePlayerMoney(playerid,-1000);
                    
Money[playerid] -= 1000;
                    
Money[playerid] -= 1000;
                    
BizzInfo[shop][bBizCash] += 1000;
                    
format(stringsizeof(string), "~r~-$%d"5000);
                    
GameTextForPlayer(playeridstring50001);
                    
BizzInfo[shop][bProducts]--;
                    
PlayerPlaySound(playerid10520.00.00.0);
                    
GivePlayerWeapon(playerid42100);
                    
format(stringsizeof(string), "[24/7] You have successfully purchased Fire extinguisher.");
                    
SendClientMessage(playeridCOLOR_OLIVEstring);
                    break;
                }
                else if(
strcmp(x_job,"golfclub",true) == && Money[playerid] > 1000)
                {
                    
GivePlayerMoney(playerid,-1000);
                    
Money[playerid] -= 1000;
                    
BizzInfo[shop][bBizCash] += 1000;
                    
BizzInfo[shop][bProducts]--;
                    
format(stringsizeof(string), "~r~-$%d"5000);
                    
GameTextForPlayer(playeridstring50001);
                    
BizzInfo[shop][bProducts]--;
                    
PlayerPlaySound(playerid10520.00.00.0);
                    
GivePlayerWeapon(playerid21);
                    
format(stringsizeof(string), "[24/7] You have successfully purchased Golf Club.");
                    
SendClientMessage(playeridCOLOR_OLIVEstring);
                    break;
                }
                else if(
strcmp(x_job,"shovel",true) == && Money[playerid] > 1000)
                {
                    
GivePlayerMoney(playerid,-1000);
                    
Money[playerid] -= 1000;
                    
BizzInfo[shop][bBizCash] += 1000;
                    
BizzInfo[shop][bProducts]--;
                    
format(stringsizeof(string), "~r~-$%d"5000);
                    
GameTextForPlayer(playeridstring50001);
                    
PlayerPlaySound(playerid10520.00.00.0);
                    
GivePlayerWeapon(playerid61);
                    
format(stringsizeof(string), "[24/7] You have successfully purchased shovel.");
                    
SendClientMessage(playeridCOLOR_OLIVEstring);
                    break;
                }
                else if(
strcmp(x_job,"flowers",true) == && Money[playerid] > 5000)
                {
                    
GivePlayerMoney(playerid,-50);
                    
BizzInfo[shop][bBizCash] += 50;
                    
Money[playerid] -= 50;
                    
format(stringsizeof(string), "~r~-$%d"5000);
                    
GameTextForPlayer(playeridstring50001);
                    
BizzInfo[shop][bProducts]--;
                    
PlayerPlaySound(playerid10520.00.00.0);
                    
GivePlayerWeapon(playerid141);
                    
format(stringsizeof(string), "[24/7] You have successfully purchased Flowers.");
                    
SendClientMessage(playeridCOLOR_OLIVEstring);
                    break;
                }
                else if(
strcmp(x_job,"mp4",true) == && Money[playerid] > 2500)
                {
                    
GivePlayerMoney(playerid, - 2500);
                    
BizzInfo[shop][bBizCash] += 2500;
                    
Money[playerid] -= 2500;
                    
BizzInfo[shop][bProducts]--;
                    
format(stringsizeof(string), "~r~-$%d"2500);
                    
GameTextForPlayer(playeridstring50001);
                    
PlayerPlaySound(playerid10520.00.00.0);
                    
format(stringsizeof(string), "[24/7] You have successfully purchased MP4 player. /music [On/Off/Next]");
                    
SendClientMessage(playeridCOLOR_OLIVEstring);
                    
PlayerInfo[playerid][pCDPlayer] = 1;
                    break;
                }
                else if (
strcmp(x_job,"Cane",true) == && Money[playerid] > 1000)
                {
                    
GivePlayerMoney(playerid,-1000);
                    
BizzInfo[shop][bBizCash] += 1000;
                    
Money[playerid] -= 1000;
                    
format(stringsizeof(string), "~r~-$%d"5000);
                    
GameTextForPlayer(playeridstring50001);
                    
BizzInfo[shop][bProducts]--;
                    
PlayerPlaySound(playerid10520.00.00.0);
                    
GivePlayerWeapon(playerid151);
                    
format(stringsizeof(string), "[24/7] You have successfully purchased Cane.");
                    
SendClientMessage(playeridCOLOR_OLIVEstring);
                    break;
                }
                else if (
strcmp(x_job,"Camera",true) == && Money[playerid] > 1000)
                {
                    
GivePlayerMoney(playerid,-1000);
                    
BizzInfo[shop][bBizCash] += 1000;
                    
Money[playerid] -= 1000;
                    
format(stringsizeof(string), "~r~-$%d"5000);
                    
GameTextForPlayer(playeridstring50001);
                    
BizzInfo[shop][bProducts]--;
                    
PlayerPlaySound(playerid10520.00.00.0);
                    
GivePlayerWeapon(playerid4310);
                    
format(stringsizeof(string), "[24/7] You have successfully purchased Camera.");
                    
SendClientMessage(playeridCOLOR_OLIVEstring);
                    break;
                }
                else if (
strcmp(x_job,"Radio",true) == && Money[playerid] > 3000)
                {
                    
format(stringsizeof(string), "~r~-$%d"500);
                    
GameTextForPlayer(playeridstring50001);
                    
GivePlayerMoney(playerid,-1000);
                    
Money[playerid] -= 1000;
                    
BizzInfo[shop][bBizCash] += 1000;
                    
BizzInfo[shop][bProducts]--;
                    
PlayerPlaySound(playerid10520.00.00.0);
                    new 
randfreq 100001;
                    
PlayerInfo[playerid][pFreq] = randfreq;
                    
format(stringsizeof(string), "[24/7]Radio successfully purchased your freq is %d"randfreq);
                    
SendClientMessage(playeridCOLOR_OLIVEstring);
                    break;
                }
                else
                {
                    
SendClientMessage(playeridCOLOR_ERROR"You don't have the cash for that !");
                }

Reply
#3

What have you changed and what is break? (Thanks will test it out)

Edit: Same result
Reply
#4

Bump on this thread
Reply
#5

'break' stops a loop from continuing. Your problem is that it checks if the player enters a 24/7 store in every loop, so it'll send the message each time it detects it.
Reply
#6

Unfortunately even with that, I had the same results..
Reply
#7

That's impossible, I stopped the loop.
Reply
#8

Quote:
Originally Posted by Carlton
Посмотреть сообщение
That's impossible, I stopped the loop.
Except for the last option, you probably forgot it by accident:
pawn Код:
else
                {
                    SendClientMessage(playerid, COLOR_ERROR, "You don't have the cash for that !");
                }
Add 'break' there as well.

Hope that's the solution, else I wouldn't know it.
Reply
#9

Nothing changed, just the same when I entered /buy it showed me the list.
Reply
#10

I don't understand why you have a loop going through all the business IDs if you've saved the player's current business in BizEntered[playerid].

Can't you just have:
pawn Код:
if(BizzInfo[BizEntered[playerid]][bBizType] == 3)
etc.
Reply


Forum Jump:


Users browsing this thread: 7 Guest(s)