08.07.2013, 21:49
I'm writing a script where I need a variable only to be changed at 22:00, and that variable decides what a store can sell. This way isn't working:
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid==753 && response)
{
ShowPlayerDialog(playerid, 754, DIALOG_STYLE_LIST, "What would you like to do?","Sell this item I'm holding\nTrade this item for a new item\nPawn this item\nDonate this item\nBrowse what's for sale\nHelp and Info", "Continue", "Leave");
return 1;
}
if(dialogid==754 && response)
{
switch(listitem)
{
case 0:
{
return 1;
}
case 1:
{
return 1;
}
case 2:
{
return 1;
}
case 3:
{
ShowPlayerDialog(playerid, 770, DIALOG_STYLE_MSGBOX, "Donating your weapon...","Are you sure you want to donate this?","Yes","No");
return 1;
}
case 4:
{
new Hour, Minute, Second;
gettime(Hour, Minute, Second);
if (Hour==22)
{
new stor;
stor=random(4);
return 1;
}
if (stor==0)
{
ShowPlayerDialog(playerid, 762, DIALOG_STYLE_LIST, "What would you like to purchase?","Stuff", "Continue", "Leave");
return 1;
}
else if (stor==1)
{
ShowPlayerDialog(playerid, 763, DIALOG_STYLE_LIST, "What would you like to purchase?","Stuff2", "Continue", "Leave");
return 1;
}
else if (stor==2)
{
ShowPlayerDialog(playerid, 764, DIALOG_STYLE_LIST, "What would you like to purchase?","Stuff3", "Continue", "Leave");
return 1;
}
else if (stor==3)
{
ShowPlayerDialog(playerid, 765, DIALOG_STYLE_LIST, "What would you like to purchase?","Stuff4", "Continue", "Leave");
return 1;
}
else if (stor==4)
{
ShowPlayerDialog(playerid, 766, DIALOG_STYLE_LIST, "What would you like to purchase?","Stuff5", "Continue", "Leave");
return 1;
}
else
{
ShowPlayerDialog(playerid, 767, DIALOG_STYLE_MSGBOX, "Inventory is empty...","There is nothing for sale right now, please come back after 22:00.","Continue", "Leave");
return 1;
}
}