Giter VIP home page Giter VIP logo

open-samp-api's People

Contributors

agrippa1994 avatar dogeamazed avatar johnnycrazy avatar marcelgerber avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

open-samp-api's Issues

How to get the api memory addresses?

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.

get the total number of players

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:

  1. It's very slow (it takes a few sec) but I need to display a value (which I got from it and some other variables) in real time without hogging one of the logical CPUs.
    Could be from calling SERVER_CHECK(0) 420 times when one time is enough, but I'm not sure,
  2. Since checking the first char from playername would suffice, I tried to lower the length of the buffer and the max_len parameter. But at some point the dll is crashing my app. Using a try..except doesn't help.
  3. I tried to compile the dll sources in Visual C++ 2010 but I end up with some strange compilation errors in German language.
    The gold was to add this function and then to send you the sources so others can benefit as well.

Can you help me please?
Thank you.

Merry Christmas.

IsChatOpen and IsDialogOpen missing

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.

Create MakeFile

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?

crash when using api

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;
}

ShowDialog

Would be neet to have a ShowDialog function that creates a custom SAMP Dialog.

Add ScreenToWorld vector

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.

GetPlayerSkinID

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.

Add WorldToScreen

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 Massive Lag

image
image

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.

image
image

Hooks.hpp: apply ohne args?

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

@agrippa1994

.dll files always not found

I always failed to include the SAMP_API.ahk because it always say "The dll-file couldn't be found!"
What I've tried:

  1. Check the hModule output and it show "0" (The documentation says zero means "Success" but I never success to run any SAMP Functions)
  2. Removing the hModule if statements for bypassing the dll validation
  3. Recompile the .dll file through Visual Studio 2013
  4. Checking the .dll path and it's 100% correct, not an invalid path
  5. I've try change the dll file path to a random path to make sure what does it will return. But the hModule still return 0 (Which by documentation meaning succes but actually not success),
  6. I've check my compiled .dll files and seems all function are in (screenshot )

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 ==========

UpdatePlayerData doesn't work

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

GetVehicleID()

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

GetChatLine

I noticed that the function GetChatLine(LineNumber(FromTheBottom), Variable) is missing.

Was it renamed or isn't it in the api?

GetVehicleNumberplate

It would be very nice if the API could return the text of the numberplate from the current vehicle

IsPlayerDeath()

Es wäre schön, wenn ihr eine Funktion einbauen könntet, mit der man den Tod seines Chars auslesen/überprüfen kann.

safeExecuteWithValidation raising SAMP-Exception dialog

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.

Bug

Centralize Rendering

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?

Appveyor

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.

GetVehicleHealth doesn't work

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.