[FilterScript] → Dynamic Rules ← Using HTTP!
#1

Dynamic Rules
Introduction :
Have you ever thought of updating your rules easily without that finding the dialog and editing stuff. Well, now you can update your rules from just one file. This is a little code through which you can show your rules dynamically from a file use HTTP() function.

Concept :
Simply, as provided a HTTP function, we can retrieve data from a file which is hosted completely somewhere else.

Screenshots :
There's nothing to show in screenshots, everything is clear.

Installation :
1. Create a rules.txt file and write everything you want to show in the dialog.
2. Now, upload the rules.txt to your host.
3. Open up the script and change the
pawn Code:
#define URLPath ""
according to your path of the uploaded 'rules.txt' file.
4. And you're done. Load the script.

NOTE: You must have zcmd include to use this.

Download :
pawn Code:
#include <a_samp>
#include <a_http>
#include <zcmd>

#define FILTERSCRIPT
#define rID 1
#define rFID 2
#define URLPath "www.mortalgaming.com/rules.txt"

CMD:rules ( playerid , params [] )
{
    HTTP ( playerid , HTTP_GET , URLPath , "" , "HTTPResponse" ) ;
    return 1 ;
}

forward HTTPResponse ( playerid , response_code, data[] ) ;
public HTTPResponse ( playerid , response_code , data[] )
{
    new Str [ 128 ] ;
    if ( response_code == 200 )
    {
        format ( Str , 128 , "%s" , data ) ;
        ShowPlayerDialog ( playerid , rID , DIALOG_STYLE_MSGBOX , "Rules" , Str , "Close", "" ) ;
    }
    else
    {
        ShowPlayerDialog ( playerid , rFID , DIALOG_STYLE_MSGBOX , "Error" , "Error in getting rules" , "Close" , "" ) ;
    }
}
Credits :
- ME! ^_^
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)