dizzaster / vcmp-lua Goto Github PK
View Code? Open in Web Editor NEWLua scripting support for VCMP
Lua scripting support for VCMP
Objects created with Object:new disappear from the map after a few minutes.
Script:
initTime = 0
Event.bind("onServerInit", function()
loadObject(os.time())
Timer.create(function()
if Object.count() < 1 then
Logger.info("No objects found | time: " .. os.time())
Logger.info("After: " .. os.time() - initTime .. " secs")
end
end, 50, -1)
end)
function loadObject(timestamp)
initTime = timestamp
Object:new(4499, 1, -305.76, -481.706, 20.7062, 255)
Logger.info("Object count: " .. Object.count() .. " | time: " .. timestamp)
end
Plugin error >> dlopen() 'plugins/LuaPlugin_x64.so' failed: plugins/LuaPlugin_x64.so: undefined symbol: mysql_use_result
Failed to load plugin: LuaPlugin_x64
OS: Linux debian-m-2vcpu-16gb-fra1-01 5.10.0-11-amd64 #1 SMP Debian 5.10.92-1 (2022-01-18) x86_64 GNU/Linux
This function is returning the following error
Event callback error: main.lua:118: attempt to call a nil value (field 'getSettings')
Using player.name = "somename" does not change the player's name.
Request new functions:
vehicle:respawn()
vehicle:getDriver()
vehicle:getOccupant(slotID)
vehicle:getTyre(tyre)
Vehicle:setTyre(tyre, state)
vehicle:fix()
vehicle:getPart(partID)
vehicle:setPart(part, state)
vehicle.taxiLight
vehicle.turretRotation
pickup:getModel()
I'm trying to hide the following object
Map.hideObject(474, -393.412, -505.822, 9.92519)
This returns the following error:
[error] Event callback error: stack index 2, expected number, received number: not a numeric type that fits exactly an integer (number maybe has significant decimals) (bad argument into 'void(int, short, short, short)')
The game only hides an object if it uses a decimal value, otherwise the object is not hidden.
When sending strings from the client to the server, fragments of previous reads persist on the server.
Client-side:
// If a string is shorter than the previous one, it will end up getting mixed up with some characters from the previous one.
words <- ["If", "a", "string", "is", "shorter", "than", "the", "previous", "one,", "it", "will", "end", "up", "getting", "mixed", "up", "with", "some", "characters", "from", "the", "previous", "one."]
foreach(i, w in words) {
local Data = Stream();
Data.WriteInt(10)
Data.WriteString(words[i]);
Server.SendData(Data);
}
Server-side:
function onClientData(player, stream, size)
local streamId = stream:readNumber()
local string = stream:readString()
if(streamId == 10) then
Player.msgAll(string)
end
end
In-game chat display
Here's the list I've noticed so far
Server.banPlayer(player) / player:ban()
Server.kickPlayer(player) / player:kick()
Server.banIP(ip)
Server.isIPBanned(ip)
Server.unbanIP(ip)
player.away
player:disarm()
player:setAlpha
player.alpha
vehicle.immunity
Edit: Also consider these functions: player:setAlpha
/player.alpha
, vehicle.immunity
When there is more than one player, players 0 and 1 get confused by being indexed in the onPlayerDisconnect event.
If Player 0 leaves the server, it ends up being recognized as ID 1
Console logs:
Players connecting
Player 'Player0' ID 0 connected.
Player 'Player1' ID 1 connected.
Player 'Player2' ID 2 connected.
Player 0 leaving (The console shows that it is player 0 leaving, but the event recognizes it as player 1)
Disconnecting player 'Player0' at ID 0, sent quit packet with reason 1.
Player 'Player0' ID 0 disconnected.
Player1 left with the ID 1
Script in onPlayerDisconnect:
print(player.name .. " left with the ID " .. player.id)
Squirrel
SetMaxPlayers(int)
SetMaxHeight(int)
Lua Suggestion
Server.maxPlayers = int
Server.maxHeight = int
Hello, few days ago i noticed this in java plugin and decided to take a look at this plugin too.
In squirrel, stormeus does something like SendPluginCommand(0x7DC..., "");
Also on VcmpPluginInit, you can see somethings are 'exported'- the virtual machine.
Why this is needed is that if someone decided to write a plugin for this lua language, they need access to the lua virtual machine.
Sound plays for all players who are in the same world as the player
Error:
attempt to call a nil value (method 'setWeapon')
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.