Rick Posted September 13, 2017 Posted September 13, 2017 (edited) So, i just convert rootcause script from GT-MP to RAGE https://imgur.com/a/kidcW Methods There are 10 exported methods you can use to display notifications to a certain player/all players. Don't forget to check examples! Spoiler module.exports.SendMessage = function(player, message, type, time = 1000, place = "bottomRight") { player.call('ReceiveNotification', message, type, time, place); } module.exports.SendMessageToAll = function(message, type, time = 1000, place = "bottomRight") { mp.players.forEach( (player, id) => { player.call('ReceiveNotification', message, type, time, place); } ); } module.exports.SendInfoMessage = function(player, message, time = 1000, place = "bottomRight") { player.call('ReceiveNotification', message, "info", time, place); } module.exports.SendErrorMessage = function(player, message, time = 1000, place = "bottomRight") { player.call('ReceiveNotification', message, "error", time, place); } module.exports.SendSuccessMessage = function(player, message, time = 1000, place = "bottomRight") { player.call('ReceiveNotification', message, "success", time, place); } module.exports.SendWarningMessage = function(player, message, time = 1000, place = "bottomRight") { player.call('ReceiveNotification', message, "warning", time, place); } module.exports.SendInfoMessageToAll = function(message, time = 1000, place = "bottomRight") { mp.players.forEach( (player, id) => { player.call('ReceiveNotification', message, "info", time, place); } ); } module.exports.SendErrorMessageToAll = function(message, time = 1000, place = "bottomRight") { mp.players.forEach( (player, id) => { player.call('ReceiveNotification', message, "error", time, place); } ); } module.exports.SendSuccessMessageToAll = function(message, time = 1000, place = "bottomRight") { mp.players.forEach( (player, id) => { player.call('ReceiveNotification', message, "success", time, place); } ); } module.exports.SendWarningMessageToAll = function(message, time = 1000, place = "bottomRight") { mp.players.forEach( (player, id) => { player.call('ReceiveNotification', message, "warning", time, place); } ); } Parameters These are the valid options for "type": alert info success warning error These are the valid options for "place": top topLeft topCenter topRight center centerLeft centerRight bottom bottomLeft bottomCenter bottomRight Time parameter uses milliseconds so if you want to display a notification for 6 seconds you must write 6000 - aka multiply seconds by 1000 Example Spoiler var DB = require('../modules/db'); var notice = require('../modules/notice'); var md5 = require('md5'); module.exports.playerAuth = function(player, username, password) { DB.Handle.query("SELECT * FROM server_players WHERE Name = ? AND Password = ? LIMIT 1", [username, md5(password)], function(e, result) { if (e) throw e; if ( result.length ) { player.name = result[0]["Name"]; player.sqlID = result[0]["ID"]; notice.SendSuccessMessage(player, "Welcome back, " + player.name, 1000, "bottomRight"); player.call('authResponse', true); } else { notice.SendErrorMessage(player, "Wrong username or password !", 1000, "bottomRight"); } }); }; Download : https://drive.google.com/file/d/0B4IUeQBGaaEeRlpDaUVwTW04Skk/view?usp=sharing Edited September 13, 2017 by Rick 3 1
Joshua Posted September 13, 2017 Posted September 13, 2017 Great release man, awesome to see people are contributing to the rage.mp community.
Austin Posted September 14, 2017 Posted September 14, 2017 Great share! People really need to start using this for releases and not the Tutorials section.
Kiro_Nario Posted September 12, 2020 Posted September 12, 2020 (edited) Am 13.9.2017 um 19:53 schrieb Rick: Am 4.11.2019 um 21:48 schrieb Legos031: when i call notice. i get UNDEFINED same Edited September 12, 2020 by Kiro_Nario
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now