Outro★ 1atualizado jul. de 2023Sem licença
Abrir no GitHubEste repositório não tem arquivo de licença. Ele é público para leitura, mas isso sozinho não dá permissão para reutilizar.
README.md
Introduction
Dependencies
- None
Installation
- Place the
API.amxfile in your filterscripts folder. - Add on server startup in
server.cfg
2.1 filterscripts API
- Done
Getting started
new const API_KEY[20];
public OnGamemodeInit()
{
CallRemoteFunction("GetApiKey", ""); // Generate token
return 1;
}
forward OnApiGenerateToken(const token[]); // Receive token
public OnApiGenerateToken(const token[])
{
format(API_KEY, sizeof API_KEY, token);
SetTimer("ApiTimer", 5000, true); // Every 5 seconds check if there are pending orders
return 1;
}
forward ApiTimer();
public ApiTimer()
{
CallRemoteFunction("CheckApiRequest", "s", API_KEY);
return 1;
}
POST /HTTP/1.1
Host: api/Gateway/index.php
Content-Type: application/x-www-form-urlencoded
Content-Length: 40
token=mytoken&funcname=rcon password 123
POST /HTTP/1.1
Host: api/Gateway/index.php
Content-Type: application/x-www-form-urlencoded
Content-Length: 29
token=mytoken&funcname=myfunc
Content-Length: 41
token=mytoken&funcname=myfunc¶ms=[20]
Content-Length: 92
token=mytoken&data=Lorem Ipsum is simply dummy text of the printing and typesetting industry
forward OnApiReceiveRemoteData(const data[], data_size);
public OnApiReceiveRemoteData(const data[], data_size)
{
printf("OnApiReceiveRemoteData | %s - %d", data, data_size);
return 1;
}
Error Codes
1..6 - WHILE RECEIVING PACKET / WHILE GENERATING TOKEN (API request error)
200 - token (INVALID / EXPIRED TOKEN)
200 - token (INVALID TOKEN)
200 - id (REQUEST ID NOT EXITS / ALREADY SEND TO SERVER)
200 - empty (REQUEST'S QUEUE IS EMPTY)
200 - params (API REQUEST FUNCTION PARAMETERS ERROR)
400 - bad request's (API REQUEST SYNTAX ERROR)
Contact & More
apiremote-controlsa-mpsa-mp-serversampsanandreasmultiplayer
Esta página é montada com o que o GitHub publica sobre o repositório. O samp.directory não hospeda o código. Avisar de um problema com esta página