Jump to content

How can I get the rows for the group selected?


Recommended Posts

Posted
Hello! How can i get from mysql db the vehicles that are for the group 1? I wanna put them in the dialog (list).
What i want to do is when the user uses [/sfv] to show me the vehicles for the group x. how can i do that?
mp.events.addCommand('sfv', (player) => {
    if(player.data.playerGroup == -1) return sendMessage(player, '#32a852', `Eroare: !{#FFFFFF}Nu faci parte dintr-o factiune.`);
    showSFV(player, player.data.playerGroup);
});  
 
function showSFV(player, faction) {
    let list = [];
 
    player.selectoptions = [];
 
    let f = player.data.playerGroup;
    let text = `[SFV]: Faction #${f}`;
 
    for(let x = 0; x < 3; x++) {
        list.push(struct.sfv[x].vehID + ". " + struct.sfv[x].vehModel);
        player.selectoptions.push(x);
    }
 
    player.call(SERVER_EVENT.REQUEST_DIALOG, ["listItem",
        "sfv_dialog",
        text,
        "sfv dialog",
        list,
        ["Spawn", "Cancel"],
    ]);
    return 1;
}
1CBBcO2.png
Posted

Well, you would probably do something like  SELECT * FROM cars WHERE faction = 1;

And than with those results display them in dialog...

All you need is knowledge of MySQL

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...