[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
#2

Nice i liked your work.
Reply
#3

Quote:
Originally Posted by RaoAbhi
View Post
Nice i liked your work.
Thank you.
Reply
#4

nice works Ronaldo.
Reply
#5

Quote:
Originally Posted by Devilxz97
View Post
nice works Ronaldo.
Thank you again ^^
Reply
#6

Nice script !
Reply
#7

very nice, thanks
Reply
#8

"a_http.inc" is embedded in "a_samp.inc", so there's no need to include it separately.
Reply
#9

Why would you use http if you can just use the file i/o? It's faster and simpler.
Reply
#10

Quote:
Originally Posted by X_Boy
View Post
Nice script !
Quote:
Originally Posted by Edvin
View Post
very nice, thanks
Thank you.

Quote:
Originally Posted by Xtreme_playa
View Post
"a_http.inc" is embedded in "a_samp.inc", so there's no need to include it separately.
When removed -
pawn Code:
error 017: undefined symbol "HTTP"
Quote:
Originally Posted by king_hual
View Post
Why would you use http if you can just use the file i/o? It's faster and simpler.
Just for this uniqueness. And I found that this function is not in frequent use.
Reply
#11

NOTE: You must have zcmd include to use this.

Why?
Reply
#12

Quote:
Originally Posted by Rapgangsta
View Post
NOTE: You must have zcmd include to use this.

Why?
That\'s because, the command /rules in made in ZCMD command processor. You may change it to fit your needs.
Reply
#13

Quote:
Originally Posted by Ronaldo_raul™
View Post
Thank you.




When removed -
pawn Code:
error 017: undefined symbol "HTTP"
Oh well ! You can embed a_http.inc manually too, just open a_samp.inc and add #include<a_http> under all other embedded includes and save it.
Reply
#14

Quote:
Originally Posted by Xtreme_playa
View Post
Oh well ! You can embed a_http.inc manually too, just open a_samp.inc and add #include<a_http> under all other embedded includes and save it.
Not everyone have done that. So, publicly it is as it should be.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)