30.01.2011, 01:09
Hello. I got a problem with my /buy cmd for 24/7. There is two things that i cant buy. The other things works. But the very last two dont work.
This is my OnDialogResponse code:
This is DisplayDialog code:
I dont get it whats wrong.
I marked listitem 15 & 16
This is my OnDialogResponse code:
pawn Код:
if(dialogid == 3) //247
{
if(response)
{
new string[128];
if(listitem == 0) //cellphone
{
if(!(PlayerInfo[playerid][pPnumber] == 0))
{
SendClientMessage(playerid, COLOR_GRAD2, " You already have a cell phone !");
return 1;
}
if(PlayerInfo[playerid][pCash] > 499)
{
PlayerInfo[playerid][pCash] = PlayerInfo[playerid][pCash]-500;
GivePlayerMoney(playerid,-500);
new randphone = 1000 + random(8999);//minimum 1000 max 9999
PlayerInfo[playerid][pPnumber] = randphone;
format(string, sizeof(string), "~r~-$%d", 500);
GameTextForPlayer(playerid, string, 5000, 1);
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
format(string, sizeof(string), "Mobile phone purchased, your new phone number is %d.", randphone);
SendClientMessage(playerid, COLOR_GRAD4, string);
SendClientMessage(playerid, COLOR_GRAD5, "You can check this anytime by typing /stats.");
SendClientMessage(playerid, COLOR_WHITE, "HINT: You can now type /help to see your cell phone commands.");
GiveBizMoney(playerid, 500);
return 1;
}
else
{
SendClientMessage(playerid, COLOR_GREY, " You don't have the cash for that !");
}
}
if(listitem == 1) //phonebook
{
if(PlayerInfo[playerid][pCash] > 4999)
{
PlayerInfo[playerid][pCash] = PlayerInfo[playerid][pCash]-5000;
GivePlayerMoney(playerid,-5000);
PlayerInfo[playerid][pPhoneBook] = 1;
format(string, sizeof(string), "~r~-$%d", 5000);
GameTextForPlayer(playerid, string, 5000, 1);
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
SendClientMessage(playerid, COLOR_GRAD4, "Phonebook purchased, you can now look up other players numbers.");
SendClientMessage(playerid, COLOR_WHITE, "HINT: Type /number <id/name>.");
GiveBizMoney(playerid, 5000);
return 1;
}
else
{
SendClientMessage(playerid, COLOR_GREY, " You don't have the cash for that !");
}
}
if(listitem == 2) //dice
{
if(PlayerInfo[playerid][pCash] > 499)
{
PlayerInfo[playerid][pCash] = PlayerInfo[playerid][pCash]-500;
GivePlayerMoney(playerid,-500);
PlayerInfo[playerid][pDice] = 1;
format(string, sizeof(string), "~r~-$%d", 500);
GameTextForPlayer(playerid, string, 5000, 1);
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
SendClientMessage(playerid, COLOR_GRAD4, "Dice purchased.");
SendClientMessage(playerid, COLOR_WHITE, "HINT: Type /dice to use.");
GiveBizMoney(playerid, 500);
return 1;
}
else
{
SendClientMessage(playerid, COLOR_GREY, " You don't have the cash for that !");
}
}
if(listitem == 3)
{
if(PlayerInfo[playerid][pCash] > 4999)
{
PlayerInfo[playerid][pCash] = PlayerInfo[playerid][pCash]-5000;
GivePlayerMoney(playerid,-5000);
gVehicleLock[playerid] = 1;
format(string, sizeof(string), "~r~-$%d", 5000);
GameTextForPlayer(playerid, string, 5000, 1);
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
SendClientMessage(playerid, COLOR_GRAD4, "Lock purchased.");
SendClientMessage(playerid, COLOR_WHITE, "HINT: Type /lock while in a vehicle to use.");
GiveBizMoney(playerid, 5000);
return 1;
}
else
{
SendClientMessage(playerid, COLOR_GREY, " You don't have the cash for that !");
}
}
if(listitem == 4)
{
if(PlayerInfo[playerid][pCash] > 4999)
{
PlayerInfo[playerid][pCash] = PlayerInfo[playerid][pCash]-5000;
GivePlayerMoney(playerid,-5000);
gSpeedo[playerid] = 1;
format(string, sizeof(string), "~r~-$%d", 5000);
GameTextForPlayer(playerid, string, 5000, 1);
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
SendClientMessage(playerid, COLOR_GRAD4, "Speedometer purchased.");
SendClientMessage(playerid, COLOR_WHITE, "HINT: Type /speedo to use.");
GiveBizMoney(playerid, 5000);
return 1;
}
else
{
SendClientMessage(playerid, COLOR_GREY, " You don't have the cash for that !");
}
}
if(listitem == 5)
{
if(PlayerInfo[playerid][pCash] > 49)
{
if(Condom[playerid] <= 6)
{
PlayerInfo[playerid][pCash] = PlayerInfo[playerid][pCash]-50;
GivePlayerMoney(playerid,-50);
Condom[playerid] ++;
format(string, sizeof(string), "~r~-$%d", 50);
GameTextForPlayer(playerid, string, 5000, 1);
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
SendClientMessage(playerid, COLOR_GRAD4, "Condom purchased.");
GiveBizMoney(playerid, 50);
return 1;
}
else
{
SendClientMessage(playerid, COLOR_GREY, " You can't hold anymore of those !");
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, " You don't have the cash for that !");
}
}
if(listitem == 6)
{
if(PlayerInfo[playerid][pCash] > 2499)
{
PlayerInfo[playerid][pCash] = PlayerInfo[playerid][pCash]-2500;
GivePlayerMoney(playerid, - 2500);
PlayerInfo[playerid][pCDPlayer] = 1;
format(string, sizeof(string), "~r~-$%d", 2500);
GameTextForPlayer(playerid, string, 5000, 1);
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
SendClientMessage(playerid, COLOR_GRAD4, "CD-Player purchased.");
SendClientMessage(playerid, COLOR_WHITE, "HINT: Type /music to use.");
GiveBizMoney(playerid, 2500);
return 1;
}
else
{
SendClientMessage(playerid, COLOR_GREY, " You don't have the cash for that !");
}
}
if(listitem == 7)
{
if(PlayerInfo[playerid][pCash] > 2499)
{
if(PlayerInfo[playerid][pSpraycan] <= 10)
{
PlayerInfo[playerid][pCash] = PlayerInfo[playerid][pCash]-200;
GivePlayerMoney(playerid, -200);
PlayerInfo[playerid][pSpraycan] += 10;
format(string, sizeof(string), "~r~-$%d", 200);
GameTextForPlayer(playerid, string, 5000, 1);
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
SendClientMessage(playerid, COLOR_GRAD4, "10 Spraycans purchased.");
SendClientMessage(playerid, COLOR_WHITE, "HINT: Type /colorcar or /paintcar while inside a vehicle.");
GiveBizMoney(playerid, 2500);
return 1;
}
else
{
SendClientMessage(playerid, COLOR_GREY, " You can't hold anymore of those !");
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, " You don't have the cash for that !");
}
}
if(listitem == 8)
{
if(PlayerInfo[playerid][pCash] > 999)
{
if(PlayerInfo[playerid][pRope] <= 3)
{
PlayerInfo[playerid][pCash] = PlayerInfo[playerid][pCash]-1000;
GivePlayerMoney(playerid, -1000);
PlayerInfo[playerid][pRope] += 3;
format(string, sizeof(string), "~r~-$%d", 1000);
GameTextForPlayer(playerid, string, 5000, 1);
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
SendClientMessage(playerid, COLOR_GRAD4, "3 Ropes purchased.");
SendClientMessage(playerid, COLOR_WHITE, "HINT: Type /tie while driving a car to tie someone.");
GiveBizMoney(playerid, 1000);
return 1;
}
else
{
SendClientMessage(playerid, COLOR_GREY, " You can't hold anymore of those !");
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, " You don't have the cash for that !");
}
}
if(listitem == 9)
{
if(PlayerInfo[playerid][pCash] > 99)
{
if(PlayerInfo[playerid][pCigars] <= 10)
{
PlayerInfo[playerid][pCash] = PlayerInfo[playerid][pCash]-100;
GivePlayerMoney(playerid, -100);
PlayerInfo[playerid][pCigars] += 10;
format(string, sizeof(string), "~r~-$%d", 100);
GameTextForPlayer(playerid, string, 5000, 1);
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
SendClientMessage(playerid, COLOR_GRAD4, "10 Cigars purchased.");
SendClientMessage(playerid, COLOR_WHITE, "HINT: Type /usecigar to use your cigars, once used press left mouse button to smoke, F to throw away.");
GiveBizMoney(playerid, 100);
return 1;
}
else
{
SendClientMessage(playerid, COLOR_GREY, " You can't hold anymore of those !");
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, " You don't have the cash for that !");
}
}
if(listitem == 10)
{
if(PlayerInfo[playerid][pCash] > 9)
{
if(PlayerInfo[playerid][pSprunk] <= 3)
{
PlayerInfo[playerid][pCash] = PlayerInfo[playerid][pCash]-10;
GivePlayerMoney(playerid, -25);
PlayerInfo[playerid][pSprunk] += 1;
format(string, sizeof(string), "~r~-$%d", 10);
GameTextForPlayer(playerid, string, 5000, 1);
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
SendClientMessage(playerid, COLOR_GRAD4, "Sprunk purchased.");
SendClientMessage(playerid, COLOR_WHITE, "HINT: Type /usesprunk to use your sprunk, once used press left mouse button to drink, F to throw away.");
GiveBizMoney(playerid, 10);
if(PointInfo[9][PointTaken] != 255) //sprunk factory
{
FamilyInfo[PointInfo[9][PointTaken]][FamilyBank] += 25;
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, " You can't hold anymore of those !");
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, " You don't have the cash for that !");
}
}
if(listitem == 11)
{
if(PlayerInfo[playerid][pCash] > 199)
{
PlayerInfo[playerid][pCash] = PlayerInfo[playerid][pCash]-200;
GivePlayerMoney(playerid, -200);
PlayerInfo[playerid][pWT] = 1;
format(string, sizeof(string), "~r~-$%d", 200);
GameTextForPlayer(playerid, string, 5000, 1);
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
SendClientMessage(playerid, COLOR_GRAD4, "Walkie Talkie purchased.");
SendClientMessage(playerid, COLOR_WHITE, "HINT: Type /WT to talk in your walkie talkie, type /channel to adjust the channel number.");
GiveBizMoney(playerid, 200);
return 1;
}
else
{
SendClientMessage(playerid, COLOR_GREY, " You don't have the cash for that !");
}
}
if(listitem == 12)
{
if(PlayerInfo[playerid][pCash] > 49)
{
if(PlayerInfo[playerid][pScrew] <= 5)
{
PlayerInfo[playerid][pCash] = PlayerInfo[playerid][pCash]-50;
GivePlayerMoney(playerid, -50);
PlayerInfo[playerid][pScrew] += 5;
format(string, sizeof(string), "~r~-$%d", 50);
GameTextForPlayer(playerid, string, 5000, 1);
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
SendClientMessage(playerid, COLOR_GRAD4, "5 Screw Drivers purchased.");
SendClientMessage(playerid, COLOR_WHITE, "HINT: Type /breakin to pick the locks on peoples houses.");
GiveBizMoney(playerid, 50);
return 1;
}
else
{
SendClientMessage(playerid, COLOR_GREY, " You can't hold anymore of those !");
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, " You don't have the cash for that !");
}
}
if(listitem == 13)
{
if(PlayerInfo[playerid][pCash] >= 2500)
{
if(PlayerInfo[playerid][pBlindfolds] <= 2)
{
PlayerInfo[playerid][pCash] = PlayerInfo[playerid][pCash]-2500;
GivePlayerMoney(playerid, -2500);
PlayerInfo[playerid][pBlindfolds] += 2;
format(string, sizeof(string), "~r~-$%d", 2500);
GameTextForPlayer(playerid, string, 5000, 1);
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
SendClientMessage(playerid, COLOR_GRAD4, "2 Blindfolds purchased.");
SendClientMessage(playerid, COLOR_WHITE, "HINT: Type /blindfold to blindfold a tied player.");
GiveBizMoney(playerid, 2500);
return 1;
}
else
{
SendClientMessage(playerid, COLOR_GREY, " You can't hold anymore of those !");
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, " You don't have the cash for that !");
}
}
if(listitem == 14)
{
if(GetPlayerMoney(playerid) >= 5000)
{
PlayerInfo[playerid][pCash] = PlayerInfo[playerid][pCash]-5000;
GivePlayerMoney(playerid,-10000);
GivePlayerGun(playerid, 43);
GameTextForPlayer(playerid,"~r~-$10000", 5000, 1);
SendClientMessage(playerid, COLOR_WHITE," You purchased a camera");
GiveBizMoney(playerid, 5000);
return 1;
}
if(listitem == 15) - THIS
{
This if(GetPlayerMoney(playerid) >= 500)
{
GivePlayerMoney(playerid,-500);
GiveBizMoney(playerid, 500);
HasBoughtMask[playerid] = 1;
GameTextForPlayer(playerid,"~w~You purchased a mask for ~r~ $500", 5000, 1);
SendClientMessage(playerid, COLOR_WHITE, "Use /mask to take on/off your mask");
return 1;
}
if(listitem == 16) - This
{
if(GetPlayerMoney(playerid) >=50)
{
GivePlayerMoney(playerid, -500);
GiveBizMoney(playerid, 500);
gotbandage[playerid] = 1;
GameTextForPlayer(playerid,"~w~You purchased bandage for ~r~ $50", 5000, 1);
SendClientMessage(playerid, COLOR_WHITE, "Use /bandage to use it");
return 1;
}
}
}
}
}
}
Код:
ShowPlayerDialog(playerid,3,DIALOG_STYLE_LIST,"24-7","Cellphone $500\nPhonebook $5000\nDice $500\nVehicle Lock $5000\nSpeedometer $5000\nCondom $50\nCD Player $50\nSpraycan $200\nRope $1000\nCigars $50\nSprunk $25\nWalkie Talkie $200\nScrew Driver $50\nBlindfold $2500\nCamera $5000\nMask $500\nBandage $50","Buy","Cancel");
I marked listitem 15 & 16