APP Release SA-MP API 0.3 (BETA) [0.3.DL]

Joined
Jan 12, 2019
Messages
6
Reaction score
5
Hello everyone, I want to introduce you to the library for MoonLoader 0.26, which will make it possible to write scripts for SA:MP 0.3.DL. In order for the library to work correctly, it is important to observe the following requirements:
  1. To have a GTA assembly without too much "garbage" in it
  2. Have installed CLEO (preferably version 4.1)
  3. Have the latest version ASI Loader installed
  4. Installed in GTA MoonLoader 0.26
Let's get started!
In order to start writing a script, we must connect the SA-MP API:
C++:
local dl = require "lib.SA-MP API.init"
The library has a list of functions:
Code:
dl.GetIsAvailable() -- SAMP congestion check
dl.Get() -- loads SAMP 0.3.DL structures with which it will be possible to work
dl.SendChat(text) -- sends text to chat (if there is a command in text, it will send a command)
dl.ToggleCursor(toggle) -- enable / disable cursor rendering
dl.RegisterClientCommand(cmd, func, replaceOld) -- registers a command for SA:MP 0.3.DL (there can be 144 client commands in total)
dl.DeleteClientCommand(cmd) -- deletes a command by its name
dl._RegisterClientCommand(cmd, func) -- registers a command, unlike RegisterClientCommand, this function cannot replace commands
dl.TakeScreenshot() -- takes a screenshot
dl.RequestSpawn() -- sends RPC about player spawn
dl.Spawn() -- spawn player
dl.SetInputMode(mode, disable_cursor) -- open / close SAMP text input line
dl.UnlockActorCam() -- returns character control (use if cursor is hidden)
dl.AddMessageToChat(msgType, msg, prefix, msgColor, prefixColor) -- sends a chat message
dl.UpdateScoreboardData()-- sends RPC UpdateScoreboardData
dl.Say(msg) -- sends text to chat
dl.SendCommand(cmd) -- sends a command to the server
dl.SendInteriorChange(intID) -- sends an RPC to change the interior
dl.RequestClass(classID) -- sends RPC class change
dl.DisableScoreboard(enable) -- disables scoreboard
dl.SetSpecialAction(actionId) -- gives the player a special action
dl.getLocalUsername() -- returns the nickname of the local player
dl.getLocalPlayerId() -- returns the local player ID
dl.getLocalPlayerPing() -- returns ping local player
dl.getLocalPlayerScore() -- returns the local player level
dl.getMaxPlayerId() -- returns the maximum ID on the server
dl.getServerIp() -- returns the IP of the server to which the player is connected
dl.getServerHostname() -- returns the name of the server to which the player is connected
dl.getServerPort() -- returns the server port to which the player is connected
dl.getGameState() -- returns the current state of SAMP
dl.isChatOpen() -- checks if chat is open, returns true / false
dl.setLocalUsername(pLocalPlayerName) -- visually sets the nickname to the local player, accepts pLocalPlayerName (string)
dl.isScoreboardOpen() -- checks if Scoreboard is open, returns true / false
dl.getServerWeather() -- returns the weather number set by the server
dl.isDialogOnScreen(pDialogId) -- checks if a dialog with a specific ID is on the screen, accepts pDialogId (int)
dl.isAnyDialogOnScreen() -- checks if any dialog is on the screen, returns true / false
dl.getDialogId() -- returns the ID of the dialog that is on the screen (use in conjunction with isAnyDialogOnScreen)
dl.getDialogStyle() -- returns the style number of the dialog that is on the screen
dl.getDialogCaption() -- returns the title of the dialog that is on the screen
dl.getDialogText() -- returns the text of the dialogue that is on the screen
dl.isPlayerConnected(playerId) -- checks if a player with a specific ID is connected to the server, returns true / false(на ID локального игрока выдает false)
Starts writing a script. We do a check for the existence of SAMP:
Code:
function main()
    while not dl.GetIsAvailable() do wait(100) end -- nothing will happen until SAMP is loaded
end
We did a check on SAMP, let's post something to the chat after it:
Code:
dl.AddMessageToChat(4, "Hello men", "", 0xFFFFFF, 0xFFFFFF) -- 4 is the message type, Hello men text, "" prefix (not used), and the last two parameters are color text and prefix
We can also register the command:
Code:
dl.RegisterClientCommand("test_cmd", TEST_FUNCTION)

function TEST_FUNCTION()
    dl.AddMessageToChat(4, "You used the /test command", "", 0xFFFFFF, 0xFFFFFF)
end
Here's a simple NoStun for example:
Code:
local dl = require "lib.SA-MP API.init"
act = false

function main()
    while not dl.GetIsAvailable() do wait(100) end
    dl.RegisterClientCommand("nostun", NoStunAct)
    while true do wait(0) end
end

function NoStunAct()
    act = not act
    if act then
        setCharUsesUpperbodyDamageAnimsOnly(PLAYER_PED, 1)
    else
        setCharUsesUpperbodyDamageAnimsOnly(PLAYER_PED, 0)
    end
end

The author of the idea and implementation of version 0.1: LUCHARE
Author of continued development: S E V E N
If anyone has questions, write to thread
 

Attachments

  • SA-MP API.rar
    38.5 KB · Views: 261

Herka

Member
Joined
Dec 23, 2018
Messages
5
Reaction score
0
Amazing, how to include in C++ .asi project please ?
 

Durzi

Member
Joined
May 18, 2015
Messages
6
Reaction score
0
Is it possible to run moonloader on 03DL ? How can it be done ?
 

h0ze

New member
Joined
Dec 3, 2020
Messages
2
Reaction score
0
Location
-
To use it you need cleo + moonloader, it opens you the option to program in lua with the options for samp 03DL
Previous Lua mods can be work with this process?
 
Last edited:

SobFoX

Expert
Joined
Jul 14, 2015
Messages
1,463
Solutions
5
Reaction score
916
Location
Israel
Previous Lua mods can be work this process?
You hardly have options for that

It is better for you
At 0.3.DL already use in sobeit maybe you have in it what you are looking for
0.3.DL this is a dead version kalcor closed the support comes at all it is not recommended to continue playing in this version
 
Top