Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions scripts/base/mallmadness.nut
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
//

skinIDs <- [ 9, 10, 11, 15, 16,
26, 30, 31, 32, 33,
34, 42, 44, 45, 50,
71, 72, 139 ];

function createClasses() {
local team = 0;
foreach (id in skinIDs) {
AddClass(team++, RGB(100,149,237), id, Vector(460, 1150, 35), 0,
(team % 6) + 3, 1, 21, 20, 23, 90);
}
}

function onScriptLoad() {
SetGameModeName("Mall Madness");
createClasses();
SetVehiclesForcedRespawnHeight( 10000 );
SetFrameLimiter(true);

SetSpawnPlayerPos(460, 1150, 35);
SetSpawnCameraPos(460, 1155, 38);
SetSpawnCameraLook(460, 1150, 35);
}

function onPlayerJoin( player ) {
MessagePlayer( "[#FF0000]Welcome to this VC-MP Mall Madness Server. ", player );
PrivMessage( player, "Have a look at /rules and /help before playing." );
}

function onPlayerCommand( player, cmd, text ) {
cmd = cmd.tolower();
if (cmd == "rules") {
Message( "No disturbing other's play. Kids only." );
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Must be updated.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. Suggestions welcome!

} else if (cmd == "help") {
MessagePlayer("[#8080A0]/rules /help", player);
}
}
27 changes: 15 additions & 12 deletions scripts/main.nut
Original file line number Diff line number Diff line change
Expand Up @@ -42,21 +42,24 @@ function random( min = 0, max = RAND_MAX ) {

dofile("./scripts/scripts.nut")

scripts_load("base/freeroam.nut")
scripts_load("module/interiors.nut")
scripts_load("module/vehicle_spawner.nut")
//scripts_load("base/freeroam.nut")
scripts_load("base/mallmadness.nut")
//scripts_load("module/interiors.nut")
//scripts_load("module/vehicle_spawner.nut")
scripts_load("module/emote.nut")
scripts_load("module/teleporter.nut")
scripts_load("module/spectate.nut")
scripts_load("module/stadium.nut")
//scripts_load("module/teleporter.nut")
//scripts_load("module/spectate.nut")
//scripts_load("module/stadium.nut")
//scripts_load("module/auto_class.nut") //FIXME: Clashes with spectate
scripts_load("module/chat.nut")
scripts_load("module/goto.nut")
scripts_load("module/stunting.nut")
scripts_load("module/skin.nut")
scripts_load("module/color.nut")
scripts_load("module/ramp.nut")
scripts_load("module/taxi_stunting.nut")
scripts_load("module/random_spawn.nut")
scripts_load("module/weapon_pickups.nut")
//scripts_load("module/goto.nut")
//scripts_load("module/stunting.nut")
//scripts_load("module/skin.nut")
//scripts_load("module/color.nut")
//scripts_load("module/ramp.nut")
//scripts_load("module/taxi_stunting.nut")
scripts_load("module/admin.nut")
//scripts_load("module/debug.nut")
print("Scripts loaded")
17 changes: 17 additions & 0 deletions scripts/module/random_spawn.nut
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
spawns <- [Vector(459.92, 1005.26, 19.1811),
Vector(456.142, 1090.34, 18.6455),
Vector(453.955, 1102.85, 19.2268),
Vector(362.586, 1060.88, 19.1874),
Vector(464.045, 1202.4, 19.0113),
Vector(428.258, 1224.51, 25.3848),
Vector(373.796, 1244.51, 25.6426),
Vector(356.106, 1111.4, 25.3876),
Vector(414.485, 1138.62, 22.7296),
Vector(431.755, 1078.82, 19.0915)];

function onPlayerSpawn( player ) {
local pos = spawns[rand() % spawns.len()];
local offsetY = ((rand() % 40) - 20) / 10;
local offsetX = ((rand() % 40) - 20) / 10;
TeleportPlayer(player, Vector(pos.x+offsetX, pos.y+offsetY, pos.z), 0);
}
50 changes: 50 additions & 0 deletions scripts/module/weapon_pickups.nut
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
// No, these should not be in strict numerical order.
weaponModelIDs <- [293, 259, 260, 261, 262, 263, 264, 265, 266, 267,
268, 269, 270, 291, 271, 272, 273, 274, 275, 277,
278, 279, 281, 282, 283, 284, 280, 276, 285, 286,
287, 288, 289, 290];

alive <- array(100, null);
droppedWeapons <- {};

function onPlayerSpawn( player ) {
alive[player.ID] = true;
}

function onPlayerPart( player, reason ) {
alive[player.ID] = null;
}

function onPlayerHealthChange( player, lastHP, newHP ) {
if ( newHP < 0.1 && alive[player.ID]) {
alive[player.ID] = false;
local pos = player.Pos;
local x;
local y;
local alpha;
local radius = 1.0;
local pickup = null;
for (local i = 0; i <= 8; ++i) {
if ( player.GetWeaponAtSlot(i) ) {
alpha = (i / 8.0 * 2.0 * PI) + player.Angle;
x = pos.x + sin(alpha) * radius;
y = pos.y + cos(alpha) * radius;
pickup = CreatePickup(weaponModelIDs[ player.GetWeaponAtSlot(i) ],
player.World, player.GetAmmoAtSlot(i),
x, y, pos.z, 255, true);
if ( pickup ) {
droppedWeapons.rawset( pickup.ID, pickup);
}
}
}
}
}

function onPickupClaimPicked( player, pickup ) {
if ( alive[player.ID] ) {
droppedWeapons.rawdelete( pickup.ID );
pickup.Remove();
return 1;
}
return 0;
}