if (strcmp("/cigarette", cmdtext, true, 10) == 0)
{
SetPlayerSpecialAction(playerid,SPECIAL_ACTION_SMOKE_CIGGY);
SendClientMessage(playerid, COLOR_GREY, "You are smoking now!");
SendClientMessage(playerid, COLOR_GREY, "To stop smoking pull ENTER.");
return 1;
}
return 0;
}
|
go on wiki, search the simple menu tutorial and how to create a dialog tutorial, everything will be in it ;P
|
if(!strcmp(cmdtext, "/drinks", true))
{
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "What is it that you want?", "Sprunk ($1)\nBeer ($2)\nWine ($3)", "Purchase", "Cancel");
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(response)//they pressed the first button
{
switch(dialogid)//if your using only one dialog this isn't needed but you never know.
{
case 1://our dialog
{
switch(listitem)//wich listitem is 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:
{
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:
{
if(GetPlayerMoney(playerid) < 3) return SendClientMessage(playerid, 0xFFFFFF, "You don't have enough cash.");
GivePlayerMoney(playerid, -3);
SetPlayerSpecialAction(playerid, SPECIAL_ACTION_DRINK_WINE);
}
}
}
}
}
return 1;
}
|
IfPlayerIsInRangeOfPoint or if you want /drinks when enter a pickup OnPlayerEnterPickup or sumthing.
|
if(!strcmp(cmdtext, "/drinks", true))
{
if(IsPlayerInRangeOfPoint(playerid, 10, X,Y,Z)) // replace X,Y,Z, with the co-ordinates u want
{
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "What is it that you want?", "Sprunk ($1)\nBeer ($2)\nWine ($3)", "Purchase", "Cancel");
}
return 1;
}