27.05.2010, 02:20
pawn Код:
new CP1;
#define FOOD 74832
public OnGameModeInit()
{
CP1 = CreateDynamicCP(...)
return 1;
}
public OnPlayerEnterDynamicCP(playerid, checkpointid)
{
if(checkpointid == CP1)
{
ShowPlayerDialog(playerid, FOOD, DIALOG_STYLE_LIST, "Food Shop", "Food 1\nFood 2\nFood 3", "Buy", "Cancel");
}
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == FOOD && response)
{
switch(listitem)
{
case 0:
{
new Float:health;
GetPlayerHealth(playerid, health);
SetPlayerHealth(playerid, health + 25);
SendClientMessage(playerid, COLOR_GREEN, "FOOD SHOP : You have succesfully bought Food 1");
}
case 1:
{
new Float:health;
GetPlayerHealth(playerid, health);
SetPlayerHealth(playerid, health + 50);
SendClientMessage(playerid, COLOR_GREEN, "FOOD SHOP : You have succesfully bought Food 2");
}
case 2:
{
new Float:health;
GetPlayerHealth(playerid, health);
SetPlayerHealth(playerid, health + 75);
SendClientMessage(playerid, COLOR_GREEN, "FOOD SHOP : You have succesfully bought Food 3");
}
}
}
return 1;
}