mirror of
https://github.com/BeamMP/Wiki.git
synced 2026-04-03 06:26:07 +00:00
docs: add all untracked content
This commit is contained in:
41
Scripting/server-scripting.html
Normal file
41
Scripting/server-scripting.html
Normal file
@@ -0,0 +1,41 @@
|
||||
<!--
|
||||
title: Server Side Scripting
|
||||
description:
|
||||
published: true
|
||||
date: 2022-12-22T09:23:10.870Z
|
||||
tags:
|
||||
editor: ckeditor
|
||||
dateCreated: 2020-06-17T19:32:59.868Z
|
||||
-->
|
||||
|
||||
<p>GetPlayerName(<PlayersServerID>) -- Returns the players discord name as a string</p>
|
||||
<p>GetPlayerDiscordID(<PlayersServerID>) -- Returns the players discord id as a string</p>
|
||||
<p>GetPlayerHWID(<PlayersServerID>) -- Returns the players hardware id as a string. This is a generated string by us.</p>
|
||||
<p>GetPlayerVehicles(<PlayersServerID>) -- Returns the players vehicles as a object/array</p>
|
||||
<p>DropPlayer(<PlayersServerID>, <Reason>) -- Drops the connection for a specific player. Essentially Kicking them</p>
|
||||
<p>SendChatMessage(<Message>) -- Sends a message over the network as the server.</p>
|
||||
<p>CancelEvent() -- Cancels the event from happening</p>
|
||||
<p> </p>
|
||||
<p>"onPlayerJoin" -- Returns the players ID -- A player has joined and loaded in</p>
|
||||
<p>"onPlayerConnecting" -- Returns the players ID -- A player is loading in (Before loading the map)</p>
|
||||
<p>"onPlayerJoining" -- Returns the players ID -- A player is loading the map and will be joined soon</p>
|
||||
<p>"onChatMessage" -- Returns the players ID that sent it + the senders name + the chat message -- A chat message was sent. This would be good for making a commands system</p>
|
||||
<p>"onVehicleSpawn" -- Returns the players ID, the vehicle ID and the vehicle data -- This is called when someone spawns a vehicle.</p>
|
||||
<p> </p>
|
||||
<p>RegisterEvent(<EventName>,<functionName>) -- will register that function to the event specified both must be a string</p>
|
||||
<p>TriggerLocalEvent(<EventName>) -- will call every registered function in the same plugin folder</p>
|
||||
<p>TriggerGlobalEvent(<EventName>) -- will call every registered function in any plugin folder</p>
|
||||
<p>function onInit() -- if declared in a lua file it will be called once C++ successfully finished loading the current lua file</p>
|
||||
<p> </p>
|
||||
<p>CreateThread(<functionName>) -- will execute the function on a dedicated thread</p>
|
||||
<p>GetPlayerCount() -- will return how many players are connected</p>
|
||||
<p>Sleep(<millisecs>) -- will pause execution for the amount of time specified (warning doing so will pause the entire server if you didn't create a thread)</p>
|
||||
<p> </p>
|
||||
<p>GetPlayers() -- will return a table of IDs with Names</p>
|
||||
<p>example : </p>
|
||||
<p>if GetPlayers() ~= nil then</p>
|
||||
<p> for ID,Name in pairs(GetPlayers()) do</p>
|
||||
<p> print(ID)</p>
|
||||
<p> print(Name)</p>
|
||||
<p> end</p>
|
||||
<p>end</p>
|
||||
Reference in New Issue
Block a user