PHP код:
#include <a_samp>
#define SHOP_MENU 0
new init;
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/store", cmdtext, true, 10) == 0)
{
init = GetPlayerInterior(playerid);
if(IsPlayerInRangeOfPoint(playerid,4.0,x,y,z) && init == [24/7 interior id])
{
ShowPlayerDialog(playerid,SHOP_MENU,DIALOG_STYLE_LIST,"Store","Beer $50\nCiga $20","Buy","Cancel");//here you add item and price using \n[item]_[price]
return 1;
}
else
{
SendClientMessage(playerid,0xFF0000FF,"You aren't in 24/7 store!");
}
return 1;
}
return 0;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == SHOP_MENU)
{
if(!response)
{
SendClientMessage(playerid,0xFF0000FF,"You have canceled store menu");
}
if(response)
{
switch(listitem)
{
case 0:
{
if(GetPlayerMoney(playerid) < 50)
{
SendClientMessage(playerid,0xFF0000FF,"You don't have enough money!");
return 1;
}
else
{
GivePlayerMoney(playerid, -50);//Change price for Beer if you want
SendClientMessage(playerid,0x00FF00FF,"You have bought beer for $50.");
your variable that player now has beer
}
}
case 1:
{
if(GetPlayerMoney(playerid) < 20);
{
SendClientMessage(playerid,0xFF0000FF,"You don't have enough money!");
return 1;
}
else
{
GivePlayerMoney(playerid, -20);// Also change price of cigar here
SendClientMessage(playerid,0x00FF00FF,"You have bought ciga for $20.");
// Here insert your variable that player has
}
}
}
}
}
return 1;
}
Here it is. Just replace what I said in script comment lines