1
0
mirror of https://github.com/VCMP-SqMod/SqMod.git synced 2024-11-08 00:37:15 +01:00

Begin working on a demo script.

Should be simple and easy to start with.
This commit is contained in:
Sandu Liviu Catalin 2019-08-13 21:14:20 +03:00
parent 8438283539
commit 47325fa8c0
12 changed files with 954 additions and 2 deletions

17
bin/demo/boot.nut Normal file
View File

@ -0,0 +1,17 @@
// Compute the path to the scripts folder (use the `ScriptFolder` option from `sqmod.ini`)
ScriptsPath <- SqSysPath.Working().Append(SqCore.GetOption("ScriptFolder"));
// Log it for debug purposes
SqLog.Inf("Booting script from: %s", ScriptsPath.String);
// Load the command manager
SqCore.LoadScript(true, SqSysPath(ScriptsPath.String).Append("cmd.nut"));
// Load event scripts (delay them `true` since we don't need them executed right away)
SqCore.LoadScript(true, SqSysPath(ScriptsPath.String).Append("events").Append("blip.nut"));
SqCore.LoadScript(true, SqSysPath(ScriptsPath.String).Append("events").Append("checkpoint.nut"));
SqCore.LoadScript(true, SqSysPath(ScriptsPath.String).Append("events").Append("custom.nut"));
SqCore.LoadScript(true, SqSysPath(ScriptsPath.String).Append("events").Append("keybind.nut"));
SqCore.LoadScript(true, SqSysPath(ScriptsPath.String).Append("events").Append("object.nut"));
SqCore.LoadScript(true, SqSysPath(ScriptsPath.String).Append("events").Append("pickup.nut"));
SqCore.LoadScript(true, SqSysPath(ScriptsPath.String).Append("events").Append("player.nut"));
SqCore.LoadScript(true, SqSysPath(ScriptsPath.String).Append("events").Append("server.nut"));
SqCore.LoadScript(true, SqSysPath(ScriptsPath.String).Append("events").Append("vehicle.nut"));
// Load command scripts (delay them `true` since we don't need them executed right away)

103
bin/demo/cmd.nut Normal file
View File

@ -0,0 +1,103 @@
/* --------------------------------------------------------------------------------------------------------------------
* We need a command manager to be able to create and manage commands.
* We also store it in the root table to make it accessible in other scripts.
*/
g_Cmd <- SqCmd.Manager();
/* --------------------------------------------------------------------------------------------------------------------
* This is our global function we give to the command manager to tell whether someone is allowed
* or not to execute a certain function. If this function returns false, the command is ignored
*/
g_Cmd.BindAuth(this, function(player, command) {
// I guess we can use the default authority level to make the decision :/
return (player.Authority >= command.Authority);
});
/* --------------------------------------------------------------------------------------------------------------------
* General purpose error handler for a command manager.
* Otherwise the player doesn't know why a command failed.
*/
g_Cmd.BindFail(this, function(type, msg, payload) {
// Retrieve the player that executed the command
local player = g_Cmd.Invoker;
// See if the invoker even exists
if (!player || typeof(player) != "SqPlayer") {
return; // No one to report!
}
// Let players know how to get in contact with the owner
local contact = SqCore.GetOptionOr("OwnerContact", "no.email@to.me");
// Identify the error type
switch (type) {
// The command failed for unknown reasons
case SqCmdErr.Unknown: {
player.Message("Unable to execute the command for reasons unknown");
player.Message("=> Please contact the owner: %s", contact);
} break;
// The command failed to execute because there was nothing to execute
case SqCmdErr.EmptyCommand: {
player.Message("Cannot execute an empty command");
} break;
// The command failed to execute because the command name was invalid after processing
case SqCmdErr.InvalidCommand: {
player.Message("The specified command name is invalid");
} break;
// The command failed to execute because there was a syntax error in the arguments
case SqCmdErr.SyntaxError: {
player.Message("There was a syntax error in argument: %d", payload);
} break;
// The command failed to execute because there was no such command
case SqCmdErr.UnknownCommand: {
player.Message("The specified command does no exist");
} break;
// The command failed to execute because the it's currently suspended
case SqCmdErr.ListenerSuspended: {
player.Message("The requested command is currently suspended");
} break;
// The command failed to execute because the invoker does not have the proper authority
case SqCmdErr.InsufficientAuth: {
player.Message("You don't have the proper authority to execute this command");
} break;
// The command failed to execute because there was no callback to handle the execution
case SqCmdErr.MissingExecuter: {
player.Message("The specified command is not being processed");
} break;
// The command was unable to execute because the argument limit was not reached
case SqCmdErr.IncompleteArgs: {
player.Message("The specified command requires at least %d arguments", payload);
} break;
// The command was unable to execute because the argument limit was exceeded
case SqCmdErr.ExtraneousArgs: {
player.Message("The specified command requires no more than %d arguments", payload);
} break;
// Command was unable to execute due to argument type mismatch
case SqCmdErr.UnsupportedArg: {
player.Message("Argument %d requires a different type than the one you specified", payload);
} break;
// The command arguments contained more data than the internal buffer can handle
case SqCmdErr.BufferOverflow: {
player.Message("An internal error occurred and the execution was aborted");
player.Message("=> Please contact the owner: %s", contact);
} break;
// The command failed to complete execution due to a runtime exception
case SqCmdErr.ExecutionFailed: {
player.Message("The command failed to complete the execution properly");
player.Message("=> Please contact the owner: %s", contact);
} break;
// The command completed the execution but returned a negative result
case SqCmdErr.ExecutionAborted: {
player.Message("The command execution was aborted and therefore had no effect");
} break;
// The post execution callback failed to execute due to a runtime exception
case SqCmdErr.PostProcessingFailed: {
player.Message("The command post-processing stage failed to complete properly");
player.Message("=> Please contact the owner: %s", contact);
} break;
// The callback that was supposed to deal with the failure also failed due to a runtime exception
case SqCmdErr.UnresolvedFailure: {
player.Message("Unable to resolve the failures during command execution");
player.Message("=> Please contact the owner: %s", contact);
} break;
// Something bad happened and no one knows what
default: {
SqLog.Inf("Command failed to execute because [%s][%s]", msg, ""+payload);
}
}
});

19
bin/demo/events/blip.nut Normal file
View File

@ -0,0 +1,19 @@
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: BlipCreated
*/
SqCore.On().BlipCreated.Connect(function(/*SqBlip*/ blip, /*int*/ header, /*object*/ payload) {
});
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: BlipDestroyed
*/
SqCore.On().BlipDestroyed.Connect(function(/*SqBlip*/ blip, /*int*/ header, /*object*/ payload) {
});
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: BlipCustom
*/
SqCore.On().BlipCustom.Connect(function(/*SqBlip*/ blip, /*int*/ header, /*object*/ payload) {
});

View File

@ -0,0 +1,49 @@
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: CheckpointCreated
*/
SqCore.On().CheckpointCreated.Connect(function(/*SqCheckpoint*/ checkpoint, /*int*/ header, /*object*/ payload) {
});
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: CheckpointDestroyed
*/
SqCore.On().CheckpointDestroyed.Connect(function(/*SqCheckpoint*/ checkpoint, /*int*/ header, /*object*/ payload) {
});
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: CheckpointCustom
*/
SqCore.On().CheckpointCustom.Connect(function(/*SqCheckpoint*/ checkpoint, /*int*/ header, /*object*/ payload) {
});
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: CheckpointStream
*/
SqCore.On().CheckpointStream.Connect(function(/*SqPlayer*/ client, /*SqCheckpoint*/ checkpoint, /*bool*/ is_deleted) {
});
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: CheckpointEntered
*/
SqCore.On().CheckpointEntered.Connect(function(/*SqCheckpoint*/ checkpoint, /*SqPlayer*/ player) {
});
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: CheckpointExited
*/
SqCore.On().CheckpointExited.Connect(function(/*SqCheckpoint*/ checkpoint, /*SqPlayer*/ player) {
});
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: CheckpointWorld
*/
SqCore.On().CheckpointWorld.Connect(function(/*SqCheckpoint*/ checkpoint, /*int*/ old_world, /*int*/ new_world) {
});
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: CheckpointRadius
*/
SqCore.On().CheckpointRadius.Connect(function(/*SqCheckpoint*/ checkpoint, /*float*/ old_radius, /*float*/ new_radius) {
});

View File

@ -0,0 +1,6 @@
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: CustomEvent
*/
SqCore.On().CustomEvent.Connect(function(/*int*/ group, /*int*/ header, /*object*/ payload) {
});

View File

@ -0,0 +1,19 @@
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: KeybindCreated
*/
SqCore.On().KeybindCreated.Connect(function(/*SqKeybind*/ keybind, /*int*/ header, /*object*/ payload) {
});
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: KeybindDestroyed
*/
SqCore.On().KeybindDestroyed.Connect(function(/*SqKeybind*/ keybind, /*int*/ header, /*object*/ payload) {
});
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: KeybindCustom
*/
SqCore.On().KeybindCustom.Connect(function(/*SqKeybind*/ keybind, /*int*/ header, /*object*/ payload) {
});

View File

@ -0,0 +1,55 @@
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: ObjectCreated
*/
SqCore.On().ObjectCreated.Connect(function(/*SqObject*/ object, /*int*/ header, /*object*/ payload) {
});
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: ObjectDestroyed
*/
SqCore.On().ObjectDestroyed.Connect(function(/*SqObject*/ object, /*int*/ header, /*object*/ payload) {
});
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: ObjectCustom
*/
SqCore.On().ObjectCustom.Connect(function(/*SqObject*/ object, /*int*/ header, /*object*/ payload) {
});
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: ObjectStream
*/
SqCore.On().ObjectStream.Connect(function(/*SqPlayer*/ client, /*SqObject*/ object, /*bool*/ is_deleted) {
});
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: ObjectShot
*/
SqCore.On().ObjectShot.Connect(function(/*SqObject*/ object, /*SqPlayer*/ player, /*int*/ weapon_id) {
});
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: ObjectTouched
*/
SqCore.On().ObjectTouched.Connect(function(/*SqObject*/ object, /*SqPlayer*/ player) {
});
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: ObjectWorld
*/
SqCore.On().ObjectWorld.Connect(function(/*SqObject*/ object, /*int*/ old_world, /*int*/ new_world) {
});
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: ObjectAlpha
*/
SqCore.On().ObjectAlpha.Connect(function(/*SqObject*/ object, /*int*/ old_alpha, /*int*/ new_alpha, /*int*/ time) {
});
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: ObjectReport
*/
SqCore.On().ObjectReport.Connect(function(/*SqObject*/ object, /*bool*/ old_status, /*bool*/ new_status, /*bool*/ touched) {
});

View File

@ -0,0 +1,73 @@
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: PickupCreated
*/
SqCore.On().PickupCreated.Connect(function(/*SqPickup*/ pickup, /*int*/ header, /*object*/ payload) {
});
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: PickupDestroyed
*/
SqCore.On().PickupDestroyed.Connect(function(/*SqPickup*/ pickup, /*int*/ header, /*object*/ payload) {
});
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: PickupCustom
*/
SqCore.On().PickupCustom.Connect(function(/*SqPickup*/ pickup, /*int*/ header, /*object*/ payload) {
});
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: PickupStream
*/
SqCore.On().PickupStream.Connect(function(/*SqPlayer*/ client, /*SqPickup*/ pickup, /*bool*/ is_deleted) {
});
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: PickupClaimed
*/
SqCore.On().PickupClaimed.Connect(function(/*SqPickup*/ pickup, /*SqPlayer*/ player) {
});
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: PickupCollected
*/
SqCore.On().PickupCollected.Connect(function(/*SqPickup*/ pickup, /*SqPlayer*/ player) {
});
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: PickupRespawn
*/
SqCore.On().PickupRespawn.Connect(function(/*SqPickup*/ pickup) {
});
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: PickupWorld
*/
SqCore.On().PickupWorld.Connect(function(/*SqPickup*/ pickup, /*int*/ old_world, /*int*/ new_world) {
});
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: PickupAlpha
*/
SqCore.On().PickupAlpha.Connect(function(/*SqPickup*/ pickup, /*int*/ old_alpha, /*int*/ new_alpha) {
});
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: PickupAutomatic
*/
SqCore.On().PickupAutomatic.Connect(function(/*SqPickup*/ pickup, /*bool*/ old_status, /*bool*/ new_status) {
});
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: PickupAutoTimer
*/
SqCore.On().PickupAutoTimer.Connect(function(/*SqPickup*/ pickup, /*int*/ old_timer, /*int*/ new_timer) {
});
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: PickupOption
*/
SqCore.On().PickupOption.Connect(function(/*SqPickup*/ pickup, /*int*/ option_id, /*bool*/ value, /*int*/ header, /*object*/ payload) {
});

427
bin/demo/events/player.nut Normal file
View File

@ -0,0 +1,427 @@
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: PlayerCreated
*/
SqCore.On().PlayerCreated.Connect(function(/*SqPlayer*/ player, /*int*/ header, /*object*/ payload) {
});
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: PlayerDestroyed
*/
SqCore.On().PlayerDestroyed.Connect(function(/*SqPlayer*/ player, /*int*/ header, /*object*/ payload) {
});
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: PlayerCustom
*/
SqCore.On().PlayerCustom.Connect(function(/*SqPlayer*/ player, /*int*/ header, /*object*/ payload) {
});
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: PlayerStream
*/
SqCore.On().PlayerStream.Connect(function(/*SqPlayer*/ client, /*SqPlayer*/ player, /*bool*/ is_deleted) {
});
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: PlayerRequestClass
*/
SqCore.On().PlayerRequestClass.Connect(function(/*SqPlayer*/ player, offset) {
});
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: PlayerRequestSpawn
*/
SqCore.On().PlayerRequestSpawn.Connect(function(/*SqPlayer*/ player) {
});
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: PlayerSpawn
*/
SqCore.On().PlayerSpawn.Connect(function(/*SqPlayer*/ player) {
});
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: PlayerWasted
*/
SqCore.On().PlayerWasted.Connect(function(/*SqPlayer*/ player, /*int*/ reason) {
});
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: PlayerKilled
*/
SqCore.On().PlayerKilled.Connect(function(/*SqPlayer*/ player, /*SqPlayer*/ killer, /*int*/ reason, /*int*/ body_part, /*bool*/ team_kill) {
});
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: PlayerEmbarking
*/
SqCore.On().PlayerEmbarking.Connect(function(/*SqPlayer*/ player, /*SqVehicle*/ vehicle, /*int*/ slot) {
});
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: PlayerEmbarked
*/
SqCore.On().PlayerEmbarked.Connect(function(/*SqPlayer*/ player, /*SqVehicle*/ vehicle, /*int*/ slot) {
});
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: PlayerDisembark
*/
SqCore.On().PlayerDisembark.Connect(function(/*SqPlayer*/ player, /*SqVehicle*/ vehicle) {
});
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: PlayerRename
*/
SqCore.On().PlayerRename.Connect(function(/*SqPlayer*/ player, /*string*/ old_name, /*string*/ new_name) {
});
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: PlayerState
*/
SqCore.On().PlayerState.Connect(function(/*SqPlayer*/ player, /*int*/ old_state, /*int*/ new_state) {
});
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: StateNone
*/
SqCore.On().StateNone.Connect(function(/*SqPlayer*/ player, /*int*/ old_state) {
});
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: StateNormal
*/
SqCore.On().StateNormal.Connect(function(/*SqPlayer*/ player, /*int*/ old_state) {
});
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: StateAim
*/
SqCore.On().StateAim.Connect(function(/*SqPlayer*/ player, /*int*/ old_state) {
});
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: StateDriver
*/
SqCore.On().StateDriver.Connect(function(/*SqPlayer*/ player, /*int*/ old_state) {
});
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: StatePassenger
*/
SqCore.On().StatePassenger.Connect(function(/*SqPlayer*/ player, /*int*/ old_state) {
});
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: StateEnterDriver
*/
SqCore.On().StateEnterDriver.Connect(function(/*SqPlayer*/ player, /*int*/ old_state) {
});
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: StateEnterPassenger
*/
SqCore.On().StateEnterPassenger.Connect(function(/*SqPlayer*/ player, /*int*/ old_state) {
});
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: StateExit
*/
SqCore.On().StateExit.Connect(function(/*SqPlayer*/ player, /*int*/ old_state) {
});
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: StateUnspawned
*/
SqCore.On().StateUnspawned.Connect(function(/*SqPlayer*/ player, /*int*/ old_state) {
});
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: PlayerAction
*/
SqCore.On().PlayerAction.Connect(function(/*SqPlayer*/ player, /*int*/ old_action, /*int*/ new_action) {
});
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: ActionNone
*/
SqCore.On().ActionNone.Connect(function(/*SqPlayer*/ player, /*int*/ old_action) {
});
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: ActionNormal
*/
SqCore.On().ActionNormal.Connect(function(/*SqPlayer*/ player, /*int*/ old_action) {
});
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: ActionAiming
*/
SqCore.On().ActionAiming.Connect(function(/*SqPlayer*/ player, /*int*/ old_action) {
});
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: ActionShooting
*/
SqCore.On().ActionShooting.Connect(function(/*SqPlayer*/ player, /*int*/ old_action) {
});
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: ActionJumping
*/
SqCore.On().ActionJumping.Connect(function(/*SqPlayer*/ player, /*int*/ old_action) {
});
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: ActionLieDown
*/
SqCore.On().ActionLieDown.Connect(function(/*SqPlayer*/ player, /*int*/ old_action) {
});
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: ActionGettingUp
*/
SqCore.On().ActionGettingUp.Connect(function(/*SqPlayer*/ player, /*int*/ old_action) {
});
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: ActionJumpVehicle
*/
SqCore.On().ActionJumpVehicle.Connect(function(/*SqPlayer*/ player, /*int*/ old_action) {
});
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: ActionDriving
*/
SqCore.On().ActionDriving.Connect(function(/*SqPlayer*/ player, /*int*/ old_action) {
});
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: ActionDying
*/
SqCore.On().ActionDying.Connect(function(/*SqPlayer*/ player, /*int*/ old_action) {
});
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: ActionWasted
*/
SqCore.On().ActionWasted.Connect(function(/*SqPlayer*/ player, /*int*/ old_action) {
});
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: ActionEmbarking
*/
SqCore.On().ActionEmbarking.Connect(function(/*SqPlayer*/ player, /*int*/ old_action) {
});
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: ActionDisembarking
*/
SqCore.On().ActionDisembarking.Connect(function(/*SqPlayer*/ player, /*int*/ old_action) {
});
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: PlayerBurning
*/
SqCore.On().PlayerBurning.Connect(function(/*SqPlayer*/ player, /*bool*/ is_on_fire) {
});
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: PlayerCrouching
*/
SqCore.On().PlayerCrouching.Connect(function(/*SqPlayer*/ player, /*bool*/ is_crouching) {
});
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: PlayerGameKeys
*/
SqCore.On().PlayerGameKeys.Connect(function(/*SqPlayer*/ player, /*int*/ old_keys, /*int*/ new_keys) {
});
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: PlayerStartTyping
*/
SqCore.On().PlayerStartTyping.Connect(function(/*SqPlayer*/ player) {
});
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: PlayerStopTyping
*/
SqCore.On().PlayerStopTyping.Connect(function(/*SqPlayer*/ player) {
});
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: PlayerAway
*/
SqCore.On().PlayerAway.Connect(function(/*SqPlayer*/ player, /*bool*/ is_away) {
});
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: PlayerMessage
*/
SqCore.On().PlayerMessage.Connect(function(/*SqPlayer*/ player, /*string*/ message) {
});
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: PlayerCommand
*/
SqCore.On().PlayerCommand.Connect(function(/*SqPlayer*/ player, /*string*/ message) {
g_Cmd.Run(player, command); // Forward this command to the command manager
});
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: PlayerPrivateMessage
*/
SqCore.On().PlayerPrivateMessage.Connect(function(/*SqPlayer*/ player, /*SqPlayer*/ target_player, /*string*/ message) {
});
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: PlayerKeyPress
*/
SqCore.On().PlayerKeyPress.Connect(function(/*SqPlayer*/ player, /*SqKeybind*/ bind) {
});
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: PlayerKeyRelease
*/
SqCore.On().PlayerKeyRelease.Connect(function(/*SqPlayer*/ player, /*SqKeybind*/ bind) {
});
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: PlayerSpectate
*/
SqCore.On().PlayerSpectate.Connect(function(/*SqPlayer*/ player, /*SqPlayer*/ target_player) {
});
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: PlayerUnspectate
*/
SqCore.On().PlayerUnspectate.Connect(function(/*SqPlayer*/ player) {
});
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: PlayerCrashreport
*/
SqCore.On().PlayerCrashreport.Connect(function(/*SqPlayer*/ player, /*string*/ report) {
});
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: PlayerModuleList
*/
SqCore.On().PlayerModuleList.Connect(function(/*SqPlayer*/ player, /*string*/ list) {
});
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: ClientScriptData
*/
SqCore.On().ClientScriptData.Connect(function(/*SqPlayer*/ player, /*SqBuffer*/ data, /*int*/ size) {
});
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: PlayerUpdate
*/
SqCore.On().PlayerUpdate.Connect(function(/*SqPlayer*/ player, /*int*/ update_type) {
});
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: PlayerHealth
*/
SqCore.On().PlayerHealth.Connect(function(/*SqPlayer*/ player, /*float*/ old_health, /*float*/ new_health) {
});
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: PlayerArmour
*/
SqCore.On().PlayerArmour.Connect(function(/*SqPlayer*/ player, /*float*/ old_armour, /*float*/ new_armour) {
});
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: PlayerWeapon
*/
SqCore.On().PlayerWeapon.Connect(function(/*SqPlayer*/ player, /*int*/ old_weapon, /*int*/ new_weapon) {
});
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: PlayerHeading
*/
SqCore.On().PlayerHeading.Connect(function(/*SqPlayer*/ player, /*float*/ old_heading, /*float*/ new_heading) {
});
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: PlayerPosition
*/
SqCore.On().PlayerPosition.Connect(function(/*SqPlayer*/ player, /*int*/ header, /*object*/ payload) {
});
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: PlayerOption
*/
SqCore.On().PlayerOption.Connect(function(/*SqPlayer*/ player, /*int*/ option_id, /*bool*/ value, /*int*/ header, /*object*/ payload) {
});
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: PlayerAdmin
*/
SqCore.On().PlayerAdmin.Connect(function(/*SqPlayer*/ player, /*bool*/ old_status, /*bool*/ new_status) {
});
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: PlayerWorld
*/
SqCore.On().PlayerWorld.Connect(function(/*SqPlayer*/ player, /*int*/ old_world, /*int*/ new_world, /*bool*/ secondary) {
});
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: PlayerTeam
*/
SqCore.On().PlayerTeam.Connect(function(/*SqPlayer*/ player, /*int*/ old_team, /*int*/ new_team) {
});
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: PlayerSkin
*/
SqCore.On().PlayerSkin.Connect(function(/*SqPlayer*/ player, /*int*/ old_skin, /*int*/ new_skin) {
});
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: PlayerMoney
*/
SqCore.On().PlayerMoney.Connect(function(/*SqPlayer*/ player, /*int*/ old_money, /*int*/ new_money) {
});
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: PlayerScore
*/
SqCore.On().PlayerScore.Connect(function(/*SqPlayer*/ player, /*int*/ old_score, /*int*/ new_score) {
});
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: PlayerWantedLevel
*/
SqCore.On().PlayerWantedLevel.Connect(function(/*SqPlayer*/ player, /*int*/ old_level, /*int*/ new_level) {
});
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: PlayerImmunity
*/
SqCore.On().PlayerImmunity.Connect(function(/*SqPlayer*/ player, /*int*/ old_immunity, /*int*/ new_immunity) {
});
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: PlayerAlpha
*/
SqCore.On().PlayerAlpha.Connect(function(/*SqPlayer*/ player, /*int*/ old_alpha, /*int*/ new_alpha, /*int*/ fade) {
});
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: PlayerEnterArea
*/
SqCore.On().PlayerEnterArea.Connect(function(/*SqPlayer*/ player, /*SqArea*/ area) {
});
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: PlayerLeaveArea
*/
SqCore.On().PlayerLeaveArea.Connect(function(/*SqPlayer*/ player, /*SqArea*/ area) {
});

View File

@ -0,0 +1,55 @@
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: ServerStartup
*/
SqCore.On().ServerStartup.Connect(function(/*...*/) {
});
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: ServerShutdown
*/
SqCore.On().ServerShutdown.Connect(function(/*...*/) {
});
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: ServerFrame
*/
SqCore.On().ServerFrame.Connect(function(/*float*/ elapsed_time) {
});
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: IncomingConnection
*/
SqCore.On().IncomingConnection.Connect(function(/*string*/ player_name, /*int*/ name_buffer_size, /*string*/ user_password, /*string*/ ip_address) {
});
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: EntityPool
*/
SqCore.On().EntityPool.Connect(function(/*int*/ entity_type, /*Sq[Entity]*/ entity, /*bool*/ is_deleted) {
});
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: EntityStream
*/
SqCore.On().EntityStream.Connect(function(/*SqPlayer*/ player, /*Sq[Entity]*/ entity, /*int*/ entity_type, /*bool*/ is_deleted) {
});
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: ServerOption
*/
SqCore.On().ServerOption.Connect(function(/*int*/ option, /*bool*/ value, /*int*/ header, /*object*/ payload) {
});
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: ScriptReload
*/
SqCore.On().ScriptReload.Connect(function(/*int*/ header, /*object*/ payload) {
});
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: ScriptLoaded
*/
SqCore.On().ScriptLoaded.Connect(function(/*...*/) {
});

127
bin/demo/events/vehicle.nut Normal file
View File

@ -0,0 +1,127 @@
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: VehicleCreated
*/
SqCore.On().VehicleCreated.Connect(function(/*SqVehicle*/ vehicle, /*int*/ header, /*object*/ payload) {
});
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: VehicleDestroyed
*/
SqCore.On().VehicleDestroyed.Connect(function(/*SqVehicle*/ vehicle, /*int*/ header, /*object*/ payload) {
});
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: VehicleCustom
*/
SqCore.On().VehicleCustom.Connect(function(/*SqVehicle*/ vehicle, /*int*/ header, /*object*/ payload) {
});
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: VehicleStream
*/
SqCore.On().VehicleStream.Connect(function(/*SqPlayer*/ client, /*SqVehicle*/ vehicle, /*bool*/ is_deleted) {
});
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: VehicleExplode
*/
SqCore.On().VehicleExplode.Connect(function(/*SqVehicle*/ vehicle) {
});
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: VehicleRespawn
*/
SqCore.On().VehicleRespawn.Connect(function(/*SqVehicle*/ vehicle) {
});
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: VehicleUpdate
*/
SqCore.On().VehicleUpdate.Connect(function(/*SqVehicle*/ vehicle, /*int*/ update_type) {
});
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: VehicleColor
*/
SqCore.On().VehicleColor.Connect(function(/*SqVehicle*/ vehicle, /*int*/ changed) {
});
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: VehicleHealth
*/
SqCore.On().VehicleHealth.Connect(function(/*SqVehicle*/ vehicle, /*float*/ old_health, /*float*/ new_health) {
});
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: VehiclePosition
*/
SqCore.On().VehiclePosition.Connect(function(/*SqVehicle*/ vehicle) {
});
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: VehicleRotation
*/
SqCore.On().VehicleRotation.Connect(function(/*SqVehicle*/ vehicle) {
});
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: VehicleOption
*/
SqCore.On().VehicleOption.Connect(function(/*SqVehicle*/ vehicle, /*int*/ option_id, /*bool*/ value, /*int*/ header, /*object*/ payload) {
});
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: VehicleWorld
*/
SqCore.On().VehicleWorld.Connect(function(/*SqVehicle*/ vehicle, /*int*/ old_world, /*int*/ new_world) {
});
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: VehicleImmunity
*/
SqCore.On().VehicleImmunity.Connect(function(/*SqVehicle*/ vehicle, /*int*/ old_immunity, /*int*/ new_immunity) {
});
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: VehiclePartStatus
*/
SqCore.On().VehiclePartStatus.Connect(function(/*SqVehicle*/ vehicle, /*int*/ part, /*int*/ old_status, /*int*/ new_status) {
});
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: VehicleTyreStatus
*/
SqCore.On().VehicleTyreStatus.Connect(function(/*SqVehicle*/ vehicle, /*int*/ tyre, /*int*/ old_status, /*int*/ new_status) {
});
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: VehicleDamageData
*/
SqCore.On().VehicleDamageData.Connect(function(/*SqVehicle*/ vehicle, /*int*/ old_data, /*int*/ new_data) {
});
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: VehicleRadio
*/
SqCore.On().VehicleRadio.Connect(function(/*SqVehicle*/ vehicle, /*int*/ old_radio, /*int*/ new_radio) {
});
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: VehicleHandlingRule
*/
SqCore.On().VehicleHandlingRule.Connect(function(/*SqVehicle*/ vehicle, /*int*/ rule, /*float*/ old_data, /*float*/ new_data) {
});
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: VehicleEnterArea
*/
SqCore.On().VehicleEnterArea.Connect(function(/*SqVehicle*/ vehicle, /*SqArea*/ area) {
});
/* --------------------------------------------------------------------------------------------------------------------
* Bind to global event: VehicleLeaveArea
*/
SqCore.On().VehicleLeaveArea.Connect(function(/*SqVehicle*/ vehicle, /*SqArea*/ area) {
});

View File

@ -37,8 +37,10 @@ VerbosityLevel=0
# - Execute=path > Compile the script and execute it immediately # - Execute=path > Compile the script and execute it immediately
# - Section=name > Search for more scripts in a different section # - Section=name > Search for more scripts in a different section
[Scripts] [Scripts]
Execute=bootstrap.nut #Execute=bootstrap.nut
Execute=demo/boot.nut
# Custom script options # Custom script options
[Options] [Options]
MyOption="Hello from config!" ScriptFolder=demo
OwnerContact=no.email@to.me