pawn Код:
#include <a_samp>
#define HELM_DIALOG 123456
//define the dialog ID here so it won't inflict with other dialogs on your gamemode.
public OnPlayerCommandText(playerid, cmdtext[])
{
if(!strcmp(cmdtext, "/helm", true)) //Using strcmp because i don't know your command processor, should be avoided anyway.
{
ShowPlayerDialog(playerid,HELM_DIALOG,DIALOG_STYLE_LIST,"Helmet Dialog","Attach Helmet\nDetach Helmet","Okay","Close"); //showing dialog.
return 1;
}
return 0;
}
public OnDialogResponse(playerid,dialogid,response,listitem,inputtext[])
{
if(dialogid == HELM_DIALOG)
{
if(response)
{
if ( listitem == 0)//List option 1(Attach Helmet)
{
SetPlayerAttachedObject( playerid, 0, 18645, 2, 0.050000, 0.019999, 0.000000, 100.000000, 100.000000, 0.000000, 1.000000, 1.000000, 1.000000 ); //attaching the object.
SendClientMessage(playerid,-1,"{FF0000}You have successfully attached your helmet!");//just sending an informational message.
return 1;
}
if ( listitem == 1)//List option 2(Detach Helmet)
{
RemovePlayerAttachedObject(playerid, 0); //detaching the object.
SendClientMessage(playerid,-1,"{FF0000}You have successfully detached your helmet!");//just sending an informational message.
return 1;
}
}
}
return 1;
}