From 8d6f6d29702ee74081fb0f9b858e1ea691a0f162 Mon Sep 17 00:00:00 2001 From: Adam Date: Fri, 3 Aug 2018 22:35:48 +0300 Subject: [PATCH] Implement GetPlayerName and misc --- .gitignore | 2 ++ RagePawn/RagePawn.vcxproj | 4 +++- RagePawn/RagePawn.vcxproj.filters | 10 ++++++++-- RagePawn/natives.hpp | 16 ---------------- RagePawn/pawn.cpp | 12 +++++++----- RagePawn/pawn.hpp | 4 +++- RagePawn/player_natives.cpp | 27 +++++++++++++++++++++++++++ RagePawn/util_natives.cpp | 13 +++++++++++++ 8 files changed, 63 insertions(+), 25 deletions(-) delete mode 100644 RagePawn/natives.hpp create mode 100644 RagePawn/player_natives.cpp create mode 100644 RagePawn/util_natives.cpp diff --git a/.gitignore b/.gitignore index 3e759b7..f95179b 100644 --- a/.gitignore +++ b/.gitignore @@ -328,3 +328,5 @@ ASALocalRun/ # MFractors (Xamarin productivity tool) working folder .mfractor/ + +api.hpp \ No newline at end of file diff --git a/RagePawn/RagePawn.vcxproj b/RagePawn/RagePawn.vcxproj index 62f2ec7..ac2dd8c 100644 --- a/RagePawn/RagePawn.vcxproj +++ b/RagePawn/RagePawn.vcxproj @@ -159,14 +159,16 @@ + + + - diff --git a/RagePawn/RagePawn.vcxproj.filters b/RagePawn/RagePawn.vcxproj.filters index 9419d89..28c28e4 100644 --- a/RagePawn/RagePawn.vcxproj.filters +++ b/RagePawn/RagePawn.vcxproj.filters @@ -23,6 +23,12 @@ Source Files + + API + + + API + @@ -37,8 +43,8 @@ API - - API + + Header Files \ No newline at end of file diff --git a/RagePawn/natives.hpp b/RagePawn/natives.hpp deleted file mode 100644 index aeaba16..0000000 --- a/RagePawn/natives.hpp +++ /dev/null @@ -1,16 +0,0 @@ -#pragma once -#include "main.hpp" -#include "../amxlib/amx.h" -#include "format.hpp" - -const AMX_NATIVE_INFO rage_Natives[] = -{ - { "format", n_format }, - { NULL, NULL } -}; - -class natives -{ - public: - -}; diff --git a/RagePawn/pawn.cpp b/RagePawn/pawn.cpp index 1d8a41f..a1fe892 100644 --- a/RagePawn/pawn.cpp +++ b/RagePawn/pawn.cpp @@ -8,13 +8,10 @@ #pragma comment( lib, "winmm.lib") // amx_TimeInit(&amx); #pragma comment( lib, "ws2_32.lib") // amx_DGramInit(&amx); -#include "natives.hpp" #include "callbacks.hpp" namespace fs = std::experimental::filesystem; -// Discontinued Open Source support - extern "C" { int AMXEXPORT AMXAPI amx_ConsoleInit(AMX *amx); int AMXEXPORT AMXAPI amx_ConsoleCleanup(AMX *amx); @@ -38,6 +35,9 @@ extern "C" { int AMXEXPORT AMXAPI amx_ArgsCleanup(AMX *amx); } +int amx_playerInit(AMX *amx); +int amx_utilInit(AMX *amx); + Pawn::Pawn() { std::cout << "Initializing RagePawn.." << std::endl; @@ -83,7 +83,9 @@ void Pawn::RunAMX(const std::string& path, const bool fs) amx_ProcessInit(&amx); amx_ArgsInit(&amx); - amx_Register(&amx, rage_Natives, -1); + amx_utilInit(&amx); + amx_playerInit(&amx); + //int count; //amx_NumNatives(&amx, &count); @@ -203,4 +205,4 @@ void Pawn::CallPublicEx(AMX *amx, const char *name, const char *fmt, ...) va_end(args); std::cout << "Finished callback..." << std::endl; -} \ No newline at end of file +} diff --git a/RagePawn/pawn.hpp b/RagePawn/pawn.hpp index 8cd737d..f267cca 100644 --- a/RagePawn/pawn.hpp +++ b/RagePawn/pawn.hpp @@ -9,7 +9,7 @@ typedef struct { static std::vector