Welcome, Guest |
You have to register before you can post on our site.
|
Forum Statistics |
» Members: 6,499
» Latest member: Ark
» Forum threads: 2,240
» Forum posts: 12,046
Full Statistics
|
Online Users |
There are currently 372 online users. » 0 Member(s) | 369 Guest(s) Bing, Google, Yandex
|
Latest Threads |
Rosalife Gamemode [openMP...
Forum: Gamemodes
Last Post: vactidylee
4 hours ago
» Replies: 5
» Views: 4,520
|
White Screen
Forum: Support
Last Post: Phat202146_real
Yesterday, 02:50 PM
» Replies: 0
» Views: 23
|
Offensive-Core: TDM
Forum: Gamemodes
Last Post: threezhang.cn
Yesterday, 09:54 AM
» Replies: 5
» Views: 934
|
Outstanding Customer Serv...
Forum: Chat
Last Post: va6220902
Yesterday, 07:52 AM
» Replies: 0
» Views: 28
|
New place
Forum: Life
Last Post: sjaardamilly
Yesterday, 06:58 AM
» Replies: 0
» Views: 21
|
How Zhewitra Oral Jelly W...
Forum: General Discussions
Last Post: erctilenovus
2024-11-20, 08:39 AM
» Replies: 0
» Views: 26
|
Cenforce 100 Mg Medicine ...
Forum: Chat
Last Post: ezraallen45ea
2024-11-19, 10:00 AM
» Replies: 0
» Views: 35
|
I get error 021 using y_h...
Forum: Pawn Scripting
Last Post: daniscript18
2024-11-18, 11:34 PM
» Replies: 0
» Views: 40
|
What is the use of Wakler...
Forum: Other
Last Post: allencooper
2024-11-18, 10:37 AM
» Replies: 0
» Views: 24
|
Il reste des français sur...
Forum: French/Fran?ais
Last Post: tysanio
2024-11-18, 05:39 AM
» Replies: 2
» Views: 441
|
|
|
denNorske's SA-MP Query Cache Proxy |
Posted by: denNorske - 2019-04-14, 09:08 AM - Forum: Releases
- Replies (9)
|
|
SA-MP Query Cache Proxy
(Made in python3.7)
Hosted tab servers are facing a massive spam of spoofed UDP packets. The servers simply have no chance to respond to all the fake query requests, and becomes overworked. This ends up with servers not appearing online in the samp client, and if they appear, lots of information don't appear.?
UPDATE: Attack has calmed down (14th of april 2019)
This package will take all the "shit" from the fake packages and respond with a cached response from the samp server. The proxy sends a request to the samp server every few second to cache latest info, which it so sends further to the client that requests it. This shields the samp server and makes it appear normally in everyone's clients. It has been tested on my community and some other servers, and the effect is very noticeable.?
Why python??
Well, python was the only other language besides PAWN and C# that I knew in 2019, and it was the only contribution I could make together with my friend Nick. Now that I also know a bit of C, Javascript and such, but considering it works so well, it's fair enough to say that it may remain using python.
This project is written by frxstrem, nick and me, and everyone's welcome to contribute with better solutions by creating pull requests from separate branches. It has been tested under load of a UDP spam on approximately 3500 pps. It takes up one entire thread of a CPU on a I7-8700k.
Unfortunately, this method will only work on VPS's/VDS's where you have full access to the host system. Python code requires iptables rules to be applied.
How to run the python script in background;?
1: Code: python3 pack-scan.py &
2:Then use: to avoid it closing with the terminal, when you leave the SSH session, or close the terminal.
Disclaimer: I am in no way responsible for misconfigurations or changes done by you. You should understand what iptables do and what my code do before you use it.
Query Mechanism information: Click here
READ ME: https://github.com/dennorske/samp-packet.../README.md
Known issues:?- Under load, script tends to stop working after approximately a week. You can set up a simple bash script to restart it automatically (Fixed March 19th 2021)
- game-state and SACNR monitor queries are not responded correctly, causing graphs to not show or show incorrectly.
Visual of the Query mechanism with the script running (Assuming iptables works correctly) :
LINK TO REPOSITORY/Download https://github.com/dennorske/samp-packet-proxy
Disabling the cache/removing IPtable rules:
In order to remove the rules you've added from IPtables, please replace "-A" or "-I", with "-D" in the commands.
You need to make sure you write the exact same commands, else it will fail. (if you changed ports, use those ports, and replace -A with -D for example)
|
|
|
Burgershot |
Posted by: Mugsy - 2019-04-14, 07:56 AM - Forum: General Discussions
- Replies (18)
|
|
Very good dear community.
I come to ask several questions.
Why Burgershoot? What is the purpose of the project? When will more official information be given?
I think that very soon news will be given and this project has a good path if it is administered well and does not pass up as SAMP.
Sorry for the google translator.
|
|
|
SampBcrypt |
Posted by: SyS - 2019-04-14, 07:41 AM - Forum: Plugins
- Replies (14)
|
|
SampBcrypt
A bcrypt plugin for samp in Rust.
Installation
sampctl
If you are a sampctl user
sampctl p install Sreyas-Sreelal/samp-bcrypt
OR
- Download suitable binary files from releases for your operating system
- Add it your plugins folder
- Add samp_bcrypt to server.cfg or? samp_bcrypt.so (for linux)
- Add samp_bcrypt.inc in includes folder
Building
API
- bcrypt_hash(playerid,callback[],input[],cost)
- playerid - id of the player
- callback[] - callback to execute after hashing
- input[] - string to hash
- cost - work factor (4 - 31)
- Example
PHP Code: main(){ bcrypt_hash(0,"OnPassswordHash","text",12); }
forward OnPassswordHash(playerid); public OnPassswordHash(playerid){ //hashing completed }
- bcrypt_get_hash(dest[],size = sizeof(hash))
- dest[] - string to store hashed data
- size - max size of dest string
- Example
PHP Code: main(){ bcrypt_hash(0,"OnPassswordHash","text",12); }
forward OnPassswordHash(playerid); public OnPassswordHash(playerid){ new dest[250]; bcrypt_get_hash(dest); printf("hash : %s",dest); }
- bcrypt_verify(playerid,callback[],input[],hash[])
- playerid - id of the player
- callback[] - callback to execute after hashing
- input[] - text to compare with hash
- hash[] - hash to compare with text
- Example
PHP Code: main(){ bcrypt_hash(0,"OnPassswordHash","text",12); }
forward OnPassswordHash(playerid); public OnPassswordHash(playerid){ new dest[250]; bcrypt_get_hash(dest); bcrypt_verify(playerid,"OnPassswordVerify","text",dest); }
forward OnPassswordVerify(playerid,bool:success); public OnPassswordVerify(playerid,bool:success){ //success denotes verifying was successful or not if(success){ //verfied } else{ //hash doesn't match with text } }
- bcrypt_set_thread_limit(value)
- value - number of worker threads at a time
- Example
PHP Code: main(){ bcrypt_set_thread_limit(3); }
|
|
|
samp-ai-chatbot |
Posted by: SyS - 2019-04-14, 07:27 AM - Forum: Releases
- Replies (2)
|
|
samp-ai-chatbot
This is? sample ai chatting bot using aiml,flask,pyaiml and pawn for sa-mp.You can add your own aiml files in sampai.aiml to change the bot behaviour.The current aiml files is from AI Foundation?s A.L.I.C.E. bot.
How to use this script?
- Clone this repository
git clone https://www.github.com/sreyas-sreelal/sa...hatbot.git
- Compile the sample bot script in filterscripts folder and add them to your server project
- Install python (i recommend python 3.5 versions) dependencies using pip
pip install flask python-aiml
- Start the web server using the script start.py in web-server folder
python3 start.py
- Start your samp server and use the command /ask <message> to talk with the bot
Dependencies
pawn (to run sample script)
python (to run web server)
Images
Repository
https://github.com/Sreyas-Sreelal/samp-ai-chatbot
|
|
|
matheval |
Posted by: SyS - 2019-04-14, 07:19 AM - Forum: Libraries
- Replies (1)
|
|
matheval
This is a simple library for evaluating mathematical expressions given as string literals.Currently supported operators are:
- - addition?
- - - subtraction?
- ^ - exponential?
- / - division?
- * - product
If you have any issues or improvements to be made in this code just open an issue or pull request
Installation
If you are using sampctl just use
sampctl package install Sreyas-Sreelal/matheval
Otherwise just clone the repository
git clone https://www.github.com/sreyas-sreelal/matheval.git
and add matheval.inc to your pawno/includes folder
Usage
There is only one function
MathEval(expression[])
parameters
- expression[] - mathmatical expression in string literal
returns
- NaN if failed
- if success,value in floating point
For example :
PHP Code: #include<matheval>
main(){
? ?printf("(1)^(32/3)-1 = %f",MathEval("(1)^(32/3)-1"));
}
Testing
To run the tests:
sampctl package run
Dependencies
Repository
https://github.com/Sreyas-Sreelal/matheval
|
|
|
PawnScraper |
Posted by: SyS - 2019-04-14, 06:46 AM - Forum: Plugins
- No Replies
|
|
PawnScraper
Installing
Thanks to Southclaws,plugin installation is now much easier with sampctl
PHP Code: sampctl p install Sreyas-Sreelal/pawn-scraper
OR
- Download suitable binary files from releases for your operating system
- Add it your plugins folder
- Add PawnScraper to server.cfg or? PawnScraper.so (for linux)
- Add pawnscraper.inc in includes folder
Building
- Clone the repo
PHP Code: git clone https://github.com/Sreyas-Sreelal/pawn-scraper.git
- Compile the plugin using nightly compiler
- Windows
PHP Code: cargo 鸨↶i686-pc-windows-msvc build --release
- Linux
PHP Code: cargo 鸨↶i686-unknown-linux-gnu build --release
API
- ParseHtmlDocument(document[])]
- Params
- document[] - string of html document
- Returns
- Html document instance id
- if failed to parse document INVALID_HTML_DOC is returned
- Example Usage
PHP Code: new Html:doc = ParseHtmlDocument("\
<!DOCTYPE html>\
<meta charset=\"utf-8\">\
<title>Hello, world!</title>\
<h1 class=\"foo\">Hello, <i>world!</i></h1>\
");
ASSERT(doc != INVALID_HTML_DOC);
DeleteHtml(doc);
- ResponseParseHtml(Response:id)
- Params
- id - Http response id returned from HttpGet
- Returns
- Html document instance id
- if failed to parse document INVALID_HTML_DOC is returned
- Example Usage
PHP Code: new Response:response = HttpGet("https://www.sa-mp.com");
new Html:doc = ResponseParseHtml(response);
ASSERT(doc != INVALID_HTML_DOC);
DeleteHtml(doc);
- HttpGet(url[],Header:headerid=INVALID_HEADER)
- Params
- url[] - Url of a website
- header - id of header object created using CreateHeader
- Returns
- Response id if successful
- if failed to INVALID_HTTP_RESPONSE is returned
- Example Usage
PHP Code: new Response:response = HttpGet("https://www.sa-mp.com");
ASSERT(response != INVALID_HTTP_RESPONSE);
DeleteResponse(response);
- HttpGetThreaded(playerid,callback[],url[],Header:headerid=INVALID_HEADER)
- Params
- playerid - id of the player
- callback[] - name of the callback function to handle the response.
- url[] - Url of a website
- header - id of header object created using CreateHeader
- Example Usage
PHP Code: HttpGetThreaded(0,"MyHandler","https://sa-mp.com");
//********
forward MyHandler(playerid,Response:responseid);
public MyHandler(playerid,Response:responseid){
? ? ASSERT(responseid != INVALID_HTTP_RESPONSE);
? ? DeleteResponse(responseid);
}
- ParseSelector(string[])
- Params
- Returns
- Selector instance id if successful
- if failed to INVALID_SELECTOR is returned
- Example Usage
PHP Code: new Selector:selector = ParseSelector("h1 .foo");
ASSERT(selector != INVALID_SELECTOR);
DeleteSelector(selector);
- CreateHeader(?)
- Params
- key,value pairs of String type
- Returns
- Header instance id if successful
- if failed to INVALID_HEADER is returned
- Example Usage
PHP Code: new Header:header = CreateHeader(
? ? "User-Agent","Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36"
);
ASSERT(header != INVALID_HEADER);
new Response:response = HttpGet("https://sa-mp.com/",header);
ASSERT(response != INVALID_HTTP_RESPONSE);
ASSERT(DeleteHeader(header) == 1);
- GetNthElementName(Html:docid,Selector:selectorid,idx,string[],size = sizeof(string))
- Params
- docid - Html instance id
- selectorid - CSS selector instance id
- idx - the n?th occurence of element in the document (starts from 0)
- string[] - element name is stored
- size - sizeof string
- Returns
- 1 if successful
- 0 if failed
- Example Usage
PHP Code: new Html:doc = ParseHtmlDocument("\
? ? <!DOCTYPE html>\
? ? <meta charset=\"utf-8\">\
? ? <title>Hello, world!</title>\
? ? <h1 class=\"foo\">Hello, <i>world!</i></h1>\
");
ASSERT(doc != INVALID_HTML_DOC);
new Selector:selector = ParseSelector("i");
ASSERT(selector != INVALID_SELECTOR);
new i= -1,element_name[10];
while(GetNthElementName(doc,selector,,element_name)!=0){
? ? ASSERT(strcmp(element_name,"i") == 0);
}
DeleteSelector(selector);
DeleteHtml(doc);
- GetNthElementText(Html:docid,Selector:selectorid,idx,string[],size = sizeof(string))
- Params
- docid - Html instance id
- selectorid - CSS selector instance id
- idx - the n?th occurence of element in the document (starts from 0)
- string[] - element name
- size - sizeof string
- Returns
- 1 if successful
- 0 if failed
- Example Usage
PHP Code: new Html:doc = ParseHtmlDocument("\
? ? <!DOCTYPE html>\
? ? <meta charset=\"utf-8\">\
? ? <title>Hello, world!</title>\
? ? <h1 class=\"foo\">Hello, <i>world!</i></h1>\
");
ASSERT(doc != INVALID_HTML_DOC);
new Selector:selector = ParseSelector("h1.foo");
ASSERT(selector != INVALID_SELECTOR);
new element_text[20];
ASSERT(GetNthElementText(doc,selector,0,element_text) == 1);
new check = strcmp(element_text,("Hello, world!"));
ASSERT(check == 0);
DeleteSelector(selector);
DeleteHtml(doc);
- GetNthElementAttrVal(Html:docid,Selector:selectorid,idx,attribute[],string[],size = sizeof(string))
- Params
- docid - Html instance id
- selectorid - CSS selector instance id
- idx - the n?th occurence of element in the document (starts from 0)
- attribute[] - the attribute of element
- string[] - element name
- size - sizeof string
- Returns
- 1 if successful
- 0 if failed
- Example Usage
PHP Code: new Html:doc = ParseHtmlDocument("\
<!DOCTYPE html>\
<meta charset=\"utf-8\">\
<title>Hello, world!</title>\
<h1 class=\"foo\">Hello, <i>world!</i></h1>\
");
ASSERT(doc != INVALID_HTML_DOC);
new Selector:selector = ParseSelector("h1");
ASSERT(selector != INVALID_SELECTOR);
new element_attribute[20];
ASSERT(GetNthElementAttrVal(doc,selector,0,"class",element_attribute) == 1);
new check = strcmp(element_attribute,("foo"));
ASSERT(check == 0);
DeleteSelector(selector);
DeleteHtml(doc);
- DeleteHtml(Html:id)
- Params
- id - html instance to be deleted
- Returns
- 1 if successful
- 0 if failed
- DeleteSelector(Selector:id)
- Params
- id - selector instance to be deleted
- Returns
- 1 if successful
- 0 if failed
- DeleteResponse(Html:id)
- Params
- id - response instance to be deleted
- Returns
- 1 if successful
- 0 if failed
- DeleteHeader(Header:id)
- Params
- id - header instance to be deleted
- Returns
- 1 if successful
- 0 if failed
Example Usage
A small example to fetch all links in wiki.sa-mp.com
PHP Code: new Response:response = HttpGet("https://wiki.sa-mp.com");
if(response == INVALID_HTTP_RESPONSE){
printf("HTTP ERROR");
return;
}
new Html:html = ResponseParseHtml(response);
if(html == INVALID_HTML_DOC){
DeleteResponse(response);
return;
}
new Selector:selector = ParseSelector("a");
if(selector == INVALID_SELECTOR){
DeleteResponse(response);
DeleteHtml(html);
return;
}
new str[500],i;
while(GetNthElementAttrVal(html,selector,i,"href",str)){
printf("%s",str);
;
}
//delete created objects after the usage..
DeleteHtml(html);
DeleteResponse(response);
DeleteSelector(selector);
The same above with threaded http call would be
PHP Code: HttpGetThreaded(0,"MyHandler","https://wiki.sa-mp.com");
//...
forward MyHandler(playerid,Response:responseid);
public MyHandler(playerid,Response:responseid){
if(responseid == INVALID_HTTP_RESPONSE){
printf("HTTP ERROR");
return 0;
}
new Html:html = ResponseParseHtml(responseid);
if(html == INVALID_HTML_DOC){
DeleteResponse(response);
return 0;
}
new Selector:selector = ParseSelector("a");
if(selector == INVALID_SELECTOR){
DeleteResponse(response);
DeleteHtml(html);
return 0;
}
new str[500],i;
while(GetNthElementAttrVal(html,selector,i,"href",str)){
printf("%s",str);
;
}
DeleteHtml(html);
Delete(response);
DeleteSelector(selector);
return 1;
}
More examples can be found in examples
Repository
https://github.com/Sreyas-Sreelal/pawn-scraper
Note
The plugin is in primary stage and more tests and features needed to be added.I?m open to any kind of contribution, just open a pull request if you have anything to improve or add new features.
Special thanks
|
|
|
Telegram Connector |
Posted by: SyS - 2019-04-14, 06:38 AM - Forum: Plugins
- Replies (9)
|
|
TgConnector
A telegram connector plugin that helps to interact with telgram bots through SA-MP.
Installing
If you are a sampctl user
PHP Code: sampctl p install Sreyas-Sreelal/tgconnector
OR
- Download suitable binary files from releases for your operating system
- Add it your plugins folder
- Add tgconnector to server.cfg or? tgconnector.so (for linux)
- Add tgconnector.inc in includes folder
Building
- Clone the repo
PHP Code: git clone https://github.com/sreyas-sreelal/tgconnector.git
- Use makefile to compile and test
- Setup testing environment
- To build release version
- Run tests
Example
A basic bot
PHP Code: #include<a_samp>
#include<tgconnector>
#include<zcmd>
#define CHAT_ID (TGChatId:"YOUR_CHAT_ID_HERE")
new TGBot:g_bot;
main() {
//Store bot token in SAMP_TG_BOT environment variable and connect from it
g_bot = TGConnectFromEnv("SAMP_TG_BOT");
if(g_bot != INVALID_BOT_ID) {
printf("bot connected successfully!");
} else {
printf("Error: bot couldn't connect");
}
}
public OnTGMessage(TGBot:bot,TGUser:fromid,TGMessage:messageid) {
if(g_bot != bot){
return 1;
}
new?
message[50],
username[24],
chatname[56],
server_msg[128];
TGCacheGetMessage(message);
TGCacheGetUserName(username);
TGCacheGetChatName(chatname);
format(server_msg,128,"[%s] %s(%d): %s",chatname,username,_:fromid,message);
SendClientMessageToAll(-1,server_msg);
return 1;
}
public OnTGUserJoined(TGBot:bot,TGUser:userid) {
new?
TGChatId:chatid[15],
username[24],
chatname[56],
server_msg[128];
? ? //Retrive data stored in current context
TGCacheGetUserName(username);
TGCacheGetChatId(chatid);
TGCacheGetChatName(chatname);
format(server_msg,128,"User %s(%d) joined %s(%s)",username,_:userid,chatname,_:chatid);
SendClientMessageToAll(-1,server_msg);
return 1;
}
public OnTGUserLeft(TGBot:bot,TGUser:userid) {
new?
TGChatId:chatid[15],
username[24],
chatname[56],
server_msg[128];
TGCacheGetUserName(username);
TGCacheGetChatId(chatid);
TGCacheGetChatName(chatname);
format(server_msg,128,"User %s(%d) left %s(%s)",username,_:userid,chatname,_:chatid);
SendClientMessageToAll(-1,server_msg);
return 1;
}
CMD:sendtgmessage(playerid,params[]) {
TGSendMessage(g_bot,CHAT_ID,params);
return 1;
}
Notes
This plugin is still in WIP and more tests need to be done.If you find any bugs or have anything to contribute feel free to open an issue or pull request on github.
Also be sure to not to share your bot token with anyone it's recommended to store it inside a environment variable.
Repository
Source: https://github.com/Sreyas-Sreelal/tgconnector
Releases: https://github.com/Sreyas-Sreelal/tgconnector/releases
Wiki: https://github.com/Sreyas-Sreelal/tgconnector/wiki (Not complete yet)
|
|
|
|