04.04.2010, 02:19
here is my code i hope u can help me out of this
i hope u can help me through
Ђdit: if i choose in dialog 1 of these 2 items in the list the server shut down (looks like he does) but why? the compiler brought me no errors or something...
pawn Код:
if (dialogid == 19)
{
if(!response){return 1;}
else
{
new PlayerMoney = GetPlayerMoney(playerid);
switch(listitem)
{
case 0:
{
// Cell Phone
if (PlayerMoney >= 150)
{
if(PlayerInfo[playerid][pTraderPerk] > 0)
{
new skill = 150 / 100;
new price = (skill)*(PlayerInfo[playerid][pTraderPerk]);
new payout = 150 - price;
format(string, sizeof(string), "~r~-$%d", payout);
GameTextForPlayer(playerid, string, 5000, 1);
SafeGivePlayerMoney(playerid,- payout);
SBizzInfo[9][sbTill] += payout;
ExtortionSBiz(9, payout);
}
else
{
format(string, sizeof(string), "~r~-$%d", 150);
GameTextForPlayer(playerid, string, 5000, 1);
SafeGivePlayerMoney(playerid,-150);
SBizzInfo[9][sbTill] += 150;
ExtortionSBiz(9, 150);
}
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
new randphone = 100000 + random(899999); //minimum 1000 max 9999
PlayerInfo[playerid][pPnumber] = randphone;
format(string, sizeof(string), " Mobile Phone Purchased your new 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.");
return 1;
}
}
case 1:
{
// Phone Book
if (PlayerMoney >= 10)
{
if(PlayerInfo[playerid][pTraderPerk] > 0)
{
new skill = 10 / 100;
new price = (skill)*(PlayerInfo[playerid][pTraderPerk]);
new payout = 10 - price;
SafeGivePlayerMoney(playerid,- payout);
SBizzInfo[9][sbTill] += payout;
ExtortionSBiz(9, payout);
GameTextForPlayer(playerid, "~r~-$10", 5000, 1);
}
else
{
SafeGivePlayerMoney(playerid,- 10);
SBizzInfo[9][sbTill] += 10;
ExtortionSBiz(9, 10);
format(string, sizeof(string), "~r~-$%d", 100);
GameTextForPlayer(playerid, string, 5000, 1);
}
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
PlayerInfo[playerid][pPhoneBook] = 1;
format(string, sizeof(string), " Phone Book Purchased you can look up any Players Number !");
SendClientMessage(playerid, COLOR_GRAD4, string);
SendClientMessage(playerid, COLOR_WHITE, "HINT: Type /number <id/name>.");
return 1;
}
}
}
}
SendClientMessage(playerid, COLOR_WHITE, " You don't have the cash for that !");
return 1;
// so the command to start is:
if(strcmp(cmd, "/buy", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if (GetPlayerInterior(playerid) != 10 && dillimore247[playerid] == 0)//centerpoint 24-7
{
SendClientMessage(playerid, COLOR_GRAD2, " You are not in a 24-7 !");
return 1;
}
if(SBizzInfo[9][sbProducts] == 0)
{
GameTextForPlayer(playerid, "~r~Out Of Stock", 5000, 1);
return 1;
}
ShowPlayerDialog(playerid, 19, DIALOG_STYLE_LIST,"[:: 24/7 Shop ::]",":: Cell Phone $150\n:: Phone Book $10","Ok", "Cancel");
return 1;
}
}
Ђdit: if i choose in dialog 1 of these 2 items in the list the server shut down (looks like he does) but why? the compiler brought me no errors or something...