donking011
Member
Hi guys,
I need some help with JS and LUA..
I saw a video from YT how can i make a fivem mod from 0. I checked all of them but it doesn't work...here is the code, anyone pls help?
And here is the main.js:
What's wrong with this?
I need some help with JS and LUA..
I saw a video from YT how can i make a fivem mod from 0. I checked all of them but it doesn't work...here is the code, anyone pls help?
Code:
RegisterNetEvent('LS-Base:Char:setupCharacters')
AddEventHandler('LS-Base:Char:setupCharacters', function()
LS.Functions.TriggerServerCallback('LS-Base:getChar', function(data) -- Gets all data from character
SendNUIMessage({type = "setupCharacters", characters = data})
end)
end)
And here is the main.js:
JavaScript:
window.addEventListener('message', function(event) {
var data = event.data;
if (data.type === "setupCharacters") {
var characters = data.characters;
if (characters !== null) {
$.each(characters, function (index, char) {
$('[data-charid=' + char.cid + ']').html('');
$('[data-charid=' + char.cid + ']').html('' +
// formatted for easier reading
'<div class="slot-name">' +
'<div class="slot-name-wrapper"><p><span id="slot-player-name">' + char.firstname + ' ' + char.lastname +'</span></p><br>' +
'<button class="play-button" data-cid="' + char.cid + '">Select</button></br><br>' +
'<button class="delete-button" data-cid="' + char.cid + '">Perma</button></br></div>'
);
})
}
}
What's wrong with this?