Commit 70ee3622 authored by Maxx Meyer's avatar Maxx Meyer

Basic Script Uplad

parent 28cd3e11
//Login Event
var browser1 = mp.browsers.new("package://login/index.html");
mp.gui.cursor.show(true, true);
mp.events.add("loginDataToServer", (user, pass, state) => {
mp.events.callRemote("sendDataToServer", user, pass, state);
});
mp.events.add("loginHandler", (handle) => {
switch(handle){
case "success":
{
browser1.destroy();
mp.gui.chat.push("Login successful");
mp.gui.chat.activate(true);
mp.gui.cursor.show(false, false);
break;
}
case "registered":
{
browser1.destroy();
mp.gui.chat.push("Registration successful");
mp.gui.chat.activate(true);
mp.gui.cursor.show(false, false);
break;
}
case "incorrectinfo":
{
browser1.execute(`$(".incorrect-info").show(); $("#loginBtn").show();`);
break;
}
case "takeninfo":
{
browser1.execute(`$(".taken-info").show(); $("#registerBtn").show();`);
break;
}
case "tooshort":
{
browser1.execute(`$(".short-info").show(); $("#registerBtn").show();`);
break;
}
case "logged":
{
browser1.execute(`$(".logged").show(); $("#loginBtn").show();`);
break;
}
default:
{
break;
}
}
});
//Time Event
(function() {
var clockInterval = 0;
if (!clockInterval) {
var hour = 0;
var min = 0;
var sec = 0;
clockInterval = setInterval(function() {
var d = new Date();
var h1 = d.getUTCHours();
var m1 = d.getUTCMinutes();
var s1 = d.getUTCSeconds();
var ms = d.getUTCMilliseconds();
hour = (Math.floor(m1/2) + h1 * 6) %24;
min = (Math.floor(s1/2) + m1 * 30) % 60;
sec = (Math.floor(ms*0.03) + s1 * 30) % 60;
mp.game.time.setClockTime(hour, min, sec);
mp.game.time.setClockDate(d.getUTCDate(), d.getUTCMonth(), d.getUTCFullYear());
}, 250);
}
})();
//Vehicle Enter Fix
mp.events.add('render', () =>
{
const controls = mp.game.controls;
controls.enableControlAction(0, 23, true);
controls.disableControlAction(0, 58, true);
if(controls.isDisabledControlJustPressed(0, 58))
{
let position = mp.players.local.position;
let vehHandle = mp.game.vehicle.getClosestVehicle(position.x, position.y, position.z, 5, 0, 70);
let vehicle = mp.vehicles.atHandle(vehHandle);
if(vehicle
&& vehicle.isAnySeatEmpty()
&& vehicle.getSpeed() < 5)
{
mp.players.local.taskEnterVehicle(vehicle.handle, 5000, 0, 2, 1, 0);
}
}
});
//Level System
const hudComponentID = 19;
const rankBarColor = 116; // HUD_COLOUR_FREEMODE, https://wiki.rage.mp/index.php?title=Fonts_and_Colors
// credit: https://illusivetea.me/FiveM/scaleforms.html
mp.events.add("updateRankBar", (limit, nextLimit, previousXP) => {
if (!mp.game.graphics.hasHudScaleformLoaded(hudComponentID)) {
mp.game.graphics.requestHudScaleform(hudComponentID);
while (!mp.game.graphics.hasHudScaleformLoaded(hudComponentID)) mp.game.wait(0);
mp.game.graphics.pushScaleformMovieFunctionFromHudComponent(hudComponentID, "SET_COLOUR");
mp.game.graphics.pushScaleformMovieFunctionParameterInt(rankBarColor);
mp.game.graphics.popScaleformMovieFunctionVoid();
}
mp.game.graphics.pushScaleformMovieFunctionFromHudComponent(hudComponentID, "SET_RANK_SCORES");
mp.game.graphics.pushScaleformMovieFunctionParameterInt(limit);
mp.game.graphics.pushScaleformMovieFunctionParameterInt(nextLimit);
mp.game.graphics.pushScaleformMovieFunctionParameterInt(previousXP);
mp.game.graphics.pushScaleformMovieFunctionParameterInt(mp.players.local.getVariable("currentXP"));
mp.game.graphics.pushScaleformMovieFunctionParameterInt(mp.players.local.getVariable("currentLevel"));
mp.game.graphics.popScaleformMovieFunctionVoid();
});
\ No newline at end of file
require("client.js");
mp.gui.chat.show(true);
mp.gui.chat.activate(false);
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
html body {
background-color: rgba(0, 0, 0, 0.5);
}
body .container {
margin-top:13%;
max-width: 600px;
}
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
function sendAccountInfo(state){
$('.alert-danger').hide();
if(state === 0){ //Login State
let loginName = document.getElementById("loginName");
let loginPass = document.getElementById("loginPass");
$("#loginBtn").hide();
mp.trigger("loginDataToServer", loginName.value, loginPass.value, state);
} else { //Register State
let registerName = document.getElementById("registerName");
let registerPass = document.getElementById("registerPass");
$("#registerBtn").hide();
mp.trigger("loginDataToServer", registerName.value, registerPass.value, state);
}
}
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="assets/css/style.css">
<link rel="stylesheet" type="text/css" href="assets/css/bootstrap.min.css">
<script src="assets/js/jquery-3.2.1.js"></script>
<script src="assets/js/bootstrap.min.js"></script>
</head>
<body>
<div class="container">
<div class="card">
<div class="card-body">
<h1 class="text-center">Five Life Login Panel</h1>
<br>
<div class="alert alert-danger incorrect-info" role="alert">
<i class="fas fa-exclamation-circle"></i> Error: Incorrect username or password.
</div>
<div class="alert alert-danger logged" role="alert">
<i class="fas fa-exclamation-circle"></i> Error: Account is currently in use.
</div>
<div class="alert alert-danger taken-info" role="alert">
<i class="fas fa-exclamation-circle"></i> Error: Username taken.
</div>
<div class="alert alert-danger short-info" role="alert">
<i class="fas fa-exclamation-circle"></i> Error: Username or Password is too short
</div>
<ul class="nav nav-tabs nav-justified" id="myTab" role="tablist">
<li class="nav-item">
<a class="nav-link active" id="login-tab" data-toggle="tab" href="#login" role="tab">Login</a>
</li>
<li class="nav-item">
<a class="nav-link" id="register-tab" data-toggle="tab" href="#register" role="tab">Register</a>
</li>
</ul>
<div class="tab-content" id="myTabContent">
<div class="tab-pane fade show active" id="login" role="tabpanel">
<div class="input-group mb-3">
<input type="text" class="form-control" id="loginName" placeholder="Username">
</div>
<div class="input-group mb-3">
<input type="password" class="form-control" id="loginPass" placeholder="Password">
</div>
<button type="button" class="btn btn-primary btn-lg btn-block" id="loginBtn" onclick="sendAccountInfo(0);">Login</button>
</div>
<div class="tab-pane fade" id="register" role="tabpanel">
<div class="input-group mb-3">
<input type="text" class="form-control" id="registerName" placeholder="Username (Min 3)">
</div>
<div class="input-group mb-3">
<input type="password" class="form-control" id="registerPass" placeholder="Password (Min 5)">
</div>
<button type="button" class="btn btn-success btn-lg btn-block" id="registerBtn" onclick="sendAccountInfo(1);">Register</button>
</div>
</div>
</div>
</div>
</div>
<script src="assets/js/main.js"></script>
<script type="text/javascript">
$('.alert-danger').hide();
</script>
</body>
</html>
\ No newline at end of file
{
"maxplayers" : 100,
"name" : "RAGE:MP Unofficial server",
"gamemode" : "five-life",
"stream-distance" : 500.0,
"announce" : false,
"csharp" : "disabled",
"port": 22005
}
\ No newline at end of file
# Auto detect text files and perform LF normalization
* text=auto
# Custom for Visual Studio
*.cs diff=csharp
*.sln merge=union
*.csproj merge=union
*.vbproj merge=union
*.fsproj merge=union
*.dbproj merge=union
# Standard to msysgit
*.doc diff=astextplain
*.DOC diff=astextplain
*.docx diff=astextplain
*.DOCX diff=astextplain
*.dot diff=astextplain
*.DOT diff=astextplain
*.pdf diff=astextplain
*.PDF diff=astextplain
*.rtf diff=astextplain
*.RTF diff=astextplain
#################
## Eclipse
#################
*.pydevproject
.project
.metadata
bin/
tmp/
*.tmp
*.bak
*.swp
*~.nib
local.properties
.classpath
.settings/
.loadpath
# External tool builders
.externalToolBuilders/
# Locally stored "Eclipse launch configurations"
*.launch
# CDT-specific
.cproject
# PDT-specific
.buildpath