sampprojects / open-samp-api Goto Github PK
View Code? Open in Web Editor NEWAn open source API for GTA SA:MP
License: GNU Lesser General Public License v3.0
An open source API for GTA SA:MP
License: GNU Lesser General Public License v3.0
I'm a beginner in C ++, I wanted to create a simple program, without the api, without dlls and everything. I analyzed IsChatOpen, AddChatMessage, SendChat and could not find these addresses.
Hi.
I'm a C++/Delphi programmer.
I use the Open-SAMP-API dll in one of my applications.
I'm trying to get the total number of players. Some servers use it to create events at specific time intervals (more often when there are many players).
For now I'm using this function:
`function GetPlayerNameByID(id: Integer; var playername: PAnsiChar; max_len: Integer): Boolean; cdecl; external 'Open-SAMP-API.dll' name 'GetPlayerNameByID'
function GetNumberOfPlayers: Integer;
var
i: Integer;
buffer: array[0..31] of AnsiChar;
p: PAnsiChar;
begin
Result := 0;
i := 0;
while i < 420 do
begin
FillChar(buffer, Length(buffer), 0);
p := @buffer[0];
if GetPlayerNameByID(i, p, High(buffer)) then
if buffer[0] <> #0 then
Inc(Result);
Inc(i);
end;
end;`
Problems:
Can you help me please?
Thank you.
Merry Christmas.
Hello
The functions IsPlayerInRange2D and IsPlayerInRange3D doesnt work. Even if I select a radius of 3000 it always returns 0
As the title sais these two functions are missing and they are the functions I use the most and most other APIs or SAMPD UDF just have IsChatOpen which combines them... I need them seperated so that I can make checks if the dialog has opened or not and more stuff like that.
Taken from here: http://forum.samp-api.net/index.php?page=Thread&postID=32#post32
We should add these functions to our API:
Since we plan to move our binaries to GitHub-Releases, we also want to implement TravisCI's automatic builds.
The .travis.yml
+ TravisCI Hooks are already setup locally, we just need a good/working MakeFile. Since I have no clue how to create them at all (C++ noob), maybe someone can help us out?
When i using ENB Series (d3d9.dll) + Open-SAMP-API.dll - SA:MP will crash.
My game does crash instantly as soon as I make a simple API call. SAMP does catch the exception at 0x02170245. My game is not modded, I am running everything through WINE, tho. I am compiling on a Windows 7 virtual machine in order to run it on my host with WINE.
#pragma comment(lib, "bin/Open-SAMP-API.lib")
#include "SAMP_API.h"
#include <iostream>
#define WIN32_LEAN_AND_MEAN
#include <Windows.h>
int main()
{
std::cout << "started" << std::endl;
SendChat("test");
return 0;
}
Would be neet to have a ShowDialog function that creates a custom SAMP Dialog.
Basically,
Input: Screen coordinates.
Output: X, Y, Z directional vector.
If the camera is facing exactly south the output for 320, 240
(center screen coordinates on a 640, 480 screen) would be 0, -1, 0
.
Is it possible to make something like that? I saw it in SAMP-UDF I think and it would be awesome if we could use it with this api too.
Könnt ihr euch vielleicht an die Funktion Namens WorldToScreen ransetzen ?
Währe Super toll wen Ihr das machen würdet.
Gruß,
0x320
TextCreate
causes timely lag and crashes. I can't reproduce it though since it occurs randomly. Disabling and re-enabling the command resolves the lag, but the crash is unpredictable. Firing the hotkey crashes the game.
The text should be AFK
but it appears like boxes with each text's respective colors.
Is there no function to register commands to the chat and get the commands entered to the chat?
Hi!
Der Code ist echt sauber!
Am meisten gefällt mir wie die Detours (Hook.hpp) umgesetzt wurden. Vorallem in Kombination mit Lambda-Funktionen, macht eure Implementation das Leben um einiges schöner.
Ich hab noch nicht soviel mit variadischen templates gearbeitet, trotzdem hab ich mich gefragt, wie ich mit euren Code einen Hook für eine Funktion ohne Parameter applied.
Du hast folgendes stehen:
template<CallConvention cc, typename retn, typename ...args>
Was ist, wenn wir gar keine args haben? Kommt ja häufiger vor. ;)
Wär cool, wenn dieser Fall noch abgedeckt wird, auch wenn ihr es gar nicht nutzt.
Gruß
LuxXx
I always failed to include the SAMP_API.ahk because it always say "The dll-file couldn't be found!"
What I've tried:
This is the whole Visual Studio 2013 logs
1>------ Build started: Project: Open-SAMP-API, Configuration: Release Win32 ------
1> Client.cpp
1> GTAFunctions.cpp
1> MemoryFunctions.cpp
1> PlayerFunctions.cpp
1> RenderFunctions.cpp
1> SAMPFunctions.cpp
1> VehicleFunctions.cpp
1> WeaponFunctions.cpp
1> dllmain.cpp
1> Game.cpp
1> World.cpp
1> Messagehandler.cpp
1> Box.cpp
1> D3DFont.cpp
1> dx_utils.cpp
1> Image.cpp
1> Line.cpp
1> RenderBase.cpp
1> Renderer.cpp
1> Text.cpp
1> RemotePlayer.cpp
1> SAMP.cpp
1> Memory.cpp
1> NakedHook.cpp
1> Process.cpp
1> Module.cpp
1> Pattern.cpp
1> PipeClient.cpp
1> PipeServer.cpp
1> Serializer.cpp
1> Creating library C:\projects\Open-SAMP-API\src..\bin\Open-SAMP-API.lib and object C:\projects\Open-SAMP-API\src..\bin\Open-SAMP-API.exp
1> Generating code
1> All 3132 functions were compiled because no usable IPDB/IOBJ from previous compilation was found.
1> Finished generating code
1> Open-SAMP-API.vcxproj -> C:\projects\Open-SAMP-API\src..\bin\Open-SAMP-API.dll
1> Open-SAMP-API.vcxproj -> C:\projects\Open-SAMP-API\src..\bin\Open-SAMP-API.pdb (Full PDB)
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
Over here, UpdatePlayerData
doesn't seem to work. Calling GetPlayerNameByID
and related functions will result in an empty result, until I open up the player dialog (by pressing Tab in SAMP) for the first time. Afterwards, it works as expected.
Using SAMP 0.3.7 on Windows 8.1
Affected functions: GetPlayerIDByName
, GetPlayerNameByID
, GetPlayerId
Dear developers of the API, i am missing the function "GetVehicleID" with which users would be able to read a vehicles ID on the server. I really need this function for my program, so i would be very happy, if this could be included.
I hope, i'll get a reply soon. Best Regards, Montero
I noticed that the function GetChatLine(LineNumber(FromTheBottom), Variable) is missing.
Was it renamed or isn't it in the api?
I still don't understand how to use the function, such as how to use GetCityName (), etc.
Is there any way to handle dialog\chat output and GetCityName from player's id?
Also if i can export is at .asi or cleo's .cs?
It would be very nice if the API could return the text of the numberplate from the current vehicle
Es wäre schön, wenn ihr eine Funktion einbauen könntet, mit der man den Tod seines Chars auslesen/überprüfen kann.
Probably just needs an update, however I'm unsure where to find the memory addresses. Any help would be greatly appreciated.
E.g.
WRITE(int(Utils::SafeBlock::safeExecuteWithValidation([&](){ Rendering::Renderer::sharedRenderer().getAs<Rendering::Box>(id)->setBoxHeight(height); })));
id is invalid, a nullptr is returned and is used. Normally the try/catch should get it, but SAMP raise an exception dialog before. The game is running and not crashed, so the safeExecuteWithValidation works.
Im having a lot of problems trying to create an asi file, and well, title is my question, it's possible to create an asi file using this API?
Currently, the API has mostly Get functions. but nothing to set / edit.
Could functions be added from this other api? :
https://gitlab.com/konstantin.poletaev/api-for-gta-san-andreas-with-samp
Or
https://github.com/BlastHackNet/SAMP-API
Also one of the most important functions in my opinion. : "playerIsSpawned()"
Taken from here: http://forum.samp-api.net/index.php?page=Thread&postID=33#post33
It seems that GetVehicleHealth reports constantly 4
.
At the moment the overlay code is redundant in this repository and also here: https://github.com/agrippa1994/DX9-Overlay-API
We should think about centralizing all rendering functions in one git module. However, we do not need to adjust the code in both repository if a bug or feature in the Overlay API is fixed / developed.
@shadowlif what do you think about?
Huhu Agrippa. ich weiß net ob dus selber mitkriegst, aber appveyor produziert schon die ganze nacht immer wieder eine neue zip und neue releases- Eigentlich ist ja jedes erfolgreich wenn man sich das da so anschaut.
https://ci.appveyor.com/project/agrippa1994/open-samp-api/history
Ich habe glaube ich wie andere auch hier die Repo mal gewatcht, sodasss wir jede Benachritugung abkriegen :D, und dank dem appveyor kriege zumindest ich seit gestern abend alle paar minuten ne mail, das wieder ein release fertig ist. Stand 7:40 Uhr ist 1.0.210.
will there be Cyrillic support?
For me, GetVehicleHealth()
always returns 4 while in a vehicle, no matter the car damage.
Furthermore, when not in a car, it returns 0 rather than the -1 it's supposed to return.
The address is correct, though, I've checked in Cheat Engine for myself. The data type, float, is correct as well.
Weird.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.