mirror of
https://github.com/danbulant/flying-squid
synced 2026-07-06 03:31:10 +00:00
Add gamemode command
This commit is contained in:
parent
02ee43183a
commit
0b78f258fa
1 changed files with 20 additions and 0 deletions
|
|
@ -5,7 +5,27 @@ function inject(serv, player, options)
|
||||||
player._client.on('chat', function (data) {
|
player._client.on('chat', function (data) {
|
||||||
if(data.message[0]=="/" && options.commands[data.message.slice(1)]) {
|
if(data.message[0]=="/" && options.commands[data.message.slice(1)]) {
|
||||||
player.chat("" + options.commands[data.message.slice(1)]);
|
player.chat("" + options.commands[data.message.slice(1)]);
|
||||||
|
} else if(data.message == "/gamemode" || data.message == "/gamemode 0" || data.message == "/gamemode 1") {
|
||||||
|
|
||||||
|
if(data.message == "/gamemode 0") {
|
||||||
|
player._client.write("game_state_change", {
|
||||||
|
reason: 3,
|
||||||
|
gameMode: 0
|
||||||
|
});
|
||||||
|
player.gameMode = 0;
|
||||||
|
player.chat("Gamemode changed to 0!");
|
||||||
|
} else if(data.message == "/gamemode 1") {
|
||||||
|
player._client.write("game_state_change", {
|
||||||
|
reason: 3,
|
||||||
|
gameMode: 1
|
||||||
|
});
|
||||||
|
player.gameMode = 1;
|
||||||
|
player.chat("Gamemode changed to 1!")
|
||||||
|
} else {
|
||||||
|
player.chat("Invalid usage! Try using /gamemode 1");
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
serv.broadcast('<' + player.username + '>' + ' ' + data.message);
|
serv.broadcast('<' + player.username + '>' + ' ' + data.message);
|
||||||
player.emit("chat",data.message);
|
player.emit("chat",data.message);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue