Giter VIP home page Giter VIP logo

samp.lua's Introduction

SAMP.Lua

SAMP.Lua is a lua library for MoonLoader that adds some features to make SA:MP modding simpler.

Currently this library is work in progress. At this moment the only implemented module is SAMP.Events.

Installation

Copy the entire folder samp into the moonloader/lib/ directory.

SAMP.Events

Gives ability to handle SA:MP incoming and outcoming low-level network packets by very easy way.

Usage

local sampev = require 'samp.events'

-- intercept outgoing chat messages
function sampev.onSendChat(msg)
  print('You said: ' .. msg)
end

You can rewrite data. Just return all arguments in the right order within a table.

function sampev.onSendChat(msg)
  return {'I said: ' .. msg}
end

You can also interrupt processing any packets by returning false.

function sampev.onSetPlayerPos(position)
  -- prevent server from changing player's position
  return false
end
Adding your own packet handler
local sampev = require 'samp.events'
local raknet = require 'samp.raknet'
sampev.INTERFACE.INCOMING_RPCS[raknet.RPC.PLAYSOUND] = {'onPlaySound', {soundId = 'int32'}, {coordinates = 'vector3d'}}

function sampev.onPlaySound(sound, coords)
  -- add log message
  print(string.format('Sound %d at coords %0.2f, %0.2f, %0.2f', sound, coords.x, coords.y, coords.z))
  -- and mute sound
  return false
end

The same way you can add your own types for more complex packet structures. See source code for more information and examples.

Links

MoonLoader: http://blast.hk/moonloader/
Official thread at BlastHack: http://blast.hk/threads/14624/

Credits

FYP, MISTER_GONWIK and contributors.

samp.lua's People

Contributors

amyrahmady avatar melomancool avatar mistergonwik avatar rinatnamazov avatar the-fyp 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

Watchers

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

samp.lua's Issues

fontName

При использовании fontName из read_object_material_text выдает ошибочный шрифт.
Вместо "Arial" мы получаем "Ariel".
Пример:
SetObjectMaterialText(980,'ПРЕСС-ЦЕНТР',0,130,Ariel,30,1,-16777216,0);

Game freezes while trying to load an object's material

After joining a specific server, I noticed that the game would always freeze right before the login screen, after researching a bit more i found that SAMP.lua was trying to load an object's material indefinitely, thus causing the game to freeze infinitely.

Steps to reproduce:

1- Use this script
2- Join this server: [removed]
3- Wait a bit and see your game freeze.

The problem seems to be in this line, putting some prints in the code i get this:

test_1: while start
test_1: while iteration x1 6
test_1: while iteration x2 6
test_1: while iteration x3 6
..
test_1: while iteration x89 6
..
infinitely.

I don't know if the solution would be to use raknetBitStreamIgnoreBits or something as i know nothing about the internals of SAMP, can you help me @THE-FYP? Thanks.

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.