13.02.2011, 15:49
Next time search in wiki
pawn Код:
if(!strcmp(cmdtext, "/chat", true))
{
ShowPlayerDialog(playerid, 3, DIALOG_STYLE_INPUT, "Chat", "Type your chat input here.", "Submit", "Cancel");
return 1;
}
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(response)// Checking if they pressed the first button, if so continue:
{
switch(dialogid)//if your using only one dialog this isn't needed but you never know.
{
case 1:// Our dialog
{
switch(listitem)// Checking which listitem was chosen
{
case 0: // The first item in the list
{
if(GetPlayerMoney(playerid) < 1) return SendClientMessage(playerid, 0xFFFFFF, "You don't have enough cash.");
GivePlayerMoney(playerid, -1);
SetPlayerSpecialAction(playerid, SPECIAL_ACTION_DRINK_SPRUNK);
}
case 1: // The second item in the list
{
if(GetPlayerMoney(playerid) < 2) return SendClientMessage(playerid, 0xFFFFFF, "You don't have enough cash.");
GivePlayerMoney(playerid, -2);
SetPlayerSpecialAction(playerid, SPECIAL_ACTION_DRINK_BEER);
}
case 2: // The third item in the list
{
if(GetPlayerMoney(playerid) < 3) return SendClientMessage(playerid, 0xFFFFFF, "You don't have enough cash.");
GivePlayerMoney(playerid, -3);
SetPlayerSpecialAction(playerid, SPECIAL_ACTION_DRINK_WINE);
}
}
}
case 2:// The new dialog
{
ApplyAnimation(playerid,"BEACH","Lay_Bac_Loop",4.1,1,1,1,1,10);// This will let you "relax" for 10 seconds.
}
// Here we add new things...
case 3:
{
if(strlen(inputtext) > 0)
{
SendPlayerMessageToAll(playerid, inputtext);
}
else
{
SendClientMessage(playerid,0xFFFFFFAA,"Your input was too short.");
}
}
// Until here.
}
}
return 1;
}