Welcome, Guest |
You have to register before you can post on our site.
|
Forum Statistics |
» Members: 5,747
» Latest member: gianh5781
» Forum threads: 2,157
» Forum posts: 11,987
Full Statistics
|
Online Users |
There are currently 190 online users. » 0 Member(s) | 187 Guest(s) Bing, Google, Yandex
|
|
|
Task-based (async) dialog handling with PawnPlus |
Posted by: Graber - 2019-04-13, 03:43 PM - Forum: Libraries
- Replies (6)
|
|
samp-async-dialogs
Async dialog handling with PawnPlus tasks.
Installation
Simply install to your project:
Code: sampctl package install AGraber/samp-async-dialogs
Include in your code and begin using the library:
Code: #include <async-dialogs>
It is recommended that you set a PawnPlus version explicitely on your pawn.json (preferibly the latest) to avoid always downloading the latest one.
If you don?t use sampctl, just download the async-dialogs.inc include and drop it to your includes/ folder, and then download the PawnPlus plugin and include from here.
While you?re on it and if you don?t use PawnPlus yet, you should check it out!
Usage
This include provides one single function
Code: AwaitAsyncDialog(playerid, dialog_response[e_DIALOG_RESPONSE_INFO], style, const caption[], const info[], const button1[], const button2[])
This will show the dialog and await for the response, which will pause the current script?s execution and return the yielded value to the last public function (or 0 if it wasn?t set). When it?s responded to, the response details will be inside the dialog_response[e_DIALOG_RESPONSE_INFO] array. If another dialog gets shown while awaiting, the Task will be discarded with any following code that was to be resumed.
Example command:
Code: CMD:asyncdialog(playerid, params[])
{
??? task_yield(1);
??? new dialog_response[e_DIALOG_RESPONSE_INFO];
??? AwaitAsyncDialog(playerid, dialog_response, DIALOG_STYLE_LIST, "Example dialog", "This is listitem 0\nAnd this is one\nShow example nested dialog", "ok", "no");
??? if(dialog_response[E_DIALOG_RESPONSE_Response])
??? {
??????? if(dialog_response[E_DIALOG_RESPONSE_Listitem] == 2)
??????? {
??????????? new other_dialog_response[e_DIALOG_RESPONSE_INFO];
??????????? AwaitAsyncDialog(playerid, other_dialog_response, DIALOG_STYLE_MSGBOX, "Example nested dialog", "You will recieve a message\nwhichever your response is", "OK", "Yes");
??????????? SendClientMessage(playerid, COLOR_WHITE, "You responded something to the example dialog");
??????? }
??????? else
??????? {
??????????? SendClientMessageEx(playerid, COLOR_WHITE, "Recieved: listitem = %d | inputtext = %s", dialog_response[E_DIALOG_RESPONSE_Listitem], dialog_response[E_DIALOG_RESPONSE_InputText]);
??????? }
??? }
??? else
??? {
??????? SendClientMessage(playerid, COLOR_WHITE, "Bye!");
??? }
}
Thanks
- IllidanS4 for PawnPlus, which allowing this and even more awesome stuff
- TommyB for helping me test it out on a real environment
|
|
|
Daily dogs appreciation thread |
Posted by: cuddlypanda - 2019-04-13, 03:09 PM - Forum: Chat
- Replies (40)
|
|
Hello, I share dog pics daily, thanks.
You can share any dog pics you want, yours or from social media!
(There would be?a separate topic for non-dog pics so please don't post them here! :p)
|
|
|
Function overloading? |
Posted by: mr_sacrimoni - 2019-04-13, 06:31 AM - Forum: Pawn Scripting
- Replies (2)
|
|
I've seen a tutorial on function overloading but that just seems kind of bad.?
I'm creating a function to manipulate entity data (players, houses, businesses, etc.). Since I plan to generate sql queries inside the function I wanted to have the ability of manipulating with player data if the player is online or offline.
My question is, is there any possibility of creating function overloading with the first parameter either being int (playerid) and string (playername). I guess it creates a problem with one being variable and other an array.?
I have been searching forums, github, pawn documentation but still nothing. I figured if anybody can help me it must be Y_Less.
|
|
|
Media Question |
Posted by: Bluman - 2019-04-13, 12:23 AM - Forum: Chat
- Replies (5)
|
|
Hello Grand Theft Auto Gods and Goddesses. Are we allowed to post youtube videos here or is that illegal?
I don't want to be banned for sharing a vevo channel?or samp dm video from YouTube!
|
|
|
TFA_SAMP - 1st two-factor authentication method for SA-MP. |
Posted by: GiamPy - 2019-04-12, 09:37 PM - Forum: Libraries
- Replies (8)
|
|
TFA_SAMP - 1st two-factor authentication method for SA-MP.
A huge thanks to Authy (https://www.authy.com/) for providing the web APIs.
Include release under GPL v2 OSL (open source license) - click here for more information.
Part of the include is made in PHP.
Hello everyone.
Recently I was thinking of a new include to release, and I thought about a two-factor authentication method for SA-MP, something like it has never existed before. This include does not directly provide the authentication method, it is just a way to communicate with the service that provides so, which in this case is Authy.
Authy provides also free-plans for development or fairly small communities.
Visit https://www.authy.com/ for more information.
If you don't know what a two-factor authentication method is, read this page.
However, here's a short description.
Quote:Multi-factor authentication (also MFA, Two-factor authentication, TFA, T-FA or 2FA) is an approach to authentication which requires the presentation of two or more of the three authentication factors: a knowledge factor ("something only the user knows"), a possession factor ("something only the user has"), and an inherence factor ("something only the user is"). After presentation, each factor must be validated by the other party for authentication to occur.
This include allows you to communicate with API requests to Authy's servers and to use your cellphone as second factor, which is the possession factor. In order to be it two-factor, thus increasing the account' security, you must ask for the password and the token sent via SMS or taken by the phone application.
So, what is Authy? Authy is what gives us the API to communicate with the server and to send the SMS / verify the token taken by your phone.
If you are worried about security, the API requests through the production method are sent through HTTPS requests, and all the information are not saved in any TFA_SAMP database but in Authy's databases which are completely safe and secure.
Available Functions
- TFASAMP_prepareConnection(host[], password[], api_key[], type[] = "production", bool:tfa_debug = false)
- TFASAMP_createUser(playerid, email[], cellphone[], area_code[] = "1")
- TFASAMP_verifyToken(playerid, user_id, token[], bool: force = true)
- TFASAMP_setPlayerUserID(playerid, userid)
- TFASAMP_getPlayerUserID(playerid)
Available Callbacks
- TFASAMP_OnTokenVerify(playerid, result)
Documentation
You may find here the updated functions documentation.
Example
You may find an example of the include here.
|
|
|
|