Action button to confirm for SAMP
Подтверждение действий по нажатию кнопки.
Для подтверждения нажмите Y или для отмены N
Include in your code and begin using the library:
#include <action-button>
CMD:test(playerid, params[])
{
new inviteid;
if(sscanf(params, "d", inviteid))
return SendClientMessage(playerid, -1, "/test [ID]");
if(!IsPlayerConnected(inviteid))
return SendClientMessage(playerid,-1, "INVALID");
CreateActionButton("give_flowers", playerid, inviteid, "You offered flowers", "You were offered flowers", KEY_YES, KEY_NO);
return 1;
}
ActionButton:give_flowers(playerid, inviteid, response)
{
if(!response) return 1;
GivePlayerWeapon(playerid, 14, 1);
return 1;
}
CreateActionButton(const function[], playerid, inviteid, text_creator[] = "", text_invited[] = "", accept_button = KEY_YES, decline_button = KEY_NO, dialog_caption[] = "", dialog_button1[] = "", dialog_button2[] = "")
Create action button
function[]
- Function nameplayerid
- The ID of the playerinviteid
- Invited Player IDtext_creator[]
- Text in chattext_invited[]
- Text in chat for inviteeaccept_button
- Accept buttondecline_button
- Decline buttondialog_caption[]
- Use dialog. The title at the top of the dialogdialog_button1[]
- Dialog button 1dialog_button2[]
- Dialog button 2- Returns (0) on failure or (1) on success
Cancel invitation
playerid
- The ID of the player- Returns (0) on failure or (1) on success
Get invited player ID
playerid
- The ID of the player- Returns (
INVALID_PLAYER_ID
) on failure or (ID
) on success
Set timeout time
playerid
- The ID of the playertime
- Time
Get timeout time
playerid
- The ID of the player- Returns The time in seconds
Allow me to invite myself
playerid
- The ID of the playerbool:enable
- Status
Set the distance to the player
playerid
- The ID of the playerFloat:distance
- Distance
#define AB_INVITE_TIMEOUT_TIME 30
#define AB_MAX_DISTANCE 3.0
#define AB_DIALOG_ID 16743
#define AB_COLOR_MESSAGE 0xFFFFFFAA
#define AB_COLOR_MESSAGE_INFO 0x269BD8AA
#define AB_COLOR_ERROR_MESSAGE 0xAFAFAFAA