main55.lua

来自「Yes, but I just don t care :@」· LUA 代码 · 共 116 行

LUA
116
字号
--[[-----------------------------------------------------
Welcome to Vice City Online RC1!
This file is the main LUA file that is required for your
server to start up.  This is also the file that contains
the skeleton to your game mode.  This file has been designed 
only to give you a SKELTON of VCO to help you get started 
with your server. This file gives you approximately
2 to 5% of VCO's capability - the rest is up to you to add!
So, what are we waiting for?  Let's get started! :-)				
---------------------------------------------------------]]

local SERVER_INITIAL_HOUR = 12
local SERVER_INITIAL_MINUTE = 0
local DEATH_MONEY = 500

-- Step 1.  Server Configuration
setServerName("Your Server Name") -- The name of your server.
setModeName("VCO Stock Script") -- The name of the mode.
setMaxPlayers(3) -- The maximum amount of players to allow, MAX = 100!
setServerPort(7777) -- The port of your server.
--toggleStaticInitialWantedLevel(true) -- Allows players to not automatically obtain wanted levels when they connect, unless you manually change it by scripting.
announce(true) -- Allows the master server to see your server.
--setServerTime(SERVER_INITIAL_HOUR,SERVER_INITIAL_MINUTE)  -- This is not techincally a server configuration function, but we want the time to be noon when the server starts!
--setVehicleRespawnDelay(time_in_ms)  -- If you want to change the time in milliseconds for all inactive vehicles to respawn.
setServerPassword("blahblah22") -- Password of the server.
--bindtoIP("xxx.xxx.xxx.xxx") -- Some servers require that you bind to an adapter, this is how to do it!



-- Step 2.  Vehicles and spawn selection.

--[[----------------------------------------------------------------------------------------------
A.  Spawn Selection
In this example, we create spawn selections of only the Tommy Vercetti models in a for loop
structure.  All of them are added with predefined weapons (list of IDs are on the wiki reference!
-------------------------------------------------------------------------------------------------]]
outputConsole("Creating class members...")
local ClassID = 
	addSpawnClass("Attack of Tommy Vercettis!",255,255,0,-924.072632,1050.113281,13.200515,180.0,-924.058716,1046.070435,11.8,8)  -- Create the spawn class for members to be added
for i = 160, 171 do
	    addClassMember(ClassID,i,-975.841736,-353.321747,13.381999,179.083511,0,0,0,0,0,0)  -- Add the class members to the class (look on the wiki for param details!)
end

--[[----------------------------------------------------------------------------------------------
B.  Vehicles
In this example, we will load the vehicles in a separate extension.  The extension is comparative
to a class in the sense that it "extends" the reach of the Main to other files - it makes it
easy to separate sections of code by putting them in a separate file.  NOTE:  It is not recommended
to put callbacks in extensions
-------------------------------------------------------------------------------------------------]]
outputConsole("Creating vehicles and loading the extension...")
loadExtension("Extensions\\Extension_Vehicles.lua") -- Path could include a folder, but must remain relative to the server executable.



-- Step 3.  Commands and Callbacks

--[[----------------------------------------------------------------------------------------------
Here, we will show you how to make some simple commands, use timers, and use callbacks.  Once again,
this will barely show you any amount of VCO's capability.  To utilize the rest, please use the wiki
at www.wiki.gtagaming.com.
-------------------------------------------------------------------------------------------------]]

--------------------------------------------------------------------------------
-- Random positional spawns and weapons
--------------------------------------------------------------------------------

Vector2 = {}
Vector2.new = function (x, y, z, a)
  return {x = x, y = y, z = z, a = a}
end

function Vector2(x, y, z, a)
  return { x = x, y = y, z = z, a = a }
end

RandomPlayerSpawns = {
    Vector2(-1085.697388,1328.417480,13.918841,270.518494),
	Vector2(-441.118500,1352.572388,11.767310,184.376846),
    Vector2(-691.897278,1012.659180,11.284841,273.389435),
	Vector2(-914.259583,809.868164,11.503360,270.161682),
	Vector2(-828.043579,1038.605835,15.748302,88.752869),
	Vector2(-1081.239502,350.049103,11.263079,180.634842),
	Vector2(-964.648071,87.287834,10.222876,358.123962),
    Vector2(-1201.147217,-327.883362,10.941987,236.072342),
	Vector2(-1059.333984,-286.879181,11.218000,273.593353),
	Vector2(-1007.977844,-687.410767,11.791591,280.832733),
	Vector2(-887.577209,-340.917603,11.103408,269.287415),
	Vector2(-833.120605,-896.283020,11.103400,265.697937),
	Vector2(-994.008057,-1172.383057,14.834201,1.239980),
	Vector2(-1399.304810,-870.979004,14.871703,28.984453),
	Vector2(37.820721,-1070.841553,10.463274,350.110443),
	Vector2(189.448959,-1009.923767,11.475411,253.227417),
	Vector2(-229.635605,-1300.449219,9.112956,100.284714),
	Vector2(243.091965,-1242.019287,11.071229,257.587402),
	Vector2(268.389374,46.994949,10.836026,150.144608),
	Vector2(290.449463,1017.667725,13.474011,278.363800),
	Vector2(17.132889,1150.879150,23.527164,183.130203),
	Vector2(-106.718254,1008.730286,10.940253,270.413940),
	Vector2(100.420830,252.573334,21.771896,200.508957),
	Vector2(-378.334442,-546.640015,17.283043,358.006531)
}

function onPlayerSpawn(PlayerID)
	local Random = strval(math.random(1,24))
    local X = RandomPlayerSpawns[Random].x
    local Y = RandomPlayerSpawns[Random].y
    local Z = RandomPlayerSpawns[Random].z
	local Angle = RandomPlayerSpawns[Random].a
	setPlayerPos(PlayerID,X,Y,Z)
    setPlayerAngle(PlayerID,Angle)
	
	givePlayerWeapon(PlayerID,strval(math.random(2,10)),1) -- Melee weapon
	givePlayerWeapon(PlayerID,strval(math.random(19,21)),40) -- Shotgun
	givePlayerWeapon(PlayerID,strval(math.random(22,27)),750) -- Automatic weapon
end

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?