-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.cs
More file actions
84 lines (84 loc) · 2.5 KB
/
server.cs
File metadata and controls
84 lines (84 loc) · 2.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
package script_fumble
{
function Observer::onTrigger(%this, %obj, %triggerNum, %val,%a,%b)
{
parent::onTrigger(%this, %obj, %triggerNum, %val,%a,%b);
if(isObject(%client = %obj.getControllingClient()) && isEventPending(%client.fumbleSchedule) && (%client.canFumble || %client.isAdmin))
switch(%triggerNum)
{
case 4:
if(!%val)
{
cancel(%client.fumbleSchedule);
%client.player.unMount();
%client.setControlObject(%client.player);
}
case 0:
%client.FumbleRotation = %val;
}
}
};
activatePackage(script_fumble);
function servercmdCanFumble(%client,%find)
{
if(!%client.isSuperAdmin)
return;
if(%find $= "")
{
%client.chatMessage("\c6/canFumble [Name/BLID OR Toggle]");
return;
}
if(%find $= "toggle")
{
$canFumble = !$canFumble;
announce("\c6Fumble is now "@ ($canFumble ? "enabled":"disabled"));
return;
}
if(!isObject(%victim = findclientbyBL_ID(%find)))
if(!isObject(%victim = findclientbyname(%find)))
{
%client.chatMessage("\c6Could not find "@ %find @" by BLID or Name");
return;
}
%victim.canFumble = !%victim.canFumble;
%client.chatMessage("\c6"@ %victim.getPlayerName() @" can "@ (%victim.canFumble ? "now fumble" : "no longer fumble"));
%victim.chatMessage("\c6You can "@ (%victim.canFumble ? "now fumble" : "no longer fumble"));
}
function servercmdfumble(%client,%str)
{
if((!%client.isAdmin && !%client.canFumble) || !isObject(%player = %client.player))
return;
if(!$canFumble)
{
%client.chatMessage("\c6Fumble is disabled.");
return;
}
if(getSimTime() - %client.canFumbleLast < 2000)
{
%client.chatMessage("\c6Please wait before using this command.");
return;
}
%client.canFumbleLast = getSimTime();
cancel(%client.tumbleSchedule);
%tum = %player.getObjectMount();
if(!isObject(%tum))
{
tumble(%player,1);
%tum = %player.getObjectMount();
}
%client.fumbleSchedule(%str);
}
function GameConnection::fumbleSchedule(%client,%str)
{
cancel(%client.fumbleSchedule);
if(!isObject(%client) || !isObject(%player = %client.player) || (!%client.isAdmin && !%client.canFumble))
return;
if(!isObject(%tum = %player.getObjectMount()) || !isObject(%ctrl = %client.getControlObject()))
return;
%vel = vectorAdd(%tum.getVelocity(),vectorScale(%ctrl.getEyeVector(),%str));
%vel = vectorScale(vectorNormalize(%vel),%str);
%tum.setVelocity(%vel);
if(%client.FumbleRotation)
%tum.setAngularVelocity(getRandom(-%str,%str) SPC getRandom(-%str,%str) SPC getRandom(-%str,%str));
%client.fumbleSchedule = %client.schedule(50,fumbleSchedule,%str);
}