Weird Change -
KnooL - 14.07.2010
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 !");
}
}
Re: Weird Change -
Carlton - 14.07.2010
PHP код:
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] :.");
break;
}
tmp = mystrtok(cmdtext, idx);
if(BizzInfo[shop][bProducts] == 0)
{
SendClientMessage(playerid,COLOR_ERROR,"BIZ: Out of stock");
break;
}
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);
break;
}
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);
break;
}
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);
break;
}
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);
break;
}
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);
break;
}
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);
break;
}
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);
break;
}
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);
break;
}
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);
break;
}
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;
break;
}
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);
break;
}
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);
break;
}
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);
break;
}
else
{
SendClientMessage(playerid, COLOR_ERROR, "You don't have the cash for that !");
}
}
Re: Weird Change -
KnooL - 14.07.2010
What have you changed and what is break? (Thanks will test it out)
Edit: Same result
Re: Weird Change -
KnooL - 15.07.2010
Bump on this thread
Re: Weird Change -
Hiddos - 15.07.2010
'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.
Re: Weird Change -
KnooL - 15.07.2010
Unfortunately even with that, I had the same results..
Re: Weird Change -
Carlton - 15.07.2010
That's impossible, I stopped the loop.
Re: Weird Change -
Hiddos - 15.07.2010
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.
Re: Weird Change -
KnooL - 15.07.2010
Nothing changed, just the same when I entered /buy it showed me the list.
Re: Weird Change -
Finn - 15.07.2010
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.