Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 06/28/20 in Posts

  1. That should work... // Connection file var mysql = require('mysql'); module.exports = { Handle: null, Connect: function(callback) { this.Handle = mysql.createConnection({ host : 'your_host', user : 'your_user', password : 'your_pass', database : 'your_database' }); this.Handle.connect(function(e) { if ( !e ) { callback(); } else console.log ("Error in Database " + e); }); } }; // White list file var db = require("./database"); mp.events.add("playerJoin", (player) => { db.Handle.query("SELECT * FROM whitelist WHERE socialID = ?", [player.socialClub], function(e, result) { if (!result.length){ player.kick("Not in whitelist."); }else{ // In Whitelist :) } }); But instead of using the social club, I recommend creating a login with a unique user ID. Players with pirate gta do not have the socialClub! Sorry for my English, I'm Brazilian.
    1 point
  2. I'm not sure how you can struggle with JavaScript if your background is PHP, they are both very loosely typed. You may want to look at the C# API. Take a look at the Resources if you want to learn from existing scripts.
    1 point
  3. If you are starting on this type of scripting without a conceptual understanding of programming (scripting/coding) then you will definitely struggle. The lack of documentation (specifically in regard to the Javascript stuff) and the lack of development support will require you to do a lot of digging and testing, yourself. Start a free trial with Lynda.com or Pluralsight.com (just examples) and learn the basics of programming/coding in the language you wish to learn and in it's primary use case. It will assist you greatly and the documentation available will be far easier to understand. Spamming the forums and copying/pasting code is not an efficient way to learn at all.
    1 point
×
×
  • Create New...