Giter VIP home page Giter VIP logo

samp-rs's People

Contributors

cheaterman avatar kaperstone avatar povargek avatar pycckue-bnepeg avatar southclaws avatar sreyas-sreelal avatar xakdog 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

Watchers

 avatar  avatar  avatar  avatar  avatar

samp-rs's Issues

Solved

The question is already in the title :P

No load plugin

I managed to compile the plugin-tamplate.dll for me

what happens is that when loading it fails, I have windows 10 x64.

AMX API compatibility issues

Hello, I would like to report two issues that I have found that cause problems with plugins that follow the GCA, including PawnPlus, YALP, and potentially others.

The first is in the from_raw conversion of an AmxString. For the best compatibility between various plugins, it is recommended to use the AMX API, if possible. In this case, the amx_StrLen function is already available and does pretty much the same thing. In the case of PawnPlus, this function is hooked to return a length directly, without the need to compute it, in which case it is even possible to process strings that contain the NUL character.

Moreover, I think this implementation is incorrect for packed strings. As far as I can tell, it treats them simply as strings of byte-sized characters, but that's not how they are represented in memory. A string "abcdefg" would be stored as "dcba␀gfe", since this way, the value of the first cell is always more than UNPACKEDMAX. In this case, the length would be computed as 4, due to the encountered NUL. See PawnPlus for some examples on handling packed strings.

Going further, get_ref function that is eventually called for an AMX cell address should also refer to amx_GetAddr instead. You essentially replicate all the behaviour that function does, disallowing any potential custom hooks and handling of other address ranges by other plugins. In this case, it makes it impossible for dynamic strings in PawnPlus, as they work by allowing addresses outside the normal AMX range to store dynamically-allocated strings.

feature has been remove

   Compiling detour v0.5.0
error[E0557]: feature has been removed
 --> C:\Users\d13g0\.cargo\registry\src\github.com-1ecc6299db9ec823\detour-0.5.0\src\lib.rs:2:42
  |
2 | #![cfg_attr(feature = "nightly", feature(const_fn, unboxed_closures))]
  |                                          ^^^^^^^^ feature has been removed
  |
  = note: split into finer-grained feature gates

For more information about this error, try `rustc --explain E0557`.
error: could not compile `detour` due to previous error```

Plugin problems

Hi Eva. I apologize for writing here, but there are no other ways of communication. In general, I am writing about two problems that I encountered when working with the samp-cef plugin. I'm working on changing the interfaces right now, and I ran into the only problem, it's radar. I don't understand how to make it functional with your plugin. The second problem is more serious. Working with events, I ran into the problem that if you send them often, the client plugin just shipped and stops responding. I made a speedometer and made a timer, at first it was once every 5 seconds, but it crashed the plugin. Then I did it once every 10 seconds, it also crashes. Tell me how to solve this problem? I just know what game server players are who can deliberately flood something and cause a crash. I beg you, do not ignore, do not block, but give an answer, this is my last chance to ask you a question. I tried to contact via mail, but it was useless ..

Implement rest of AMX functions

List of AMX functions:

  • amx_Allot
  • amx_Callback
  • amx_Cleanup
  • amx_Clone
  • amx_Exec
  • amx_FindNative
  • amx_FindPublic
  • amx_FindPubVar
  • amx_FindTagId
  • amx_Flags
  • amx_GetAddr
  • amx_GetNative
  • amx_GetPublic
  • amx_GetPubVar
  • amx_GetString
  • amx_GetTag
  • amx_GetUserData
  • amx_Init
  • amx_InitJIT
  • amx_MemInfo
  • amx_NameLength
  • amx_NativeInfo
  • amx_NumNatives
  • amx_NumPublics
  • amx_NumPubVars
  • amx_NumTags
  • amx_Push
  • amx_PushArray
  • amx_PushString
  • amx_RaiseError
  • amx_Register
  • amx_Release
  • amx_SetCallback
  • amx_SetDebugHook
  • amx_SetString
  • amx_SetUserData
  • amx_StrLen

Procedural macros instead of declarative ones

  • Develop a proc macro to define a new plugin. (custom derive or custom attribute?)
#[samp_plugin]
struct Plugin {
    amx_list: Vec<Amx>,
}

impl Plugin {
    fn amx_load(&self, amx: &Amx) -> ...
}
  • Replace define_native!() with a custom attribute.
    Something like this:
#[native]
fn useful_native_function(first_arg: i32, second_arg: &mut f32) -> AmxResult<Cell> {
    Ok(1)
}

transmute called with types of different sizes

How to reproduce: All I did was to clone the samp-plugin-example and cargo build

root@kappa:~/rust/samp/plugins/tomato# cargo clean
root@kappa:~/rust/samp/plugins/tomato# cargo build
   Compiling lazy_static v1.0.0
   Compiling samp-sdk v0.8.1 (https://github.com/zottce/samp-sdk.git#c728d460)
error[E0512]: transmute called with types of different sizes
  --> /root/.cargo/git/checkouts/samp-sdk-0a5b35fda5e726ef/c728d46/src/data.rs:15:20
   |
15 |         Mutex::new(std::mem::transmute(0u32))
   |                    ^^^^^^^^^^^^^^^^^^^
   |
   = note: source type: u32 (32 bits)
   = note: target type: extern "C" fn(*const i8, ...) (64 bits)

error: aborting due to previous error

For more information about this error, try `rustc --explain E0512`.
error: Could not compile `samp-sdk`.

To learn more, run the command again with --verbose.

Debian 9.3 64bit
rustc 1.26.0-nightly (521d91c6b 2018-03-14)

build.rs prevents cross-compiling. Solution: remove it! 🎉

Build scripts, such as your build.rs, since they are built for execution on the compiling machine, don't receive the --target i686-… memo. As a result, their cfg!(target_arch) always matches the architecture of the rustc which compiles them - usually x86_64.

Because build.rs always sees x86_64, cross-compilation of your library from x86_64 hosts always fails, except for the scenario where a Windows user installs the whole 32-bit Rust toolchain (which 64-bit Windows happens to be able to execute thanks to WOW64) and uses it to compile the 32-bit plugin - I believe this is what you did.

When I removed build.rs in my fork, cross-compilation from x86_64 Windows (using the default stable-x86_64-pc-windows-msvc toolchain) to the i686-unknown-linux-gnu target worked perfectly! 🎈 There is no need to install a linux toolchain (which wouldn't even execute on Windows if you tried) nor the 32-bit windows toolchain. All that's needed to compile for Linux is:

rustup target add i686-unknown-linux-gnu
cargo build --target=i686-unknown-linux-gnu

And likewise, for 32-bit Windows:

rustup target add i686-pc-windows-msvc
cargo build --target=i686-pc-windows-msvc

You don't have to run the 32-bit version of rustc to compile for 32-bit targets. You're only supposed to change the target. The library, because of the build.rs quirk, needlessly restricts cross-compilation. 😟

broken natives functions

SDK breaks native functions from other modules (like SAMP and plugins) when plugin uses #[native(..., raw)] or samp_sdk::amx::Allocator and its methods (I'm not sure which one).

@bmisiak

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.