javad_iran 0 Posted September 7, 2018 how to get money in MySQL Gamemode [Login/Registration System] the code not working: player.getMoney(250); please help me sorry for bad english... Share this post Link to post Share on other sites
MrPancakers 108 Posted September 7, 2018 player.getMoney() is a clientside function, so it needs to be mp.players.local.getMoney(); You also don't need to provide a number inside the brackets, the function is used to GET money, not SET how much the player has. Share this post Link to post Share on other sites
javad_iran 0 Posted September 7, 2018 12 minutes ago, MrPancakers said: player.getMoney() is a clientside function, so it needs to be mp.players.local.getMoney(); You also don't need to provide a number inside the brackets, the function is used to GET money, not SET how much the player has. error: mp.players.local.getMoney is not a function mp.players.local.getMoney(250); how to fix? Share this post Link to post Share on other sites
MrPancakers 108 Posted September 7, 2018 2 minutes ago, javad_iran said: error: mp.players.local.getMoney is not a function mp.players.local.getMoney(250); how to fix? I should have asked, are you doing this clientside or serverside Share this post Link to post Share on other sites
javad_iran 0 Posted September 7, 2018 (edited) 8 minutes ago, MrPancakers said: I should have asked, are you doing this clientside or serverside See, I want to do it, when someone creates a vehicle, 250 money will be reduced, this is my vehicle's server code: mp.events.addCommand('veh', (player, _, vehName) => { if (vehName && vehName.trim().length > 0) { mp.players.local.getMoney(250); let pos = player.position; pos.x += 2; // If player has vehicle - change model. if (player.customData.vehicle) { player.customData.vehicle.repair(); player.customData.vehicle.position = pos; player.customData.vehicle.model = mp.joaat(vehName); // Else - create new vehicle. } else { player.customData.vehicle = mp.vehicles.new(mp.joaat(vehName), pos); } } else { player.outputChatBox(`<b>Command syntax:</b> /veh [vehicle_name]`); } }); sorry for bad english Edited September 7, 2018 by javad_iran Share this post Link to post Share on other sites
MrPancakers 108 Posted September 7, 2018 43 minutes ago, javad_iran said: See, I want to do it, when someone creates a vehicle, 250 money will be reduced, this is my vehicle's server code: mp.events.addCommand('veh', (player, _, vehName) => { if (vehName && vehName.trim().length > 0) { mp.players.local.getMoney(250); let pos = player.position; pos.x += 2; // If player has vehicle - change model. if (player.customData.vehicle) { player.customData.vehicle.repair(); player.customData.vehicle.position = pos; player.customData.vehicle.model = mp.joaat(vehName); // Else - create new vehicle. } else { player.customData.vehicle = mp.vehicles.new(mp.joaat(vehName), pos); } } else { player.outputChatBox(`<b>Command syntax:</b> /veh [vehicle_name]`); } }); sorry for bad english Do player.money -= 250 (This will take away 250 from player.money) player.getMoney() is a clientside function so you can't use it serverside which is what you're trying to do. Share this post Link to post Share on other sites
javad_iran 0 Posted September 7, 2018 10 minutes ago, MrPancakers said: Do player.money -= 250 (This will take away 250 from player.money) player.getMoney() is a clientside function so you can't use it serverside which is what you're trying to do. Thank you very much, the problem was fixed I had another question: How to make a bet if there are 250 money, make a car, otherwise it will give an error very sorry for bad english , i am use translate Share this post Link to post Share on other sites
MrPancakers 108 Posted September 7, 2018 1 minute ago, javad_iran said: Thank you very much, the problem was fixed I had another question: How to make a bet if there are 250 money, make a car, otherwise it will give an error very sorry for bad english , i am use translate if(player.money < 250) return player.outputChatBox("You don't have enough money."); Share this post Link to post Share on other sites
javad_iran 0 Posted September 8, 2018 On 9/7/2018 at 1:47 PM, MrPancakers said: if(player.money < 250) return player.outputChatBox("You don't have enough money."); thanks. how to player join , send message for all players online? (notify) sorry for bad english Share this post Link to post Share on other sites
MrPancakers 108 Posted September 9, 2018 16 hours ago, javad_iran said: thanks. how to player join , send message for all players online? (notify) sorry for bad english mp.players.broadcast() will send a message to all users on the server. Use the playerJoin event. Share this post Link to post Share on other sites